// JavaScript Document

function ChangeBG(el,cl)
{
	document.getElementById(el+'1').className = cl;
	document.getElementById(el+'2').className = cl;
	document.getElementById(el+'3').className = cl;
	document.getElementById(el+'4').className = cl;
}

//                     Show and Hide Divs
// **********************************************************

var companies = new Array();
companies[0] = 'AustCompanies';
companies[1] = 'NewZealandCompanies';
companies[2] = 'USCompanies';
companies[3] = 'HKCompanies';
companies[4] = 'UKCompanies';


var companyDetails = new Array();
companyDetails[0] = 'AustCompaniesDetail';
companyDetails[1] = 'NewZealandCompaniesDetail';
companyDetails[2] = 'USCompaniesDetail';
companyDetails[3] = 'HKCompaniesDetail';
companyDetails[4] = 'UKCompaniesDetail';


var maps = new Array();
maps[0] = 'GroupAustMap';
maps[1] = 'GroupNZMap';
maps[2] = 'GroupUSMap';
maps[3] = 'GroupHKMap';
maps[4] = 'GroupUKMap';


var colHeadings = new Array();
colHeadings[0] = 'AusColHeading';
colHeadings[1] = 'NZColHeading';
colHeadings[2] = 'USColHeading';
colHeadings[3] = 'HKColHeading';
colHeadings[4] = 'UKColHeading';



function hideOrShow(n)
{
   
   
   var CountryIndex = parseInt(document.getElementById("CountryIndex").value);
   var Counter = parseInt(n);
   
   //alert ("Ind"+CountryIndex);
   //alert ("Counter"+Counter);

   CountryIndex = CountryIndex + Counter;
   if (CountryIndex > 4) { CountryIndex = 0; } 
   else { if (CountryIndex < 0) { CountryIndex = 4; }}
   
   document.getElementById("CountryIndex").value = CountryIndex;

   i=0;
   for (i=0; i<companies.length; ++i) {
      if (i == CountryIndex)
	  {
		 document.getElementById(companies[i]).style.visibility = 'visible';
		 document.getElementById(companyDetails[i]).style.visibility = 'visible';
		 document.getElementById(maps[i]).style.visibility = 'visible';
		 document.getElementById(colHeadings[i]).style.visibility = 'visible';
	  }
	  else 
      {
		 document.getElementById(companies[i]).style.visibility = 'hidden';
		 document.getElementById(companyDetails[i]).style.visibility = 'hidden';
		 document.getElementById(maps[i]).style.visibility = 'hidden';
		 document.getElementById(colHeadings[i]).style.visibility = 'hidden';
	  }
   }
}

function hideSearch () {
	
	// Hide the right hand search fields when the main search page is being invoked.
	var matchstr  = /search/; 
	var matchstr2 = /showurl/;
	var urlstr = window.location.href;
    if (matchstr.test(urlstr)) 
	{
		if (!matchstr2.test(urlstr)) { 
		   document.getElementById("SearchFieldRight").style.visibility = 'hidden';
           document.getElementById("SearchButtonRight").style.visibility = 'hidden';
		}
	}
	
}

