﻿//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(); } 

}



// 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);

    }

}



function MM_displayStatusMsg(msgStr) { //v2.0

  msgStr = msgStr.replace(/'/g,"\\'");  //This code takes care of the single quote

  setTimeout("status='" + msgStr + "'", 50);

  document.MM_returnValue = true;

}





/* 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 */



// "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);

	}

}







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 confirmsite(url)  //spanish site

{ if (confirm("Ahora va a entrar en la página de Lighting Europa. El contenido que aparecerá a continuacion está en inglés. Clic OK para continuar o Cancel para permanecer en esta página."))

   { window.open(url,'newwindow') }

}

function confirmsiteko(url)  //italian site

{ if (confirm("tÇ ˜ÓtÇÀÉ”² Æ´Å\¸Ì¹ ÁD¾¤Â¬ ¬¥²iÕÈ²ä². OK „¼¼ÒDÇ tÐ­¹XÕÜÂtº, tÕù² ˜ÓtÇÀÉ\¸ tÇÙ³iÕÈ²ä²."))

   { window.open(url,'newwindow') }

}



function confirmsitema(url) //Malaysian site

{ if (confirm("Halaman in di dalam Bahasa Inggeris. Tekan butang 'OK' untuk ke halaman yang seterusnya"))

   { window.open(url,'_self') }

}





function confirmsite_appl_aus(url) //English Appliances Link

{ if (confirm("Featured products within GE Appliances are presently listed on the new Consumer & Industrial Asia / Pacific web site. You will find product and local distributor information on this site."))

   { window.open(url,'_self') }

}



function confirmsitehl(url) //dutch site

{ if (confirm("Den här länken går till GELighting europa som är på engelska Klicka på OK för att fortsätta eller cancel för att stanna kvar på GELighting Svenska"))

   { window.open(url,'window') }

}



function confirmsitefr(url) //french site 

{ if (confirm("Maintenant vous quittez le site Français, le texte est en Anglais. Cliquez OK pour continuer ou  Cancel pour rester sur cette page."))

   { window.open(url,'newwindow') }

}



function confirmsitede(url) // German site

{ if (confirm("Hier kommen Sie auf die Internetseiten von Lighting Europe. Folgende Seiten sind derzeit nur in Englisch verfügbar."))

   { window.open(url,'newwindow') }

}





// 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();

	}

}



/* 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('/eu/');

  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 applPop(url) {

    openPop("/apo/applications/" + url,"650","550","resizable");

  }

  

/*  Edison Awards openPop wrapper function */

  function referPop(url) {

    openPop("/apo/applications/" + url,"600","500","resizable");

  }

  

/*/Edison Awards openPop wrapper function */



/* Learn About Light's Distribution Curves openPop wrapper function */

function openCurve(idx) {

	openPop("/au/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/eu/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/eu/resources/glossary.htm#"+anchr;

	}

}

/*/Glossary opener function */





/**********************************************************************/

// Cascading Menus for Standard GE Corporate Top Navbar

// By Matthew Rasnake and Scott Henderson, GE Consumer & Industrial

// March 2005

/**********************************************************************/



var menuBaseHref = "";



//if NOT teamsite AND NOT gelighting, make menuBaseHref absolute

hoststring=window.location.host.toLowerCase();

//if(hoststring.indexOf('teamsite') == -1 && hoststring.indexOf('gelighting') == -1) {

//	menuBaseHref = "http://www.gelighting.com";

//}



//Create the only array we'll need.

geMenuArray = new Array();



/* All calls are absolute b/c it must be used within ecatalog & search results also */



geMenuArray[0] = [

			  "Refrigeration||"+menuBaseHref+"/apo/products/appliances/refrigeration/index.htm",

			  "Cooking||"+menuBaseHref+"/apo/products/appliances/cooking/index.htm",

			  "Dishwashers||"+menuBaseHref+"/apo/products/appliances/dishwashers/index.htm",

			  "Clothes Care||"+menuBaseHref+"/apo/products/appliances/clothes_care/index.htm",

			  "Water Systems||"+menuBaseHref+"/apo/products/appliances/water_systems/index.htm",

			  "Air Conditioning||"+menuBaseHref+"/apo/products/appliances/air_conditioning/index.htm",

				];

geMenuArray[0]['id']    = "navbarCell_1";

geMenuArray[0]['width'] = "125";

geMenuArray[0]['right']  = "";





geMenuArray[1] = [

				"Industrial Equipment||"+menuBaseHref+"/apo/products/industrial/equipment/index.htm",

				"Industrial Components||"+menuBaseHref+"/apo/products/industrial/component/index.htm",

				"Protection, Metering & Communications||"+menuBaseHref+"/apo/products/industrial/electrical_distribution/index.htm",

				"Power Quality - ATS/TVSS||"+menuBaseHref+"/apo/products/industrial/power_quality/index.htm",

				"Motors & Control||"+menuBaseHref+"/apo/products/industrial/motors_control/index.htm",

				"Power Quality - Digital Energy UPS||"+menuBaseHref+"/apo/products/industrial/digital_energy/index.htm",

				];			 

geMenuArray[1]['id']    = "navbarCell_2"; // id of Parent object for this menu

geMenuArray[1]['width'] = "150";          // width of this menu

geMenuArray[1]['left']  = "";             // left offset (positive or negative)



geMenuArray[2] = [

				"Incandescent Lamps||"+menuBaseHref+"/apo/products/lighting/incandescent/index.htm",

				"Halogen Lamps||"+menuBaseHref+"/apo/products/lighting/halogen/index.htm",

				"Fluorescent Lamps||"+menuBaseHref+"/apo/products/lighting/fluorescent/index.htm",

				"Compact Fluorescent Lamps||"+menuBaseHref+"/apo/products/lighting/compact_fluorescent/index.htm",

				"High Intensity Discharge||"+menuBaseHref+"/apo/products/lighting/hid/index.htm",

				"Fixtures||"+menuBaseHref+"/apo/products/lighting/fixtures/index.htm",

				"Specialty Lamps||"+menuBaseHref+"/apo/products/lighting/specialty/index.htm",

				"Showbiz Lamps||"+menuBaseHref+"/apo/products/lighting/showbiz/index.htm",

				"Automotive Lamps||"+menuBaseHref+"/apo/products/lighting/auto/index.htm",

				];			 

geMenuArray[2]['id']    = "navbarCell_3"; // id of Parent object for this menu

geMenuArray[2]['width'] = "135";          // width of this menu

geMenuArray[2]['left']  = "";             // left offset (positive or negative)





/* The second menu */

geMenuArray[3] = [

				"For Commercial Buildings||"+menuBaseHref+"/apo/applications/commercial_building/index.htm",

				"Power Plants||"+menuBaseHref+"/apo/applications/power_plant/index.htm",

				"Stadiums & Arena's||"+menuBaseHref+"/apo/applications/stadium_arena/index.htm",

				"Oil & Gas Refineries||"+menuBaseHref+"/apo/applications/onshore_oil_gas/index.htm",

				"Offshore Oil & Gas Exploration||"+menuBaseHref+"/apo/applications/offshore_oil_gas/index.htm",

				];			 

geMenuArray[3]['id']    = "navbarCell_4"; // id of Parent object for this menu

geMenuArray[3]['width'] = "145";          // width of this menu

geMenuArray[3]['left']  = "";             // left offset (positive or negative)





/* The first menu */

geMenuArray[4] = [

			  "Literature Library||"+menuBaseHref+"/apo/resources/library/index.htm",

				"Online Tools||"+menuBaseHref+"/apo/resources/online_tools/index.htm",

				"Product Lead Times||"+menuBaseHref+"/apo/resources/lead_time/index.htm",

				"Lighting Glossary||"+menuBaseHref+"/apo/resources/glossary.htm",

];

geMenuArray[4]['id']    = "navbarCell_5";

geMenuArray[4]['width'] = "145";

geMenuArray[4]['left']  = "";



/* The third menu */

geMenuArray[5] = [

				"Information||"+menuBaseHref+"/apo/about/info/index.htm",

				"Careers at GE||"+menuBaseHref+"/apo/about/careers/index.htm",

				"Contact Us||"+menuBaseHref+"/apo/about/feedback/index.htm",

             ];

geMenuArray[5]['id']    = "navbarCell_6";

geMenuArray[5]['width'] = "85";

geMenuArray[5]['left']  = "";



//Write additional styles required for menus.

ourStyles = '<style type="text/css">';

ourStyles += 'div.ddmenu {position:absolute; margin-top:7px; visibility:hidden; text-transform:none; border-top:1px solid #CCCCCC;}';

ourStyles += 'a.ddcell       {background-color:#F7F7F7; border:1px solid #CCCCCC; border-top:0px; padding: 6px 7px 6px 8px; text-transform:none; display:block;}';

ourStyles += 'a.ddcell:hover {background-color: #FFFFFF;}';

ourStyles += '</style>';

document.write(ourStyles);





//fnBuildMenu(mNum) returns the html for a single menu.

function fnBuildMenu(mNum) {

	mArr = geMenuArray[mNum];

	mWidth = "width:"+mArr.width+"px;";                      // a CSS style width statement string

	mLeft = (mArr.left)?"margin-left:"+mArr.left+"px;":"";   // a CSS style left-margin statement string

	menuString =  '<br><div id="menudiv'+mNum+'" class="ddmenu" style="'+mWidth+mLeft+'">'; // start menuString with opening DIV

	for (mItem in mArr) {                           // loop through this sub-array

		if (parseInt(mItem)||(parseInt(mItem)==0)) {  // if array item name is a number (i.e. it's not "id" or "width")

			linky = mArr[mItem].split('||');            // split the contents of this array item to get Link Text and Link URL

			menuString += '<a href="'+linky[1]+'" class="ddcell" id="m'+mNum+'-'+mItem+'" style="'+mWidth+'">'+linky[0]+'</a>'; // add this menu item to HTML DIV string

		}

	}

	menuString += '</div>';                         // close HTML DIV string

	return menuString;                              // return the constructed Menu HTML 

}



//fnDefineMenus() uses fnBuildMenu to create the HTML, insert it into the page, and attach event listeners to the Parent Objects  

function fnDefineMenus() {

	if(!document.getElementById(geMenuArray[geMenuArray.length-1].id)) { //a test for final Parent object that's supposed to spawn a menu

		fred = setTimeout("fnDefineMenus()",500);  //if it doesn't exist yet, wait a bit longer

	} else {

		for (men in geMenuArray) {                      // loop through main menu Array

	  		tempObj = document.getElementById(geMenuArray[men].id); //get obj ref. to this menu's Parent Object

	  		tempObj.innerHTML  += fnBuildMenu(men);     //build menu HTML string and add it to Parent Object's HTML

	  		tempObj.onmouseover = fnOpenMen;          //define Parent Object's mouseover event to call fnOpenMen

	  		tempObj.onmouseout  = fnCloseMen;         //define Parent Object's mouseout event to call fnCloseMen

    	}

	}

}



function fnOpenMen() {

	menObj = this.getElementsByTagName('div')[0];  // Our menu is the first div within the Parent Object (this)

	menObj.style.visibility = "visible";



	/* in IE, select boxes overlap everything, no matter what you set

	their z-index to, we create iframes, which somehow *do* overlap

	select boxes, under the menus. */

	if (!menObj.iframe) {

		var iframe = document.createElement("iframe");

		menObj.iframe = iframe;

		var x = menObj.offsetLeft;

		var y = menObj.offsetTop;

		var w = menObj.offsetWidth;

		var h = menObj.offsetHeight;

		iframe.style.position = "absolute";

		iframe.style.top    = y + "px";

		iframe.style.left   = x + "px";

		iframe.style.width  = w + "px";

		iframe.style.height = h + "px";

		menObj.parentNode.insertBefore(iframe, menObj);

	}

	menObj.iframe.style.visibility = "visible";

}



function fnCloseMen() {

	menObj = this.getElementsByTagName('div')[0];  // Our menu is the first div within the Parent Object (this)

	menObj.style.visibility = "hidden";

	if (menObj.iframe) {

		menObj.iframe.style.visibility = "hidden";

	}

}

//Let's get things started!!

//We're NOT using document.onload -- It could conflict with an onload already in the BODY tag.

if (document.getElementsByTagName) { // if we're DOM capable

	fnDefineMenus();  //start _trying_ to define menus

}



/*********************************************/

// Cascading Menus Section Ended

/*********************************************/



/**********************************************************/

// This should be the end.

// Place any/all new stuff ABOVE the menus section please.

/**********************************************************/






