<!--

browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);

ns3up = (browserName == "Netscape" && browserVer >= 3);
ie4up = (browserName.indexOf("Microsoft") >= 0 && browserVer >= 4);

/* Image Rollover Functionality */
function findObject(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=findObject(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

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

function showCurrency()
{
	alert('coming soon!');
}

function RestoreImage()
{ //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 openPhoto(fileName, dir, title) 
{
	theURL = "../photo-display.php?nm="+fileName+"&dir="+dir+"&title="+title;
	window.open(theURL, '', 'resizable=no,scrollbars=no,width=600,height=420');
}

function openSubfolderPhoto(fileName, dir, title) 
{
	theURL = "../photo-display.php?nm="+fileName+"&dir="+dir+"&title="+title;
	window.open(theURL, '', 'resizable=no,scrollbars=no,width=600,height=420');
}

function showGoogleEarth(fileName, dir, title) 
{
	theURL = "google-earth.php?nm="+fileName+"&dir="+dir+"&title="+title;
	window.open(theURL, '', 'resizable=no,scrollbars=no,width=600,height=420');
}

/* RECOMMEND US FUNCTIONALITY STARTS HERE **/

function recommendUs(pre) 
{
	window.open(pre+'recommend.php', '', 'resizable=no,scrollbars=no,width=450,height=420');
}

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

/* RECOMMEND US FUNCTIONALITY ENDS HERE **/

/* CONTACT US FUNCTIONALITY STARTS HERE **/
function validateContactForm()
{
	fv = new formValidator();
	
	if (fv.isEmpty("fullname"))
		fv.raiseError("Please specify your full name.");
	
	if (fv.isEmpty("email"))
		fv.raiseError("Please specify your email.");
	else
	{
		if (!fv.isEmailAddress("email"))
			fv.raiseError("Please specify a valid email address.");
	}
		
	if (fv.isEmpty("message"))
		fv.raiseError("Please specify your message.");
		
	if (fv.isEmpty("code"))
		fv.raiseError("Please specify the security code.");

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

//ie bookmark functionality
function bookmarkUs()
{
	window.external.AddFavorite('http://www.cape-town-hotel.co.za', 'Cape Town Hotel Directory');
}

function right(e) {
/*
	if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))
		return false;
	else if (navigator.appName == 'Microsoft Internet Explorer' && 	(event.button == 2 || event.button == 3)) {
		alert("Copyright SA Hotels Online.com - All Rights Reserved.\nCopying of content and / or images is strictly prohibited!");
		return false;
	}
	return true;
*/	
}

document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;

-->