/*

JavaScript CREATED FOR HBL CORPORATE WEBSITE

BEGIN DATE: 3RD SEPTEMBER 2007

  */





function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}



function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}



function MM_findObj(n, d) { //v4.01

  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_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}



function country()

{

	

	document.branchlocator.action="search_results_branch.php";

	document.branchlocator.submit();

	return true;

}

function agri()

{

	

	document.branchlocator.action="search_results_agri_branch.php";

	document.branchlocator.submit();

	return true;

}
function zarai_country()

{

	

	document.branchlocator.action="zarai_search_results_branch.php";

	document.branchlocator.submit();

	return true;

}

function worldwide()

{

	document.hblworldwide.action="search_results_worldwide.php";

	document.hblworldwide.submit();

	return true;

}



function cValue(page) {

	myvalue=10;

	document.branchlocator.action=page;

	document.branchlocator.submit();   

	document.branchlocator.branchATM.checked=true;

}



function jumpTo (link)

   {

   var new_url=link;

   if (  (new_url != "")  &&  (new_url != null)  )

      window.location=new_url;

}



function toggleLayer(val)

	{

		

			if(val == 'on' || val === true)

			{

				document.getElementById('b1').checked = false;

				document.getElementById('a1').checked = true;

				document.getElementById('layer1').style.display = 'visible';

				document.getElementById('layer2').style.display = 'none';

			}

			else if(val == 'off' || val === false)

			{

				document.getElementById('b1').checked = true;

				document.getElementById('a2').checked = false;

				document.getElementById('layer1').style.display = 'none';

				document.getElementById('layer2').style.display = 'visible';

			}

		}



// JavaScript Document

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_showHideLayers() { //v6.0

  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; }

}



function IsNumeric(strString)

   //  check for valid numeric strings 

   {

   var strValidChars = "0123456789.-";

   var strChar;

   var blnResult = true;



   if (strString.length == 0) return false;



   //  test strString consists of valid characters listed above

   for (i = 0; i < strString.length && blnResult == true; i++)

      {

      strChar = strString.charAt(i);

      if (strValidChars.indexOf(strChar) == -1)

         {

         blnResult = false;

         }

      }

   return blnResult;

}



 

function goToURL(sel)

{
	value = sel.options[sel.options.selectedIndex].value;

	/*if (value == "9")

	{
   		document.hblworldwide.action="search_results_worldwide1.php";

		document.hblworldwide.submit();

		return true; 
   	}

	else if (value == "21")

	{
   		myWindow = window.open("http://www.bankphb.com/live/general/","_blank");

   		myWindow.document.close(); 
   	}*/
	if (IsNumeric(value) == false)

	{
		
		/*added by mth@s4s 14-7-2010 on instruction of anas-hbl*/
		if (value == "http://habibbankchina.com" || value == "http://www.habibbankuk.com" || value == "http://hblusa.com" )
		{
		
			myWindow = window.open( sel.options[sel.options.selectedIndex].value,"_self");
		}
		else
		{
			myWindow = window.open( sel.options[sel.options.selectedIndex].value,"_blank");
		}

			myWindow.document.close(); 

   	}

	else

	{

		   document.hblworldwide.action="search_results_worldwide.php";

		   document.hblworldwide.submit();

		   return true;   

   	}

}





function MM_jumpMenu(targ,selObj,restore){ //v3.0

  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

  if (restore) selObj.selectedIndex=0;

}



function popUp(URL) {

day = new Date();

id = day.getTime();

//eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=0,width=470,height=350,left = 312,top = 184');");
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=0,width="+ screen.width +",height="+ screen.height +",left = 0,top = 0');");

}

function openParent()
{
	opener.location.href = "individual-customers-phone-banking.php";
}

function gmap(value)
{
	document.getElementById(value).style.display = 'block';
}



/*function gmap(value){
	

	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
		//document.getElementById("img").style.display='none';
		var ajaxDisplay = document.getElementById('value');
		ajaxDisplay.innerHTML = ajaxRequest.responseText;
		document.getElementById('value').style.display='inline';
		
			
		}
	}
	var i;
	//var queryString="no="+value;
	//alert("calPass.php?"+queryString)
	//var newid = document.getElementById(i).value;
	ajaxRequest.open("GET", "calPass.php", true);
	ajaxRequest.send(null);
	
}

*/
