// 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_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 MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


/* ================================================================ 
Add Load Event Function for window.onload or <body onload="">
=================================================================== */

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}


/* ================================================================ 
The original version of this script and the associated (x)html
is available at http://www.stunicholls.com/various/tabbed_pages.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This script and the associated (x)html may be modified in any 
way to fit your requirements.
=================================================================== */
function propertiestabsload() {
	var e, i = 0;
	while (e = document.getElementById('propertiestabsgallery').getElementsByTagName ('DIV') [i++]) {
		if (e.className == 'propertiestabson' || e.className == 'propertiestabsoff') {
		e.onclick = function () {
			var getEls = document.getElementsByTagName('DIV');
				for (var z=0; z<getEls.length; z++) {
				getEls[z].className=getEls[z].className.replace('propertiestabsshow', 'propertiestabshide');
				getEls[z].className=getEls[z].className.replace('propertiestabson', 'propertiestabsoff');
				}
			this.className = 'propertiestabson';
			var max = this.getAttribute('title');
			document.getElementById(max).className = "propertiestabsshow";
			}
		}
	}
}

function landtradetabsload() {
	var e, i = 0;
	while (e = document.getElementById('landtradetabsgallery').getElementsByTagName ('DIV') [i++]) {
		if (e.className == 'landtradetabson' || e.className == 'landtradetabsoff') {
		e.onclick = function () {
			var getEls = document.getElementsByTagName('DIV');
				for (var z=0; z<getEls.length; z++) {
				getEls[z].className=getEls[z].className.replace('landtradetabsshow', 'landtradetabshide');
				getEls[z].className=getEls[z].className.replace('landtradetabson', 'landtradetabsoff');
				}
			this.className = 'landtradetabson';
			var max = this.getAttribute('title');
			document.getElementById(max).className = "landtradetabsshow";
			}
		}
	}
}

function investmentstabsload() {
	var e, i = 0;
	while (e = document.getElementById('investmentstabsgallery').getElementsByTagName ('DIV') [i++]) {
		if (e.className == 'investmentstabson' || e.className == 'investmentstabsoff') {
		e.onclick = function () {
			var getEls = document.getElementsByTagName('DIV');
				for (var z=0; z<getEls.length; z++) {
				getEls[z].className=getEls[z].className.replace('investmentstabsshow', 'investmentstabshide');
				getEls[z].className=getEls[z].className.replace('investmentstabson', 'investmentstabsoff');
				}
			this.className = 'investmentstabson';
			var max = this.getAttribute('title');
			document.getElementById(max).className = "investmentstabsshow";
			}
		}
	}
}

function tsttabsload() {
	var e, i = 0;
	while (e = document.getElementById('tsttabsgallery').getElementsByTagName ('DIV') [i++]) {
		if (e.className == 'tsttabson' || e.className == 'tsttabsoff') {
		e.onclick = function () {
			var getEls = document.getElementsByTagName('DIV');
				for (var z=0; z<getEls.length; z++) {
				getEls[z].className=getEls[z].className.replace('tsttabsshow', 'tsttabshide');
				getEls[z].className=getEls[z].className.replace('tsttabson', 'tsttabsoff');
				}
			this.className = 'tsttabson';
			var max = this.getAttribute('title');
			document.getElementById(max).className = "tsttabsshow";
			}
		}
	}
}

function proptabsload() {
	var e, i = 0;
	while (e = document.getElementById('proptabsgallery').getElementsByTagName ('DIV') [i++]) {
		if (e.className == 'proptabson' || e.className == 'proptabsoff') {
		e.onclick = function () {
			var getEls = document.getElementsByTagName('DIV');
				for (var z=0; z<getEls.length; z++) {
				getEls[z].className=getEls[z].className.replace('proptabsshow', 'proptabshide');
				getEls[z].className=getEls[z].className.replace('proptabson', 'proptabsoff');
				}
			this.className = 'proptabson';
			var max = this.getAttribute('title');
			document.getElementById(max).className = "proptabsshow";
			}
		}
	}
}

function cstabsload() {
	var e, i = 0;
	while (e = document.getElementById('cstabsgallery').getElementsByTagName ('DIV') [i++]) {
		if (e.className == 'cstabson' || e.className == 'cstabsoff') {
		e.onclick = function () {
			var getEls = document.getElementsByTagName('DIV');
				for (var z=0; z<getEls.length; z++) {
				getEls[z].className=getEls[z].className.replace('cstabsshow', 'cstabshide');
				getEls[z].className=getEls[z].className.replace('cstabson', 'cstabsoff');
				}
			this.className = 'cstabson';
			var max = this.getAttribute('title');
			document.getElementById(max).className = "cstabsshow";
			}
		}
	}
}


function bluetabsload() {
	var e, i = 0;
	while (e = document.getElementById('bluetabsgallery').getElementsByTagName ('DIV') [i++]) {
		if (e.className == 'bluetabson' || e.className == 'bluetabsoff') {
		e.onclick = function () {
			var getEls = document.getElementsByTagName('DIV');
				for (var z=0; z<getEls.length; z++) {
				getEls[z].className=getEls[z].className.replace('bluetabsshow', 'bluetabshide');
				getEls[z].className=getEls[z].className.replace('bluetabson', 'bluetabsoff');
				}
			this.className = 'bluetabson';
			var max = this.getAttribute('title');
			document.getElementById(max).className = "bluetabsshow";
			}
		}
	}
}

function proptabs2load() {
	var e, i = 0;
	while (e = document.getElementById('proptabs2gallery').getElementsByTagName ('DIV') [i++]) {
		if (e.className == 'proptabs2on' || e.className == 'proptabs2off') {
		e.onclick = function () {
			var getEls = document.getElementsByTagName('DIV');
				for (var z=0; z<getEls.length; z++) {
				getEls[z].className=getEls[z].className.replace('proptabs2show', 'proptabs2hide');
				getEls[z].className=getEls[z].className.replace('proptabs2on', 'proptabs2off');
				}
			this.className = 'proptabs2on';
			var max = this.getAttribute('title');
			document.getElementById(max).className = "proptabs2show";
			}
		}
	}
}

/*function changeImgSize() {
objectId = "expatbanner";
newWidth = 756;
newHeight = 110;
imgString = 'theImg = document.getElementById("'+objectId+'")';
eval(imgString);
oldWidth = theImg.width;
oldHeight = theImg.height;
if(newWidth>0){
theImg.width = newWidth;
}
if(newHeight>0){
theImg.height = newHeight;
}
}

addLoadEvent(changeImgSize);*/

/*------------------ Quick Enquiry Form ------------------- */
var xmlHttp;

function frm_SearchEngineList()
{
xmlHttp=frm_GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
 
url="http://www.expat-group.com/includes/searchenginelist.php";
xmlHttp.onreadystatechange=frm_stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function frm_OtherBox()
{
xmlHttp=frm_GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
 
url="http://www.expat-group.com/includes/otherbox.php";
xmlHttp.onreadystatechange=frm_stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function frm_stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("sourcechg").innerHTML=xmlHttp.responseText;
 } 
}

function frm_GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

function frm_enabledisable(frm) {
	if (frm.Enquiry_Source.value == "Other") {
	frm.Source_Details.disabled=false;
	frm_OtherBox();
	}
	else if (frm.Enquiry_Source.value == "Web Search") {
	frm.Source_Details.disabled=false;
	frm_SearchEngineList();
	}
	else
	{
	frm.Source_Details.disabled=true;
	}
}

function frm_submitonce(theform){
//if IE 4+ or NS 6+
if (document.all||document.getElementById){
//screen thru every element in the form, and hunt down "submit" and "reset"
for (i=0;i<theform.length;i++){
var tempobj=theform.elements[i]
if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
//disable em
tempobj.disabled=true
}
}
}
<!--

function frm_validate_enquiry(frm)
{ 

 if (frm.Name.value=="")
    {
      alert("Please enter your Name" );
      frm.Name.focus();
      return false;
    }
 if (frm.Email.value=="")
    {
      alert("Please enter your Email Id" );
      frm.Email.focus();
      return false;
    }
 if (invalidemail_check(frm.Email.value))
    {
  
  alert("Email address should be of type 'abc@pqr.com' or 'abc@pqr.co.in' etc. ");
       frm.Email.focus();
       return false;
    }
 if (frm.City.value=="")
    {
      alert("Please enter your City" );
      frm.City.focus();
      return false;
    }
 if (frm.Telephone.value=="")
    {
      alert("Please enter your Phone No." );
      frm.Telephone.focus();
      return false;
    }
 if (frm.Query.value=="")
    {
      alert("Please enter your Query" );
      frm.Query.focus();
      return false;
    }

 if (frm.Enquiry_Source.value=="Select")
    {
      alert("Please select an option for \'How did you heard about us?\'" );
      frm.Enquiry_Source.focus();
      return false;
    }
if (frm.Enquiry_Source.value=="Web Search")
	{
		if (frm.Source_Details.value=="Select")
		{
		alert("Please select a Search Engine from the list" );
		frm.Source_Details.focus();
		return false;
		}
	}
else if (frm.Enquiry_Source.value=="Other")
	{
		if (frm.Source_Details.value=="")
		{
		alert("Please enter your Source details" );
		frm.Source_Details.focus();
		return false;
		}
	}


return true;
}

function invalidemail_check(s)
{
  res=0;
  len=s.length;

   for(i=0;i<len;i++)
     { 
       if(s.charAt(i)=='@' )
	 
   for(j=i;j<len;j++)
            {
              if(s.charAt(j)=='.')
                  res=1;
	
             }
     }  
if (res==0)
    return true; 
  else
     return false; 
   
}

