
//Retrieve cookie, if it presents
cookie_name = "UICulture";
var CultureCookie;

function getName() {
    if(document.cookie)
    {
        index = document.cookie.indexOf(cookie_name);
        if (index != -1)
        {
            namestart = (document.cookie.indexOf("=", index) + 1);
            nameend = document.cookie.indexOf(";", index);
            if (nameend == -1) {nameend = document.cookie.length;}
            CultureCookie = document.cookie.substring(namestart, nameend);
            return CultureCookie;
        }
    }
}

CultureCookie=getName();
if (CultureCookie == "UICulture")
{CultureCookie = "Nothing_Entered"}


//LANGUAGE DROP DOWN MENU
//Contents for menu 1
var menu1=new Array()
if(CultureCookie !=null)
{  
    switch(CultureCookie)
    {
        case "en-US":
        case "fr-FR":
        case "es-MX":
        case "de-DE":
        case "pt-BR":
        case "zh-CN":
        case "ja-JP":
        case "ko-KR":
        //case "it-IT":
//        case "sv-SE":
        case "ru-RU":    
            menu1[0]='<a href="/default.aspx?country=us&remlang=1&rtnPage=' + window.location.pathname + '">English</a>'
            menu1[1]='<a href="/default.aspx?country=fr&remlang=1&rtnPage=' + window.location.pathname + '">Fran&#231;ais</a>'
            menu1[2]='<a href="/default.aspx?country=es&remlang=1&rtnPage=' + window.location.pathname + '">Espa&#241;ol</a>'
            menu1[3]='<a href="/default.aspx?country=de&remlang=1&rtnPage=' + window.location.pathname + '">Deutsch</a>'
            menu1[4]='<a href="/default.aspx?country=pg&remlang=1&rtnPage=' + window.location.pathname + '">Portugu&#234;s</a>'
            menu1[5]='<a href="/default.aspx?country=ch&remlang=1&rtnPage=' + window.location.pathname + '"><img src="/images/nav/title-china-gry.gif" /></a>'
            menu1[6]='<a href="http://www.extremenetworks.co.jp/"><img src="/images/nav/title-japan-gry.gif"  /</a>'
            menu1[7]='<a href="/default.aspx?country=kr&remlang=1&rtnPage=' + window.location.pathname + '"><img src="/images/nav/title-korea-gry.gif" /</a>'
            //menu1[8]='<a href="/default.aspx?country=it&remlang=1&rtnPage=' + window.location.pathname + '">Italiano</a>'
            //menu1[9]='<a href="/default.aspx?country=sv&remlang=1&rtnPage=' + window.location.pathname + '">svenska</a>'
            menu1[8]='<a href="/default.aspx?country=ru&remlang=1&rtnPage=' + window.location.pathname + '">Русский</a>'
        break;
        default: 
            menu1[0]='<a href="/default.aspx?country=us&remlang=1&rtnPage=' + window.location.pathname + '">English</a>'
            menu1[1]='<a href="/default.aspx?country=fr&remlang=1&rtnPage=' + window.location.pathname + '">Fran&#231;ais</a>'
            menu1[2]='<a href="/default.aspx?country=es&remlang=1&rtnPage=' + window.location.pathname + '">Espa&#241;ol</a>'
            menu1[3]='<a href="/default.aspx?country=de&remlang=1&rtnPage=' + window.location.pathname + '">Deutsch</a>'
            menu1[4]='<a href="/default.aspx?country=pg&remlang=1&rtnPage=' + window.location.pathname + '">Portugu&#234;s</a>'
            menu1[5]='<a href="/default.aspx?country=ch&remlang=1&rtnPage=' + window.location.pathname + '"><img src="/images/nav/title-china-gry.gif" /></a>'
            menu1[6]='<a href="http://www.extremenetworks.co.jp/"><img src="/images/nav/title-japan-gry.gif"  /</a>'
            menu1[7]='<a href="/default.aspx?country=kr&remlang=1&rtnPage=' + window.location.pathname + '"><img src="/images/nav/title-korea-gry.gif" /</a>'
            //menu1[8]='<a href="/default.aspx?country=it&remlang=1&rtnPage=' + window.location.pathname + '">Italiano</a>'
            //menu1[9]='<a href="/default.aspx?country=sv&remlang=1&rtnPage=' + window.location.pathname + '">svenska</a>'
            menu1[8]='<a href="/default.aspx?country=ru&remlang=1&rtnPage=' + window.location.pathname + '">Русский</a>'
        break;
    }
}
else
{
            menu1[0]='<a href="/default.aspx?country=us&remlang=1&rtnPage=' + window.location.pathname + '">English</a>'
            menu1[1]='<a href="/default.aspx?country=fr&remlang=1&rtnPage=' + window.location.pathname + '">Fran&#231;ais</a>'
            menu1[2]='<a href="/default.aspx?country=es&remlang=1&rtnPage=' + window.location.pathname + '">Espa&#241;ol</a>'
            menu1[3]='<a href="/default.aspx?country=de&remlang=1&rtnPage=' + window.location.pathname + '">Deutsch</a>'
            menu1[4]='<a href="/default.aspx?country=pg&remlang=1&rtnPage=' + window.location.pathname + '">Portugu&#234;s</a>'
            menu1[5]='<a href="/default.aspx?country=ch&remlang=1&rtnPage=' + window.location.pathname + '"><img src="/images/nav/title-china-gry.gif" /></a>'
            menu1[6]='<a href="http://www.extremenetworks.co.jp/"><img src="/images/nav/title-japan-gry.gif"  /</a>'
            menu1[7]='<a href="/default.aspx?country=kr&remlang=1&rtnPage=' + window.location.pathname + '"><img src="/images/nav/title-korea-gry.gif" /</a>'
            //menu1[8]='<a href="/default.aspx?country=it&remlang=1&rtnPage=' + window.location.pathname + '">Italiano</a>'
            //menu1[9]='<a href="/default.aspx?country=sv&remlang=1&rtnPage=' + window.location.pathname + '">svenska</a>'
            menu1[8]='<a href="/default.aspx?country=ru&remlang=1&rtnPage=' + window.location.pathname + '">Русский</a>'

    
}


/*var menu1=new Array()
menu1[0]='<a href="#">English</a>'
menu1[1]='<a href="#">Francais</a>'
menu1[2]='<a href="#">Espanol</a>'
menu1[3]='<a href="#">Deutsch</a>'
menu1[4]='<a href="#">Portuguese</a>'
menu1[5]='<a href="#"><img src="/images/nav/title-china-gry.gif" /></a>'
menu1[6]='<a href="#"><img src="/images/nav/title-japan-gry.gif"  /</a>'
menu1[7]='<a href="#"><img src="/images/nav/title-korea-gry.gif" /</a>'*/
		

var menubgcolor='black'  //menu bgcolor
var disappeardelay=150  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;background-color:'+menubgcolor+';" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden")
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

   
   
    //SHOWING AND HIDING DESCRIPTIONS ON SOLUTIONS PAGE(S)
    var items = new Array('solutions1', 'solutions2', 'solutions3', 'solutions4', 'solutions5', 'solutions6', 'solutions7', 'solutions8', 'solutions9', 'solutions10', 'solutions11', 'solutions12', 'solutions13', 'solutions14', 'solutions15', 'solutions16', 'solutions17', 'solutions18', 'solutions19', 'solutions20', 'solutions21', 'solutions22', 'solutions23', 'solutions24', 'solutions25', 'solutions26', 'solutions27', 'solutions28', 'solutions29', 'solutions30','solutions31','solutions32','solutions33');
    var newItems = new Array('news', 'news2', 'news3');
    var curDiv;

var ids=new Array('a1','a2','a3','a4','a5');

function switchid(id){	
	hideallids();
	showdiv(id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById && document.getElementById(id)) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers && document.id) { // Netscape 4
			document.id.display = 'none';
		}
		else if(document.all && document.all.id) { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

  //HIGHLIGHTING ACTIVE TABS IN SUBPAGES
  function highlightTab(targetBtnEl) {
    var btnIds = new Array("1", "2", "3", "4", "5");
    var targetBtnId = targetBtnEl.id;

    for (var i = 0; i < btnIds.length; i++) {
      var id = btnIds[i];
      var btnId = "tab" + id;
      var btnEl = document.getElementById(btnId);

      if (btnId == targetBtnId) {
        // target btn, so turn it on
        btnEl.className="subPageTabOn";

      } else {
        // other btns, so turn them off
        if(btnEl)
            btnEl.className="subPageTabOff";
      }
    }
  }


  //MARKER ON SOLUTIONS HUG PAGE
  function mark(targetBtnEl) {
    var btnIds = new Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15","16", "17", "18", "19", "20", "21", "22", "23", "24", "25","26", "27", "28", "29", "30","31","32","33");
    var targetBtnId = targetBtnEl.id;

    for (var i = 0; i < btnIds.length; i++) {
      var id = btnIds[i];
      var btnId = "marker" + id;
      var btnEl = document.getElementById(btnId);

      if (btnId == targetBtnId) {
        // target btn, so turn it on
        btnEl.className="markerOn";

      } else {
        // other btns, so turn them off
        btnEl.className="markerOff";

      }
    }
  }



//SHOWING AND HIDING SOLUTIONS HUB DESCRIPTION TEXT

    function displayDiv(id) {
        for (var i=0; i<items.length; i++) {
            var divId = items[i];
            var divEl = document.getElementById(divId);
            if (divEl)
            {
                if (divId == id) {
                    // display the one we want
                    divEl.style.display="block";
                } else {
                    // turn off all others
                    divEl.style.display="none";
                }
            }
        }

    }
    
 
    function addLoadEvent(func)
    {
        var oldonload = window.onload;
        if (typeof window.onload != 'function')
        {
            window.onload = func;
        }
        else
        {
            window.onload = function() {
                oldonload();
                func();
            }
        }
    }
    
    function updateContactInfo(elem)
    {
        var selectedValue = elem.options[elem.selectedIndex].value;
        var stateProvSelect = $('stateProvSelect');
        var countrySelect = $('countrySelect');
        var URL = '/data/contactInfo.aspx';
        var params = 'location=' + selectedValue;
        if (elem == stateProvSelect)
            countrySelect.selectedIndex = 0;
        else
            stateProvSelect.selectedIndex = 0;
        new Ajax.Updater('contactInfo', URL, { method: 'get', parameters: params });
    }
	
	


	//DROP-DOWN MENU LINKING
	function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
	}



