
var gBaseUrl = "/";

var isIE4up = (document.all) ? 1 : 0;
var isIE5up = (isIE4up && navigator.appVersion.indexOf("5.")) >= 0 ? 1 : 0;
var isNS4up = (navigator.appName.indexOf("Netscape") >= 0 && parseFloat(navigator.appVersion) >= 4) ? 1 : 0;
var inLevel2 = false;
//window.onerror = noerror;


function onResize() 

{

 if (document.layers){
    document.location.reload();
  }

navsize();
}

function navsize()

{

if (document.getElementById)
{
h = ( (document.getElementById('content').offsetHeight) + 10);

}
else
{

h = ((window.innerHeight)+50);

}

w = (document.body.clientWidth);

document.getElementById('bottomnav').style.top = (h + 'px');
document.getElementById('bottomnav').style.width = (w + 'px');
}



function noerror()
{
return true;
}


function headerOn(whichIn, whichOver){
  if (whichOver){
    document[headerOn.arguments[1]].src = eval(headerOn.arguments[1] + "on.src");
  }  
  if (whichIn){
    document[headerOn.arguments[0]].src = eval(headerOn.arguments[0] + "in.src");
  }  
  var myImg = 'image';  
  var isOn = false;
  var isIn = false;
  for(var i=1; i<=4; i++){
    myImg = 'image'+i;
    isIn = (headerOn.arguments[0] == myImg)?true:false;
    isOn = (headerOn.arguments[1] == myImg)?true:false;

    if (eval("document."+myImg+".src").indexOf("_3.gif") > 0){
      isIn = true;
    }
    if(!isOn && !isIn){
      document["image"+i].src = eval(myImg + "off.src");
    } 
  }
}
function changeLocation(control) {
	i = control.selectedIndex; 
	if (control.options[i].value != "Null"){
		document.location = control.options[i].value;
  }
	control.options[0].selected = "True"
}
site = "urlroot";
function combineSelect (frm, year, month) {
	with (frm) {
		str = year.options[year.selectedIndex].value;
		str += month.options[month.selectedIndex].value;
		url = site + "/" + str;
		window.location.href = url;
	}
}
function dw(text){
	document.write(text);
}
function popUpWindow(popupUrl, popupWidth, popupHeight) {
	w=window.open(popupUrl,'','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width='+popupWidth+',height='+popupHeight);
	w.focus();
}


function popup(fname)
{

open(fname, "popup", "target=_blank,width=380,height=450,screenX=40,screenY=40,top=40,left=40,scrollbars=yes"); 
}


var countryNames = new Array();
var mapName;
function writeCountryText(name,left,top,width,height,zIndex,text){
  if (isIE4up) document.write('<div id="'+name+'" style="position:absolute;left:'+left+';top:'+top+';width:'+width+';height:'+height+';z-index:'+zIndex+';display:none" class="countryText">');
  if (isNS4up) document.write('<layer name="'+name+'" visibility="hidden" left="'+left+'" top="'+top+'" width="'+width+'" height="'+height+'" z-index="'+zIndex+'" class="countryText">');
  document.write(text);
  lyrClose()
}
function openCountry(mapNo) {
	mapName = "country" + mapNo;
	if (isIE4up) eval(mapName).style.display = "block";
	if (isNS4up) document.layers[mapName].visibility = "show";
}
function closeCountry() {
	if (isIE4up) eval(mapName).style.display = "none";
	if (isNS4up) document.layers[mapName].visibility = "hide";
}
function lyrImage(nm, lf, tp, zi, img){
  lyrOpen(nm, lf, tp, zi)
  document.write('<img src="\/images\/'+img+'" \/>');
  lyrClose();
}
function lyrOpen(nm, lf, tp, zi){
  if (isIE4up){
    document.writeln('<div id="'+nm+'" style="position:absolute; left:'+lf+'px; top:'+tp+'px; z-index:'+zi+'px;">');
  } else {
    document.writeln('<layer id="'+nm+'" left="'+lf+'" top="'+tp+'" z-index="'+zi+'">');
  }
}
function twoDec(n) {
  var s = "" + Math.round(n * 100) / 100;
  var i = s.indexOf('.');
  if (i < 0){ return s + ".00";};
  var t = s.substring(0, i + 1) + s.substring(i + 1, i + 3);
  if (i + 2 == s.length){ t += "0";};
  return t;
}
function lyrClose(){
  if (isIE4up){
    document.writeln('<\/div>');
  } else {
    document.writeln('<\/layer>');
  }
}
function popupDisclaimer(link){
  linkLocation = link;
  window.open('/includes/disclaimer.asp','disclaimer','scrollbars,height=350,width=550');
}
function onward(){
  newLink = window.opener.linkLocation;
  window.opener.document.location.href = newLink;
  window.close();
}
function transPage(){
  var selIndex = document.mapForm.chooseCountry.selectedIndex;
  var transPageNo = document.mapForm.chooseCountry.options[selIndex].value;
  if (transPageNo != 0){
	  if (transPageNo != 'x'){
		  document.location.href = "/in_your_area/transition_page.asp?id=" + transPageNo;
		}
	  else {
	    document.location.href = "/in_your_area/map_locator/basic/pnya.asp";
	  }
  }
}
function wln(name, url, level, selected, expanded, header){
	level=level+1;
	if (header==1){ 
		if (level==2)  {
			document.writeln("<tr><td height=\"12\"><img src=\"/images/de_clear.gif\" width=\"130\" height=\"12\" border=\"0\" alt=\"\"></td></tr><tr><td class=\"lftNavLev" + (level - 1) + "tbl\"><span class=\"lftNavSubHeading\">" + name + "</span></td></tr>"); 
		}
		else {
			document.writeln("<tr><td class=\"lftNavLev" + (level - 1) + "tbl\"><span class=\"lftNavSubHeading\">" + name + "</span></td></tr>"); 
		}
	} 
	else {
		if (level==1) {
			if (url.length > 0) {
				document.writeln("<tr><td class=\"lftNavLev1tbl\"><a class=\"lftNavHead\" href=\"" + url + "\">" + name + "</a></td></tr>");
			}
			else {
				document.writeln("<tr><td class=\"lftNavLev1tbl\"><span class=\"lftNavHead\">" + name + "</span></td></tr>");
			}
			document.writeln("<tr><td class=\"lftNavLev1Space\"><img src=\"/images/de_clear.gif\" width=\"130\" height=\"1\" border=\"0\" alt=\"\"></td></tr>");
		}        
		else if (level==2){
			if (_lncurlev==1) {
					document.writeln("<tr><td class=\"lftNavLev1tbl\"><a class=\"lftNavLev1dark\" href=\""+url+"\">"+name+"</a></td></tr>");
			}
			else if (selected==1){
				if (expanded==1){
					document.writeln("<tr><td class=\"lftNavLev1Space\"><a class=\"lftNavLev1on\" href=\"" + url + "\">" + name + "</a></td></tr>");
					inLevel2=true;   
				}
				else{
					document.writeln("<tr><td class=\"lftNavLev1tbl\"><a class=\"lftNavLev1on\" href=\"" + url + "\">" + name + "</a></td></tr>");
				}
			}                        
			else if (inLevel2) {
				document.writeln("<tr><td class=\"lftNavLev1Space\"><a class=\"lftNavLev1off\" href=\"" + url + "\">" + name + "</a></td></tr>");
				inLevel2=false;
			}                                
			else {
				document.writeln("<tr><td class=\"lftNavLev1tbl\"><a class=\"lftNavLev1off\" href=\"" + url + "\">" + name + "</a></td></tr>");
			}
		}
		else if ((level>=3) && (level<=5)){
			if (selected==1) {
				document.writeln("<tr><td class=\"lftNavLev" + (level - 1) + "tbl\"><a class=\"lftNavLev" + (level - 1) + "on\" href=\"" + url + "\">" + name + "</a></td></tr>");
			}
			else {
				document.writeln("<tr><td class=\"lftNavLev" + (level - 1) + "tbl\"><a class=\"lftNavLev" + (level - 1) + "off\" href=\"" + url + "\">" + name + "</a></td></tr>");
			}
		}
		else if (level==6) {
			if (selected==1){
				document.write("<tr><td class=\"lftNavLev" + (level - 1) + "tbl\"><a class=\"lftNavLev" + (level - 1) + "on\" href=\"" + url + "\">" + name + "</a>");
				if (expanded==1) { 
					document.write("<img src=\"/images/ic_openarrow.gif\" hspace=\"5\" align=\"absbottom\" height=\"10\" width=\"5\" />"); 
				}
				document.writeln("</td></tr>");
			} 
			else {
				document.writeln("<tr><td class=\"lftNavLev" + (level - 1) + "tbl\"><a class=\"lftNavLev" + (level - 1) + "off\" href=\"" + url + "\">" + name + "</a></td></tr>");
			}
		}
	}
}

