//for use as copyright year
curDate = new Date();
var curYear = curDate.getFullYear();
var BaseHRef = '';
if (document.location.href.indexOf('opencms')>0) {
  BaseHRef = '/opencms';
}
function showCountryLinks(countryName) {
document.write('<form name="global">');
document.write('<select name="sites" style="width:130px;color:#666666" onchange="javascript:location.href=(document.global.sites.value);">');
document.write('<option value="http://www.gepowercontrols.com/eu/" ');
if (countryName == 'eu'){document.write('selected');}
document.write('>United Kingdom</option>');
document.write('<option value="http://www.gepowercontrols.com/ex/" ');
if(countryName=='/ex/'){document.write('selected');}
document.write('>Africa</option>');
document.write('<option value="http://www.gepowercontrols.com/be/nl/" ');
if (countryName == 'be/nl'){document.write('selected');}
document.write('>Belgie</option>');
document.write('<option value="http://www.gepowercontrols.com/be/fr/" ');
if (countryName == 'be/fr') {document.write('selected');}
document.write('>Belgique</option>');
document.write('<option value="http://www.geindustrial.com.br/" ');
if (countryName == 'br') {document.write('selected');}
document.write('>Brazil</option>');
document.write('<option value="http://www.geindustrial.com/cwc/home?lang=zh_CN" ');
if (countryName == 'cn') {document.write('selected');}
document.write('>China</option>');
document.write('<option value="http://www.gepowercontrols.com/ex/" ');
if (countryName == 'dk') {document.write('selected');}
document.write('>Denmark</option>');
document.write('<option value="http://www.gepowercontrols.com/428/index.html" ');
if (countryName == '/428/') {document.write('selected');}
document.write('>Finland</option>');
document.write('<option value="http://www.gepowercontrols.com/fr/" ');
if (countryName == '/115/') {document.write('selected');}
document.write('>France</option>');
document.write('<option value="http://www.gepowercontrols.com/hu/" ');
if (countryName == 'hu') {document.write('selected');}
document.write('>Hungary</option>');
document.write('<option value="http://www.gepowercontrols.com/de/" ');
if (countryName == 'de') {document.write('selected');}
document.write('>Germany</option>');
document.write('<option value="http://www.geindustrial.com/cwc/home?lang=en_IN" ');
if (countryName == '/in/') {document.write('selected');}
document.write('>India</option>');
document.write('<option value="http://www.gepowercontrols.com/ex/index.html" ');
if (countryName == 'ex'){document.write('selected');}
document.write('>International English</option>');
document.write('<option value="http://www.gepowercontrols.com/it/" ');
if (countryName == 'it'){document.write('selected');}
document.write('>Italy</option>');
document.write('<option value="http://www.geindustrial.com/cwc/home?lang=ko_KR" ');
if (countryName == '/ko/'){document.write('selected');}
document.write('>Korea</option>');
document.write('<option value="http://www.geindustrial.com.mx/" ');
if (countryName == '/mx/'){document.write('selected');}
document.write('>Mexico</option>');
document.write('<option value="http://www.gepowercontrols.com/ex/" ');
if(countryName=='/ex/'){document.write('selected');}
document.write('>Middle East</option>');
document.write('<option value="http://www.gepowercontrols.com/nl/" ');
if (countryName == 'nl'){document.write('selected');}
document.write('>Netherlands</option>');
document.write('<option value="http://www.gepowercontrols.com/ex/" ');
if (countryName == 'no') {document.write('selected');}
document.write('>Norway</option>');
document.write('<option value="http://www.gepc.pl" ');
if (countryName == '/pl/') {document.write('selected');}
document.write('>Poland</option>');
document.write('<option value="http://www.gepowercontrols.com/334/index.html" ');
if (countryName == '/334/') {document.write('selected');}
document.write('>Portugal</option>');
document.write('<option value="http://www.gepowercontrols.com/ru/" ');
if (countryName == 'ru'){document.write('selected');}
document.write('>Russia</option>');
document.write('<option value="http://www.gepowercontrols.com/ex/" ');
if (countryName == 'se') {document.write('selected');}
document.write('>Sweden</option>');
document.write('<option value="http://www.gepowercontrols.com/es/index.html" ');
if (countryName == 'es'){document.write('selected');}
document.write('>Spain</option>');
document.write('<option value="http://www.gepowercontrols.com/ex/" ');
if (countryName == 'tr') {document.write('selected');}
document.write('>Turkey</option>');
document.write('<option value="http://www.geindustrial.com/cwc/electrical_homepage.htm" ');
if(countryName=='/us/'){document.write('selected');}
document.write('>United States</option>');
document.write('</select>');
document.write('</form>');
}
/*****************************************/
// Cascading menus section appears last. //
/*****************************************/
//for use as copyright year
curDate = new Date();
var curYear = curDate.getFullYear();
// 2 Functions for GE Fast Search
function fnSiteSearch(fm) {
	if (fm.textToSearch.value=="") { return false; }
	return true;
}
function fnSiteSearchLink(fm) {
	if (fm.textToSearch.value != "") { fm.submit(); } 
}
function validate() {
  if(!checkSpaces(document.form.SEARCHTEXT.value)) {
    alert("Please enter your search criteria.");
    document.form.SEARCHTEXT.select();
    document.form.SEARCHTEXT.focus();
    return false;
  }
  //document.form.target="_blank";
  document.form.submit();
  return true;
}
function onMouse(id, newSrc) {
    var theImage = FWFindImage(document, id, 0);
    if (theImage) {
        theImage.src = newSrc;
    }
}
function FWFindImage(doc, name, j) {
    var theImage = false;
    if (doc.images) {
        theImage = doc.images[name];
    }
    if (theImage) {
        return theImage;
    }
    if (doc.layers) {
        for (j = 0; j < doc.layers.length; j++) {
            theImage = FWFindImage(doc.layers[j].document, name, 0);
            if (theImage) {
                return (theImage);
            }
        }
    }
    return (false);
}
function displayStatus(msgStr) {
    window.status = msgStr;
    document.MM_returnValue = true;
}
function checkSpaces(fld)	{
		l_length_of_data = fld.length;
		l_ctr=0;
		while(l_ctr != l_length_of_data)	{
			if(fld.charAt(l_ctr) != " ")	{
				return true;
			}
			l_ctr++
		}
		return false;
}
// global vars
var popupWin;
var largerWin;
var largerWin2;
var largerWin3;
var glossaryWin;
var scrnwidth=screen.width;
var scrnheight=screen.height;
//NN4 window resize fix
if(!window.saveInnerWidth) {
  window.onresize = resizeIt;
  window.saveInnerWidth = window.innerWidth;
  window.saveInnerHeight = window.innerHeight;
}
function resizeIt() {
    if (saveInnerWidth < window.innerWidth || 
        saveInnerWidth > window.innerWidth || 
        saveInnerHeight > window.innerHeight || 
        saveInnerHeight < window.innerHeight ) 
    {
        window.history.go(0);
    }
}
// "only 1 open at a time" popup function //
function openPop(url,width,height,addloptions){
	var xspot=Math.round((scrnwidth/2)-(width/2));
	var yspot=Math.round((scrnheight/2)-(height/2)-30);
	features = "height="+height+",width="+width+",top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot;
	if (addloptions && addloptions!="") { features += ","+addloptions; }
	if (!popupWin || popupWin.closed){
		popupWin = window.open(url, '', features);
	}
	else {
		window.popupWin.close();
		popupWin = window.open(url, '', features);
	}
}
//	NORMAL Function to View Larger Image.
//	Opens window which contains only a 500 x 500 image
function openLarger(imgurl,imgalt) {
	var xspot=Math.round((scrnwidth/2)-(250));
	var yspot=Math.round((scrnheight/2)-(280));
	if (!largerWin || largerWin.closed) {
		largerWin = window.open("","","width=500,height=500,top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot);
	}
	else {
		window.largerWin.close();
		largerWin = window.open("","","width=500,height=500,top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot);
	}
	drawstr =  '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
	drawstr += '<html><head><title>'+imgalt+'</title></head>';
	drawstr += '<body bgcolor="white" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">';
	drawstr += '<img src="';
	drawstr += imgurl;
	drawstr += '" width="500" height="500" border="0" alt="';
	drawstr += imgalt;
	drawstr += '">';
	drawstr += '</body></html>';
	largerWin.document.open();
	largerWin.document.write(drawstr);
	largerWin.document.close();
}
//	Function to View Larger Fluorescent (HORIZONTAL) Image.
//	Opens window which contains only a ????? x 128 image
function openLarger2(imgurl,imgalt) {
	var xspot=Math.round((scrnwidth/2)-(250));
	var yspot=Math.round((scrnheight/2)-(100));
	if (!largerWin2 || largerWin2.closed) {
		largerWin2 = window.open("","","scrollbars,width=500,height=150,top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot);
	}
	else {
		window.largerWin2.close();
		largerWin2 = window.open("","","scrollbars,width=500,height=150,top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot);
	}
	drawstr =  '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
	drawstr += '<html><head><title>'+imgalt+'</title></head>';
	drawstr += '<body bgcolor="white" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">';
	drawstr += '<img src="';
	drawstr += imgurl;
	drawstr += '" height="128" border="0" alt="';
	drawstr += imgalt;
	drawstr += '">';
	drawstr += '</body></html>';
	largerWin2.document.open();
	largerWin2.document.write(drawstr);
	largerWin2.document.close();
}
//	Function to View Larger Fluorescent (VERTICAL) Image.
//	Opens window which contains only a 303 x ?????? image
function openLarger3(imgurl,imgalt) {
	var xspot=Math.round((scrnwidth/2)-(160));
	var yspot=Math.round((scrnheight/2)-(280));
	if (!largerWin3 || largerWin3.closed) {
		largerWin3 = window.open("","","scrollbars,width=323,height=500,top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot);
	}
	else {
		window.largerWin3.close();
		largerWin3 = window.open("","","scrollbars,width=323,height=500,top="+yspot+",screenY="+yspot+",left="+xspot+",screenX="+xspot);
	}
	drawstr =  '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
	drawstr += '<html><head><title>'+imgalt+'</title></head>';
	drawstr += '<body bgcolor="white" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">';
	drawstr += '<img src="';
	drawstr += imgurl;
	drawstr += '" width="303" border="0" alt="';
	drawstr += imgalt;
	drawstr += '">';
	drawstr += '</body></html>';
	largerWin3.document.open();
	largerWin3.document.write(drawstr);
	largerWin3.document.close();
}
function closepopups(){
	if (popupWin && popupWin.open){
		window.popupWin.close();
	}
	if (largerWin && largerWin.open){
		window.largerWin.close();
	}
	if (largerWin2 && largerWin2.open){
		window.largerWin2.close();
	}
	if (largerWin3 && largerWin3.open){
		window.largerWin3.close();
	}
	if (glossaryWin && glossaryWin.open){
		window.glossaryWin.close();
	}
}
// function linktoOpener(url) is called from popups. Places url in opener, and closes popup. 
function linktoOpener(url) {
	if(self.opener) {
		self.opener.top.document.location=url;
		self.opener.focus();
		self.close();
	} else {
		self.top.document.location=url;
		self.focus();
	}
}
// turnonTab() sniffs the document location and turns on the appropriate tab in the navbar.
// Used on HOME LIGHTING site
function turnonTab() {
	var currurl=document.location+"";
	var locindex="0";
	if(currurl.indexOf("/product_portfolio/") != -1) { locindex="1"; }
	if(currurl.indexOf("/products/") != -1) { locindex="2"; }
	if(currurl.indexOf("/market_segments/") != -1) { locindex="3"; }
	if(currurl.indexOf("/resources/") != -1) { locindex="4"; }
	if(currurl.indexOf("/after_sales/") != -1) { locindex="5"; }	
	if(locindex!="0" && document.getElementById) {
		document.getElementById("navimgcell"+locindex).className="navbarLinkOn";
		document.getElementById("navimg"+locindex).src="/eu/imgs/shim.gif";
		document.getElementById("navlinkcell"+locindex).className="navbarLinkOn";
		document.getElementById("navlink"+locindex).className="navbarLinkOn";
	}
}
// turnonTab2() sniffs the document location and turns on the appropriate tab in the navbar.
// Used on COMMERCIAL LIGHTING site -- all except its home page where navbar is hard coded to have "home" selected.
function turnonTab2() {
	var currurl=document.location+"";
	var locindex="0";
	if(currurl.indexOf("/product_portfolio/") != -1) { locindex="1"; }
	if(currurl.indexOf("/products/") != -1) { locindex="2"; }
	if(currurl.indexOf("/market_segments/") != -1) { locindex="3"; }
	if(currurl.indexOf("/after_sales/") != -1) { locindex="4"; }
	if(currurl.indexOf("/resources/") != -1) { locindex="5"; }	
	if(locindex!="0" && document.getElementById) {
		document.getElementById("navbarCell_"+locindex).className="selected";
		document.getElementById("navbarImg_"+locindex).src = menuBaseHref + "/imgs/topnav/nav1Link_selected.gif";
	}
}
// needforSubmit() builds INFM URL from two select elements and redirects user to INFM page
function needforSubmit() {
	var infm_url = "/na/home_lighting/infm/";
	var form = document.needforForm;
	var Ineed = form.needSel.options[form.needSel.selectedIndex].value;
	var ForMy = form.forSel.options[form.forSel.selectedIndex].value;
	infm_url = infm_url + Ineed + "_" + ForMy + ".htm";
	document.location = infm_url;
}
// setINFMform() reads URL and sets select elements of INFM form to reflect the current page
function setINFMform() {
	var curl = unescape(document.location);
	if (curl.indexOf("/infm/")!=-1) {
		var infm = curl.slice((curl.indexOf('/infm/')+6),curl.indexOf('.htm'));
		var infm_arr = infm.split("_");
		var form = document.needforForm;
		form.needSel.selectedIndex = (infm_arr[0]=="light")?0:(infm_arr[0]=="life")?1:2;
		for(i=0;i<6;i++) {
			if (form.forSel.options[i].value == infm_arr[1]) {
				form.forSel.selectedIndex = i;
			}
		}
	}
}
/* SELECT ELEMENT NAVIGATION */
/* selectNav function -- a select (dropdown) element navigation function
   called from onChange event of select element,
   i.e. onChange="selectNav('formName','archive');"
   where 'formName' is the id/name of the containing form, and
   where 'archive' is the id/name of the specific select element to be tested.
   the value of the option elements should be the target URLs.
*/
function selectNav(form,fName) {
  fRef = eval('top.document.'+form);
  var selIdx = fRef[fName].selectedIndex 
  var selURL = fRef[fName].options[selIdx].value 
  document.location = selURL;
}
/* setSelected function -- sets select element navigation dropdown to reflect the current page
   called inline after the code for the select element navigation,
   i.e. within a javascript code block
      setSelected(top.document.formName,'archive');
   where 'archive' is the name of the specific select element to be effected
   the value of the option elements will be compared to the current URL and, if an option matches, it will be set as selected.
*/
function setSelected(form,fName) {
  fRef = eval('top.document.'+form);
	var curl = unescape(document.location);
  i = curl.indexOf('/na/');
  curl = curl.slice(i);
  for(i=0;i<fRef[fName].options.length;i++) {
    if (fRef[fName].options[i].value.indexOf(curl)>=0) {
      fRef[fName].options[i].selected = true;
      break;
    }
  }
}
/* END SELECT ELEMENT NAVIGATION */
/*  Edison Awards openPop wrapper function */
  function eaPop(url) {
    if (url.indexOf('/')>-1 && url.indexOf('//')==0) {
      url = menuBaseHref + url;
    }
    openPop(url, "750", "650", "resizable,scrollbars");
  }
/*/Edison Awards openPop wrapper function */
/* Learn About Light's Distribution Curves openPop wrapper function */
function openCurve(idx) {
	openPop("/na/business_lighting/education_resources/learn_about_light/pop_curves.htm?"+idx,"710","520","resizable,scrollbars");
}
/*/Learn About Light Distribution Curves openPop wrapper function */
/* COMMERCIAL Glossary opener function */
/* Calls absolutely so it can be used within ecatalog also */
/* Cannot use generic openPop because of feature override behavior */
function openGlossary(anchr) {
	if (!glossaryWin || glossaryWin.closed){
		glossaryWin = window.open("http://www.gelighting.com/na/business_lighting/education_resources/glossary.htm#"+anchr,"","width=770,height=300,resizable,scrollbars,toolbar,location,status,top=1,screenY=1,left=1,screenX=1");
	}
	else {
		glossaryWin.focus();
		glossaryWin.document.location = "http://www.gelighting.com/na/business_lighting/education_resources/glossary.htm#"+anchr;
	}
}
/*/Glossary opener function */
/* image switcher function for Edison Awards Winners pop-up pages */
/* does show/hide on divs rather than a src swap, because images can be different sizes */
/* assumes first image is visible by default */
visible="1";
function switchImage(num) {
  if (num!=visible) {
    document.getElementById('switchBox'+visible).style.display = 'none';
    document.getElementById('switchBox'+num).style.display = 'block';
    visible = num;
  }
}
/* image switcher */
//TEXT SIZE SELECTION
function makeBig() {	
	setImage(3);
	var docum=document.getElementById('document');
   	var homeH=document.getElementById('homeHead');
	var ecats=document.getElementById('ecatsearch');
	var hoMB1=document.getElementById('homeMainBody1');
	var hoMB2=document.getElementById('homeMainBody2');
	var homN2=document.getElementById('homeNav2');
	var foot=document.getElementById('foot');
	var topri=document.getElementById('topright');
	var nav2=document.getElementById('nav2');
	var navX=document.getElementById('navX');
	var bodyH=document.getElementById('bodyHead');
	var bodyH2=document.getElementById('bodyHead2');
	var pageT=document.getElementById('pageTitle');
	var mainB=document.getElementById('mainBody');
	var mainB2=document.getElementById('mainBody2');
	var mainC=document.getElementById('maincell');
	if(docum!=null) docum.style.fontSize='80%';
	if(homeH!=null) homeH.style.fontSize='80%';
	if(ecats!=null) ecats.style.fontSize='80%';
	if(hoMB1!=null) hoMB1.style.fontSize='80%';
	if(hoMB1!=null) hoMB1.style.lineHeight='120%';
	if(hoMB2!=null) hoMB2.style.fontSize='80%';
	if(hoMB2!=null) hoMB2.style.lineHeight='120%';
	if(homN2!=null) homN2.style.fontSize='80%';
	if(homN2!=null) homN2.style.lineHeight='120%';
	if(foot!=null) foot.style.fontSize='80%';
	if(foot!=null) foot.style.lineHeight='120%';
	if(topri!=null) topri.style.fontSize='70%';
	if(nav2!=null) nav2.style.fontSize='80%';
	if(navX!=null) navX.style.fontSize='110%';
	if(bodyH!=null) bodyH.style.fontSize='90%';
	if(bodyH2!=null) bodyH2.style.fontSize='90%';
	if(pageT!=null) pageT.style.fontSize='120%';
	if(mainB!=null) mainB.style.fontSize='80%';
	if(mainB2!=null) mainB2.style.fontSize='80%';
	if(mainC!=null) mainC.style.fontSize='110%';
	return false;
}
function makeMedium(){
	setImage(2);
	var docum=document.getElementById('document');
   	var homeH=document.getElementById('homeHead');
	var ecats=document.getElementById('ecatsearch');
	var hoMB1=document.getElementById('homeMainBody1');
	var hoMB2=document.getElementById('homeMainBody2');
	var homN2=document.getElementById('homeNav2');
	var foot=document.getElementById('foot');
	var topri=document.getElementById('topright');
	var nav2=document.getElementById('nav2');
	var navX=document.getElementById('navX');
	var bodyH=document.getElementById('bodyHead');
	var bodyH2=document.getElementById('bodyHead2');
	var pageT=document.getElementById('pageTitle');
	var mainB=document.getElementById('mainBody');
	var mainC=document.getElementById('maincell');
	var mainB2=document.getElementById('mainBody2');
	if(docum!=null) docum.style.fontSize='70%';
	if(homeH!=null) homeH.style.fontSize='70%';
	if(ecats!=null) ecats.style.fontSize='70%';
	if(hoMB1!=null) hoMB1.style.fontSize='70%';
	//if(hoMB1!=null) hoMB1.style.lineHeight='120%';
	if(hoMB2!=null) hoMB2.style.fontSize='70%';
	//if(hoMB2!=null) hoMB2.style.lineHeight='120%';
	if(homN2!=null) homN2.style.fontSize='70%';
	//if(homN2!=null) homN2.style.lineHeight='120%';
	if(foot!=null) foot.style.fontSize='70%';
	//if(foot!=null) foot.style.lineHeight='120%';
	if(topri!=null) topri.style.fontSize='60%';
	if(nav2!=null) nav2.style.fontSize='70%';
	if(navX!=null) navX.style.fontSize='100%';
	if(bodyH!=null) bodyH.style.fontSize='75%';
	if(bodyH2!=null) bodyH2.style.fontSize='75%';
	if(pageT!=null) pageT.style.fontSize='125%';
	if(mainB!=null) mainB.style.fontSize='70%';
	if(mainC!=null) mainC.style.fontSize='100%';
	if(mainB2!=null) mainB2.style.fontSize='80%';
	return false;
}
function makeSmall(){
	
	setImage(1);
	var docum=document.getElementById('document');
   	var homeH=document.getElementById('homeHead');
	var ecats=document.getElementById('ecatsearch');
	var hoMB1=document.getElementById('homeMainBody1');
	var hoMB2=document.getElementById('homeMainBody2');
	var homN2=document.getElementById('homeNav2');
	var foot=document.getElementById('foot');
	var topri=document.getElementById('topright');
	var nav2=document.getElementById('nav2');
	var navX=document.getElementById('navX');
	var bodyH=document.getElementById('bodyHead');
	var bodyH2=document.getElementById('bodyHead2');
	var pageT=document.getElementById('pageTitle');
	var mainB=document.getElementById('mainBody');
	var mainC=document.getElementById('maincell');
	var mainB2=document.getElementById('mainBody2');
	if(docum!=null) docum.style.fontSize='60%';
	if(homeH!=null) homeH.style.fontSize='60%';
	if(ecats!=null) ecats.style.fontSize='60%';
	if(hoMB1!=null) hoMB1.style.fontSize='60%';
	//if(hoMB1!=null) hoMB1.style.lineHeight='120%';
	if(hoMB2!=null) hoMB2.style.fontSize='60%';
	//if(hoMB2!=null) hoMB2.style.lineHeight='120%';
	if(homN2!=null) homN2.style.fontSize='60%';
	//if(homN2!=null) homN2.style.lineHeight='120%';
	if(foot!=null) foot.style.fontSize='60%';
	//if(foot!=null) foot.style.lineHeight='120%';
	if(topri!=null) topri.style.fontSize='50%';
	if(nav2!=null) nav2.style.fontSize='60%';
	if(navX!=null) navX.style.fontSize='90%';
	if(bodyH!=null) bodyH.style.fontSize='65%';
	if(bodyH2!=null) bodyH2.style.fontSize='65%';
	if(pageT!=null) pageT.style.fontSize='120%';
	if(mainB!=null) mainB.style.fontSize='60%';
	if(mainC!=null) mainC.style.fontSize='90%';
	if(mainB2!=null) mainB2.style.fontSize='80%';
	return false;
}
var isrc = new Array();
for (iTemp=1; iTemp<7; iTemp++) {
isrc[iTemp] = new Image();
}
isrc[1].src ='/imgs/topnav/s.gif';
isrc[2].src ='/imgs/topnav/m.gif';
isrc[3].src ='/imgs/topnav/b.gif';
isrc[4].src ='/imgs/topnav/sa.gif';
isrc[5].src ='/imgs/topnav/ma.gif';
isrc[6].src ='/imgs/topnav/ba.gif';
function setImage(imgIndex) {
  var t1=document.getElementById("ts");
  var t2=document.getElementById("tm");
  var t3=document.getElementById("tb");
    
  if (t1 != null) {
    if (imgIndex==1) {
      t1.src=isrc[4].src;
    }
    else {
      t1.src = isrc[1].src;
    }
  }
  if (t2 != null) {
    if (imgIndex==2) {
      t2.src = isrc[5].src;
    }
    else  {
      t2.src = isrc[2].src;
    }    
  }
  if (t3 != null) {
    if (imgIndex==3) {
      t3.src = isrc[6].src;
    }
    else {
      t3.src = isrc[3].src;
    }
  }
}
function writeArray(x) {
  var win = window.open();
  for (var i in x) win.document.write(i+' = '+x[i]+'<br>');
}
function attach(container, menu) {
  var c = document.getElementById(container);
  var m = document.getElementById(menu );
  var top  = (m["mposition"] == "y") ? c.offsetHeight+2 : 0;
  var left = (m["mposition"] == "x") ? c.offsetWidth +2 : 0;
  var offset = (m["mOffset"] == null ? 0 : m["mOffset"]);
  for (; c; c = c.offsetParent) {
    top  += c.offsetTop;
    left += c.offsetLeft;
  }
  m.style.position   = "absolute";
  m.style.top        = (top+(offset)) +'px';
  m.style.left       = left+'px';
  m.style.visibility = "visible";
}
function showMenu() {
  var c = document.getElementById(this["mCont"]);
  var m = document.getElementById(this["mMenu"]);
  attach(c.id, m.id);
  clearTimeout(m["timeout"]);
}
function hideMenu() {
  var m = document.getElementById(this["mMenu"]);
  m["timeout"] = setTimeout("document.getElementById('"+m.id+"').style.visibility = 'hidden'", 100);
}
function contClick() {
  var c = document.getElementById(this["mCont"]);
  var m = document.getElementById(this["mMenu"]);
  if (m.style.visibility != "visible") {
    attach(c.id, m.id);
  }
  else {
    m.style.visibility = "hidden";
  }
  return false;
}
function addMenu(container, menu, showtype, position, sPos, cursor) {
  var c = document.getElementById(container);
  var m = document.getElementById(menu);
  c["mCont"]     = c.id;
  m["mCont"]     = c.id;
  c["mMenu"]      = m.id;
  m["mMenu"]      = m.id;
  c["mposition"]   = position;
  m["mposition"]   = position;
  m["mOffset"] = sPos;
  m.style.position   = "absolute";
  m.style.visibility = "hidden";
  if (cursor != undefined) c.style.cursor = cursor;
  switch (showtype) {
    case "click":
      c.onclick     = contClick;
      c.onmouseout  = hideMenu;
      m.onmouseover = showMenu;
      m.onmouseout  = hideMenu;
      break;
    case "hover":
      c.onmouseover = showMenu;
      c.onmouseout  = hideMenu;
      m.onmouseover = showMenu;
      m.onmouseout  = hideMenu;
      break;
  }
}
