function na_hide_layer(lname) {
	document.getElementById(lname).style.display = "none";
	return false;		
}		

function na_show_layer(lname){
	document.getElementById(lname).style.display = "block";
	return false;
} 	

function na_change_img_src(name, nsdoc, rpath, preload){
	var img = document.getElementById(name);
	if (name == ''){
		return;
	}

	if (img) {
		img.altsrc = img.src;
		img.src    = rpath;
	}
}


function setEmbed() {
	var obj = new String;
	var parameter = new String;
	var embed = new String;
	var html = new String;
	var allParameter = new String;
	var clsid = new String;
	var codebase = new String;
	var pluginspace = new String;
	var embedType = new String;
	var src = new String;
	var width = new String;
	var height = new String;

	this.init = function( getType , s ,w , h ) {
		if ( getType == "flash" ) {
			clsid = "D27CDB6E-AE6D-11cf-96B8-444553540000";
			codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0";
			pluginspage = "http://www.macromedia.com/go/getflashplayer";
			embedType = "application/x-shockwave-flash";
		}
		parameter += "<param name='movie' value='"+ s + "'>\n";
		parameter += "<param name='quality' value='high'>\n";
		src = s;
		width = w;
		height = h;
	}

	this.parameter = function( parm , value ) {
		parameter += "<param name='"+parm +"' value='"+ value + "'>\n";
		allParameter += " "+parm + "='"+ value+"'";
	}

	this.show = function() {
		if ( clsid ) {
			obj = "<object classid=\"clsid:"+ clsid +"\" codebase=\""+ codebase +"\" width='"+ width +"' height='"+ height +"'>\n";
		}

		embed = "<embed src='" + src + "' pluginspage='"+ pluginspage + "' type='"+ embedType + "' width='"+ width + "' height='"+ height +"'"+ allParameter +" ></embed>\n";

		if ( obj ) {
			embed += "</object>\n";
		}

		html = obj + parameter + embed;

		document.write( html );
	}
}

function initMoving(id,xleft,ytop) {
  target = document.getElementById(id);
  if (!target) return false;
  var obj = target;
  obj.initLeft = xleft;
  obj.initTop = ytop;
  obj.bottomLimit = document.documentElement.scrollHeight - 0;
  obj.topLimit = 170;

  obj.style.position = "absolute";
  obj.top = obj.initTop;
  obj.left = obj.initLeft;
  obj.style.top = obj.top + "px";
  obj.style.left = obj.left + "px";

  obj.getTop = function() {
    if (document.documentElement.scrollTop) {
      return document.documentElement.scrollTop;
    } else if (window.pageYOffset) {
      return window.pageYOffset;
    } else {
      return 0;
    }
  }
  obj.getHeight = function() {
    if (self.innerHeight) {
      return self.innerHeight;
    } else if(document.documentElement.clientHeight) {
      return document.documentElement.clientHeight;
    } else {
      return 500;
    }
  }
  obj.move = setInterval(function() {
    pos = obj.getTop() + obj.getHeight() / 2 - 310;
    
    obj.bottomLimit = document.documentElement.scrollHeight - 0;
    
    if (pos > obj.bottomLimit)
      pos = obj.bottomLimit
    if (pos < obj.topLimit)
      pos = obj.topLimit

    interval = obj.top - pos;
    obj.top = obj.top - interval / 3;
    obj.style.top = obj.top + "px";
  }, 30)
} 

function newpop(name, winname, l, t, w, h, tlb, mnub, stat, scrl, resz)
{
    tlb = tlb ? 'yes' : 'no';
    mnub = mnub ? 'yes' : 'no';
    stat = stat ? 'yes' : 'no';
    scrl = scrl ? 'yes' : 'no';
    resz = resz ? 'yes' : 'no';
    window.open(name, winname, 'left='+l+', top='+t+', width='+w+', height='+h+', toolbar='+tlb+', menubar='+mnub+', status='+stat+', scrollbars='+scrl+', resizable='+resz);
}


/* Image RollOver */
function imgSwap(el){
	var imgContainer = document.getElementById(el);
	var imgAnchor = imgContainer.getElementsByTagName("a");
	for(var i=0; i<imgAnchor.length; i++){
		if(imgAnchor.item(i).className == "roll")
			imglist = imgAnchor.item(i);
		else
			continue;
		imglist.container = imgContainer;
		imglist.imgEl = imglist.getElementsByTagName("img").item(0);
		imglist.onmouseover = imglist.onblur = function imgSwapEvent(){
			current = this.container.current;
			if(current == this) return false;
			if(current){
				current.imgEl.src = current.imgEl.src.replace("_on.gif", ".gif");
				if(current.imgEl){
					current.imgEl.src = current.imgEl.src.replace("_on.gif", ".gif");
				}
			}
			if(this.imgEl){
				this.imgEl.src = this.imgEl.src.replace(".gif", "_on.gif");
			} else {
				this.imgEl.src = this.imgEl.src.replace("_on.gif", ".gif");
			}
			this.container.current = this;
			return false;
		}
		if(!imglist.container.first)
			imglist.container.first = imglist;
	}
	if(imgContainer.first)
		imgContainer.first.onmouseover();
}


/* toggle Menu */
function toggleInit(el){
		
	var container = document.getElementById(el);
	var toggleAnchor = container.getElementsByTagName("a");
	var toggleView = container.getElementsByTagName("div");
	
	for(var i=0; i<toggleAnchor.length; i++){
		if(toggleAnchor.item(i).className == "toggle")
			togglemenu = toggleAnchor.item(i);
		else
			continue;
			
		togglemenu.targetContainer = container;
		togglemenu.targetEl = document.getElementById(toggleAnchor.item(i).href.split("#")[1]);
		togglemenu.targetEl.style.display = "none";
		togglemenu.onclick = togglemenu.onfocus = function toggleView(){
			current = this.targetContainer.current;
			
			if(this == current) return false;
			
			if(current){
				current.targetEl.style.display = "none";
				current.className = "";
				if(current.targetEl){
					current.targetEl.style.display = "none";
					current.className = current.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "";
			
			if(this.targetEl){
				this.targetEl.style.display = "block";
				this.className = this.className.replace("", " on");
			} else {
				this.targetEl.style.display = "none";
				this.className = this.className.replace(" on", "");
			}
			
			this.targetContainer.current = this;
			return false;
		}
		if (!togglemenu.targetContainer.first)
			togglemenu.targetContainer.first = togglemenu;
	}
	if (container.first)
		container.first.onclick();
}

function swapView(){
	cView = document.getElementById("contentView");
	cClose = document.getElementById("contentClose");
	viewAnchor = cView.getElementsByTagName("a").item(0);
	closeAnchor = cClose.getElementsByTagName("a").item(0);
	cClose.parentNode.parentNode.style.display = "none";
	
	viewAnchor.onclick = viewAnchor.onfocus = function(){
		cClose.parentNode.parentNode.style.display = "block";
		cView.parentNode.style.display = "none";
	}
	closeAnchor.onclick = closeAnchor.onfocus = function(){
		cClose.parentNode.parentNode.style.display = "none";
		cView.parentNode.style.display = "block";
	}
}


function initTabsubCon(tabContainerID){
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;
	
	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;
	
		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		thismenu.onclick = thismenu.onfocus = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;
	
			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_ov.gif", ".gif");
				} else {
					currentmenu.className = currentmenu.className.replace(" ov", "");
				}
			}
			this.targetEl.style.display = "";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace(".gif", "_ov.gif");
			} else {
				this.className += " on";
			}
			this.container.current = this;
	
			return false;
		};
	
		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
		tabContainer.first.onclick();
}	


function pageDisplay(num, listnum){

	var cnt = listnum;
	for (var i=1; i<=cnt ; i++ ){
		var a = document.getElementById("conViewqna"+ i);
		if ( i == num){
			a.style.display = "inline";
		}else{
			a.style.display = "none";
		}
	}

}
