var l=new Array();
l["eu-gen"]="business-europe";
l["ap-gen"]="business-asia";
l["am-gen"]="business-americas";
l["qual"]="Quality-Contact";
//l["pbfree"]="ROHS.surveys";
l["pbfree"]="VPECM.Surveys";
l["exec-vp"]="Peter.Henrici";
l["corp-ir"]="Brenda.Tate";
l["web"]="webmaster";
l["media"]="Andrew.Post";
l["board"]="boardofdirectors";
l["audit"]="auditcommittee";
l["ethics"]="ethics";
l["qlcc"]="QLCC";
l["sil-board"]="BoD.siliconix";
l["sil-ethics"]="ethics.siliconix";
l["sil-qlcc"]="QLCC.siliconix";
var r="vishay.com";
function mailtoLink(name){
  document.write("<a href=\"mailto");
  document.write(":"+l[name]+"@"+r+"\">");
  document.write(l[name]+"@"+r+"<\/a>");
}
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = 
    ( name + "=" 
    + value 
    + ( ( expires ) ? "; expires=" + expires.toGMTString() : "" ) 
    + ( ( path ) ? "; path=" + path : "" )
    + ( ( domain ) ? "; domain=" + domain : "" ) 
    + ( ( secure ) ? "; secure" : "" )
    ) ;
    document.cookie = curCookie;
}
function setSalesCookie(value) {
  var expDate = new Date("December 31, 2099") ;
  setCookie("repsloc", value, expDate, "/", "", "") ;
}
function chooseLoc( loc1, loc2, loc3) {
  
  var isValid = false ;
  var locs = "sales?loc=";
  if (loc1 != "") {
    if (loc1 == "United States") {
      alert ("Please choose a state under '" + loc1 + ".'") ;
	  return false;
    }
    else if (loc1 == "Canada") {
       alert ("Please choose a province under '" + loc1 + ".'") ;
	   return false;
    }
    else if (loc1 == "Mexico, Central America" || loc1 == "South America") {
      alert ("Please choose a country under '" + loc1 + ".'") ;
	  return false;
    }
    else {
	  locs = locs + loc1;
      setSalesCookie(loc1) ;
      isValid = true;
    }
	document.contacts.loc2.setAttribute( "disabled", "true" );
	document.contacts.loc3.setAttribute( "disabled", "true" );
  }
  else if (loc2 != "") {
	locs = locs + loc2;
    setSalesCookie(loc2) ;
    isValid = true ;
	document.contacts.loc1.setAttribute( "disabled", "true" );
	document.contacts.loc3.setAttribute( "disabled", "true" );
  }
  else if (loc3 != "") {
	locs = locs + loc3;
    setSalesCookie(loc3) ;
    isValid = true ;
	document.contacts.loc1.setAttribute( "disabled", "true" );
	document.contacts.loc2.setAttribute( "disabled", "true" );
  }
  else {
    alert("Please select a location.") ;
  }
  top.window.location.href = locs;
  return isValid ;
}
function resetLoc(field) {
  if (field.name == "loc1") {
    document.contacts.loc2.options.selectedIndex = 0 ;
    document.contacts.loc3.options.selectedIndex = 0 ;
    if ( field.options[field.options.selectedIndex].value == "United States") {
      alert ("Please choose a state under United States.");
    }
    else if (field.options[field.options.selectedIndex].value == "Canada") {
      alert ("Please choose a province under Canada.");
    }
    else if ( field.options[field.options.selectedIndex].value == "Mexico, Central America" 
           || field.options[field.options.selectedIndex].value == "South America"
            ) {
      alert ( "Please choose a country under " 
            + field.options[field.options.selectedIndex].value + "."
            ) ;
    }
  }
  else if (field.name == "loc2") {
    document.contacts.loc1.options.selectedIndex = 0 ;
    document.contacts.loc3.options.selectedIndex = 0 ;
  }
  else if (field.name == "loc3") {
    document.contacts.loc1.options.selectedIndex = 0 ;
    document.contacts.loc2.options.selectedIndex = 0 ;
  }
  return true ;
}

