// JavaScript Document
///////////////////////////
function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}

bw=new checkBrowser();
////////////////////////////
function replaceCharacters(conversionString,inChar,outChar)
{
  var convertedString = conversionString.split(inChar);
  convertedString = convertedString.join(outChar);
  return convertedString;
}
function change_menu(imageName)
{
var imageSource=imageName.src
new_src=replaceCharacters(imageSource,".gif","_active.gif")
imageName.src=new_src
}

function unchange_menu(imageName)
{
var imageSource=imageName.src
new_src=replaceCharacters(imageSource,"_active.gif",".gif")
imageName.src=new_src
}


 ////////////////////////
//// Select all checkBoxes:
////////////////////////
function all_chk_onclick()
 {
  if (document.getElementById('search_items_frm').elements["all_chk"].checked == true) 
   {
   document.getElementById('search_items_frm').elements["results_chk"].checked = true;
   document.getElementById('search_items_frm').elements["publications_chk"].checked  = true;
   document.getElementById('search_items_frm').elements["acronym_chk"].checked  = true;
   document.getElementById('search_items_frm').elements["usaid_program_chk"].checked  = true;
   document.getElementById('search_items_frm').elements["related_websites_chk"].checked  = true;
   }
 }
////////////////////// 

//////////////////////////////////////////
//// Check if all items selected ot not:
//////////////////////////////////////////
function check_all_selected()
 {
	if(document.getElementById('search_items_frm').elements["results_chk"].checked == true || document.getElementById('search_items_frm').elements["publications_chk"].checked == true || document.getElementById('search_items_frm').elements["acronym_chk"].checked == true || document.getElementById('search_items_frm').elements["usaid_program_chk"].checked == true || document.getElementById('search_items_frm').elements["related_websites_chk"].checked == true)
	  {
	   document.getElementById('search_items_frm').elements["all_chk"].checked = false;		  
	  }
 }

////////////////////////////////////////////
function activate(theTR)
{
		theRow=bw.dom?document.getElementById(theTR):bw.ie4?document.all[theTR]:bw.ns4?eval(theTR):0;
		theRow.style.backgroundColor="#C8D8C9";
}
function deactivate(theTR)
{
		theRow=bw.dom?document.getElementById(theTR):bw.ie4?document.all[theTR]:bw.ns4?eval(theTR):0;
		theRow.style.backgroundColor="#EBF1EB";
}
function change_the_map(area_id)
{
area_id=replaceCharacters(area_id,"*","_")
themap=eval("document."+"egypt_map_id");

var imageSource=themap.src
new_path=area_id+"_active.gif"
new_src=replaceCharacters(imageSource,".gif",new_path)
themap.src=new_src
//alert(new_src)
}
function unchange_the_map(area_id)
{
area_id=replaceCharacters(area_id,"*","_")
themap=eval("document."+"egypt_map_id");

var imageSource=themap.src
new_path=area_id+"_active.gif"
new_src=replaceCharacters(imageSource,new_path,".gif")
themap.src=new_src
}
function get_result(result_id)
{
result_id=replaceCharacters(result_id,"*","")
	if (result_id=='00')
	{
		location.href="map2.asp"
	}
	else
	{
		//alert("result_details_by_map.asp?ResultId="+result_id)
		location.href="result_details_by_map.asp?ResultId="+result_id
	}
}


