//Alex Arts 29 SEP 2006:	moved the function "count_change" to the INdexPage pt

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
	if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
	document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01 needed for the rollover
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0 show/hide the layers with the rollovertext
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
	obj.visibility=v; }
}

// args: 1=Full brouwser functionalities, 0=Only scrollbars and resize handles
function NewWindow (URL,args){
	if (args==1)
	 {
		var xw,yw
		xw=(screen.width/3)*2;
		yw=(screen.height/3)*2;
		window.open(URL, "", "height="+yw+",width="+xw+",scrollbars=1,resizable=1,location=1,menubar=1,status=1,toolbar=1");
	 }

	else if (args==9)
	 {
		var xw,yw, win1
		xw=788;
		yw=469;
		win1 = window.open(URL, "", "height="+yw+",width="+xw+",scrollbars=1,resizable=1");
		win1.moveTo((screen.width/2)-((xw/2)),(screen.height/2)-((yw/2)));
	 }
	 else if (isNaN(args))
	 {
		var arrWFeatures = args.split(",");
		var intFeature = 0;
		var winWidth  = arrWFeatures[0].substring(arrWFeatures[1].indexOf('='),arrWFeatures[0].length);
		var winHeight = arrWFeatures[1].substring(arrWFeatures[1].indexOf('=')+1,arrWFeatures[1].length);
		var intLeft = (screen.width - winWidth)/2;
		var intTop  = (screen.height - winHeight)/2 - 50;
		if(intLeft<0){intLeft=0;}
		if(intTop<0){intTop=0;}
		var strCenter  = ",left=" + intLeft + ",screenX=" + intLeft;
		   strCenter += ",top=" + intTop + ",screenY=" + intTop;
		args += strCenter;
		var winNew = window.open(URL, 'winNew', args);
		winNew.focus()
		// .moveto method causes an error: access denied
		//winNew.moveTo((screen.width/2)-((winWidth/2)),(screen.height/2)-((winHeight/2)));
	 }

	 else
	 {
		var xw,yw, win1
		xw=(screen.width/3)*2;
		yw=(screen.height/3)*2;
		win1=window.open(URL, 'win2', "height="+yw+",width="+xw+",scrollbars=1,resizable=1");
		win1.moveTo((screen.width/2)-((xw/2)),(screen.height/2)-((yw/2)));
	 }

 return false;   }

// Add a QueryString to the action of a form and send the form
function AddQueryStringAndSubmit(name,value)
  {
	 document.frmHiddenVariables.action = document.frmHiddenVariables.action+"?"+name+"="+value
  }

// Set the value of a select menu
function SetOptionSelected(value, inp)
  {
	 inp.value=value;
  }
function swapbutton(imgsrc)
{
// shows layer
if (imgsrc.id=="btnselectup")
  {
  document.jump.btnselect.src = "/Images/14_24773.gif";
  document.jump.btnselect.id = "btnselect"
  document.all.list.style.visibility = "visible";
  document.all.list.focus();
  return;
  }
// hide layer
else
  {
  document.jump.btnselect.src = "/Images/14_24772.gif";
  document.jump.btnselect.id = "btnselectup"
  document.all.list.style.visibility = "hidden";
  document.jump.btnselect.focus();
  }
}

// jumps to url of selection
function GoSelected(ref)
{
  document.jump.country.value=ref.id;
  document.jump.country.style.cssText= "background-color:#0A246A; color:#FFFFFF;border-color:#FFFFFF;border-style:solid";
  document.jump.btnselect.src = "/Images/14_24772.gif";
  document.jump.btnselect.id = "btnselectup"
  document.all.list.style.visibility = "hidden";
  document.location = ref.href
}

// hides the countrylist
function HideList()
{
  document.jump.btnselect.src = "/Images/14_24772.gif";
  document.jump.btnselect.id = "btnselectup";
  document.all.list.style.visibility = "hidden";
}

function printPage() {
  if (window.print) {
	 if(navigator.userAgent.toLowerCase().indexOf('mozilla') != -1)
	 {
		if(navigator.userAgent.toLowerCase().indexOf('msie') !=-1)
		   {
		   // much better browser, so do nothing
		   }

		else
		   {
			if(parseInt(navigator.appVersion)>3 && parseInt(navigator.appVersion)<5)
			{
			  alert('you are using nav4 so print format not supported');
			}
		   }

	 }

	 window.print();
  } else {
	 alert("Sorry, your browser doesn't support this feature.");
  }
}



//this function is used by ct_itemlist_pulldown	  
//define objects for the main list
function ListItem(nvalue,description,urlMain){
 //function for defining the elements of the main list
 this.nvalue=nvalue;
 this.description=description;
 this.urlMain=urlMain;

}

//this function is used by ct_itemlist_pulldown	
//define objects for the dependent list
function ListSubItem(category,nvalue,description,urlSub){
 //function for defining the elements of the sublists
 this.category=category;
 this.nvalue=nvalue;
 this.description=description;
 this.urlSub=urlSub;

}

//this function is used by ct_itemlist_pulldown	
function reFillList(){
	if (document.frmPulldown.mainlist.length!=0){
		var selValue;
		var nOption;
		selValue=document.frmPulldown.mainlist.value;
		// clear the actual list by setting its length to 0
		document.frmPulldown.sublist.length=0;
		for (var i=0; i < SubList.length;i++){
			if (SubList[i].category==selValue) {
				nOption=document.frmPulldown.sublist.length;
				document.frmPulldown.sublist.options[nOption]=new Option(SubList[i].description,SubList[i].nvalue);
			}
		}
		if (document.frmPulldown.sublist.length==0){
			document.frmPulldown.sublist.style.visibility='hidden';
	
			selValue=document.frmPulldown.mainlist.value;
			if (selValue==0) {
				return false;
			}
			else{
				if (document.frmPulldown.processed.value=="true") {
					for (var j=0; j < MainList.length;j++){
						if (MainList[j].nvalue==selValue) {
							document.location.href=MainList[j].urlMain;
						}
					}
					document.frmPulldown.processed.value="false";
				}
				else {
					document.frmPulldown.processed.value="true";
				}
			}
		} 
		else {
			document.frmPulldown.sublist.style.visibility='visible';
		}
	}
}

//this function is used by ct_itemlist_pulldown	
function reDirectComp(){
 //navigate to the link in the sub list
 var selValue;
 selValue=document.frmPulldown.sublist.value;
 	 if (selValue==0) {
	 	return false;
	 }
	 else
	 {
	 document.location.href=SubList[selValue].urlSub;
	}
}
