<!--
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);

ns3up = (browserName == "Netscape" && browserVer >= 3);
ie4up = (browserName.indexOf("Microsoft") >= 0 && browserVer >= 4);
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 recommendUs(pre) 
{
	window.open(pre+'recommend.php', '', 'resizable=no,scrollbars=no,width=450,height=420');
}

//ie bookmark functionality
function bookmarkUs()
{
	window.external.AddFavorite('http://www.jagerestates.co.za', 'Jager Estates - Property in Franschhoek and Villiersdorp.');
}

function showProperty(propertyId)
{
	window.open('property-detail.php?id='+propertyId, '', 'resizable,scrollbars,width=600,height=720');
}

function swopPhoto(imgName) 
{
	if (ns3up || ie4up) 
		imgOn = (imgName);
		
	document.mainpic.src = imgOn;
}

function validateContact()
{
	fv = new formValidator();
	
	if (fv.isEmpty("your_name"))
		fv.raiseError("Please specify your name.");
	
	if (fv.isEmpty("your_email"))
		fv.raiseError("Please specify your email.");
	else
	{
		if (!fv.isEmailAddress("your_email"))
			fv.raiseError("Please specify a your valid email address.");
	}
	
	if (!fv.isSelected("office"))
		fv.raiseError("Please specify which office you would like to contact.");
		
	if (fv.isEmpty("comment"))
		fv.raiseError("Please specify your comment / query.");
		
	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
		return true;
}

function validateRecommend()
{
	fv = new formValidator();
	
	if (fv.isEmpty("your_name"))
		fv.raiseError("Please specify your name.");
	
	if (fv.isEmpty("your_email"))
		fv.raiseError("Please specify your email.");
	else
	{
		if (!fv.isEmailAddress("your_email"))
			fv.raiseError("Please specify a your valid email address.");
	}
		
	if (fv.isEmpty("friend_name"))
		fv.raiseError("Please specify your friend's name.");

	if (fv.isEmpty("friend_email"))
		fv.raiseError("Please specify your friend's email address.");
	else
	{
		if (!fv.isEmailAddress("friend_email"))
			fv.raiseError("Please specify a valid email address for your friend.");
	}

	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
		return true;
}

function validateContactUsForm()
{
	fv = new formValidator();
	
	if (fv.isEmpty("email"))
		fv.raiseError("Please specify your email address.");
		
	if (!fv.isEmpty("email"))
	{
		if (!fv.isEmailAddress("email"))
			fv.raiseError("Please specify a valid email address.");
	}	
	
	if (fv.isEmpty("your_name"))
		fv.raiseError("Please specify your name.");
		
	if (fv.isEmpty("message"))
		fv.raiseError("Please specify your message.");
		
	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
		return true;
}

function validateSubscribe()
{
	fv = new formValidator();
	
	if (!fv.isEmpty("subscribe"))
	{
		if (!fv.isEmailAddress("subscribe"))
			fv.raiseError("Please specify a valid email address.");
	}
	else
		fv.raiseError("Please enter an email address in order to subscribe for more information");
	
	if (fv.numErrors() > 0)
	{
		fv.displayErrors();
		return false;
	}
	else
		return true;
}

// Code for rollover buttons
function preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findformElement(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function findformElement(n, d) { //v3.0
	  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=findformElement(n,d.layers[i].document); return x;
}

-->