var menuOpen='';
var menuInt='';
var active_sid= "none";
var active_spn= "none";
var active_org= "none";

var timer = 0;

/* preload images function */
var swpimgcount = 6;

var swpimages = new Array();

function preloadImages() {
	for (i=0; i<swpimgcount; i++) {
//		swpimages[i] = new Image;
		swpimages[i] = '/images/menuimg/topmn_item' + i + '_on.gif';
	}
}

/* End preload images function */

function show(sid,spanid,imgnum) {	
	clearTimeout(timer);
	var dobj = document.getElementById(spanid);
	var mobj = document.getElementById(sid);
 //	mobj.style.top=divTop(dobj)+22+"px";
  	mobj.style.left=divLeft(dobj)+18+"px";	
	mobj.style.display = "block";
	if(active_sid != sid && active_sid != "none") {
		hide(active_sid,active_spn,active_img);
	}
	active_sid = sid;
	active_spn = spanid;
	active_img = imgnum;
	var menitem = spanid + "_mn";
//	var swpimg = "/images/menuimg/topmn_item" + imgnum + "_on.gif";
	document.getElementById(menitem).src = swpimages[imgnum];
//	document.getElementById(menitem).src = swpimg;
}

function starthide(sid,spanid,imgnum) {	
	timer = setTimeout("hide('"+sid+"','"+spanid+"','"+imgnum+"')", 300);

}

function hide(sid,spanid,imgnum) {
	clearTimeout(timer);
	document.getElementById(sid).style.display = "none";
	 menitem = spanid + "_mn";
	var imgname = "/images/menuimg/topmn_item" + imgnum + ".gif";
	document.getElementById(menitem).src = imgname;
}


	
function divLeft (el) {
	var ol = el.offsetLeft;
//	while ((el = el.offsetParent) != null) {
//		ol += el.offsetLeft;
//	}
	return ol;
}

function divTop (el) {
	var ol = el.offsetTop;
	while ((el = el.offsetParent) != null) {
		ol += el.offsetTop;
	}
	return ol;
}

function open_mailwindow(url){
	geneva = window.open(url,'open_mailwindow','width=640,height=380,history=no,resizable=no,status=no,scrollbars=no,menubar=no');
}


function open_printpage(url){
	geneva = window.open(url,'open_printpage','width=615,history=no,resizable=yes,status=no,scrollbars=yes,menubar=yes');
}

function open_newwindow(url, w, h) {
         var win = window.open(url,'open_survey','toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,WIDTH='+w+',HEIGHT='+h);
		 win.focus();
}


//RollOver
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function show_movieLayer(bl,name){
	var mvobj = document.getElementById("movieLayer");
	if(bl){
		thetxt = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='330' height='270' id='moive' align='middle'>";
		thetxt += "<param name='allowScriptAccess' value='sameDomain' />";
		thetxt += "<param name='movie' value='/images/customer/movieimg/movie.swf' />";
		thetxt += "<param name='FlashVars' value='movName=" + name + "'>";
		thetxt += "<param name='quality' value='high' />";
		thetxt += "<param name='bgcolor' value='#000000' />";
		thetxt += "<param name='wmode' value='opaque'>";
		thetxt += "<embed src='/images/customer/movieimg/movie.swf' FlashVars='movName=" + name + "' quality='high' bgcolor='#000000' width='330' height='270' name='moive' align='middle' allowScriptAccess='sameDomain' wmode='opaque' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
		thetxt += "</object>";
		mvobj.innerHTML = thetxt;
		mvobj.style.visibility = "visible";
	}else{
		mvobj.style.visibility = "hidden";
	}
	
}