// JavaScript Document

function addToFavorites() 
	{ if (window.external) { window.external.AddFavorite(urlAddress,pageName) 
	} else { alert("Sorry! Your browser doesn't support this function."); 
	} }

function addOption(selectId, val, txt, selected) {
			if (selected == val) { 
				s = true;
			} else {
				s = false;
			}
			var objOption = new Option(txt, val, s, s);
			document.getElementById(selectId).options.add(objOption);
		}
		function setToLoading(selectId) {
			var objOption = new Option('LOADING...',0, true, true);
			document.getElementById(selectId).options.add(objOption);
			document.getElementById(selectId).style.backgroundColor = "#00A0C6";
			document.getElementById(selectId).disabled = false;
		}

function ResetForm(which){
		var pass=true
		var first=-1
		if (document.images){
		for (i=0;i<which.length;i++){
		var tempobj=which.elements[i]
		if (tempobj.type=="text"){
		eval(tempobj.value="")
		if (first==-1) {first=i}
		}
		else if (tempobj.type=="checkbox") {
		eval(tempobj.checked=0)
		if (first==-1) {first=i}
		}
		else if (tempobj.col!="") {
		eval(tempobj.value="")
		if (first==-1) {first=i}
		}
		}
		}
		which.elements[first].focus()
		return false
		}

   menu_status = new Array();

function showHide(mymenu, head, IMG){
	//alert ("menu active: "+ mymenu + "  "+ head +"  "+ IMG);
	if(document.getElementById(mymenu).style.display == "") {
		if(document.getElementById(mymenu).className == "hide") {
			document.getElementById(mymenu).style.display="block";
			document.getElementById(head).className="headopen2";
			document.getElementById(IMG).src = "/images/menu-open.gif"
		} else if(document.getElementById(mymenu).className == "show"){
			document.getElementById(mymenu).style.display = "none";
			document.getElementById(head).className="head";
			document.getElementById(IMG).src = "/images/menu-close.gif";
		}
	} else {
		if(document.getElementById(mymenu).style.display == "none") {
			document.getElementById(mymenu).style.display = "block";
			document.getElementById(head).className="headopen2";
			document.getElementById(IMG).src = "/images/menu-open.gif"
		} else if(document.getElementById(mymenu).style.display == "block"){
			document.getElementById(mymenu).style.display = "none";
			document.getElementById(head).className="head";
			document.getElementById(IMG).src = "/images/menu-close.gif";
		}
	}
	if(document.getElementById(IMG).src == "/images/menu-close.gif"){
		document.getElementById(IMG).src = "/images/menu-open.gif"	
	}
	if(document.getElementById(IMG).src == "/images/menu-open.gif"){
		document.getElementById(IMG).src = "/images/menu-close.gif"	
	}
}



function make_blank()
{
document.form1.type.value ="";
}

var check = "1";

function hideDiv() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('hideshow').style.display = 'none';
}
else {
if (document.layers) { // Netscape 4
document.hideshow.display = 'none';
}
else { // IE 4
document.all.hideshow.style.display = 'none';
document.all.hideshow.style.height = '0px';
}
}
}

function showDiv() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('hideshow').style.display = 'block';
}
else {
if (document.layers) { // Netscape 4
document.hideshow.display = 'block';
}
else { // IE 4
document.all.hideshow.style.display = 'block';
}
}
}

function showDiv2() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('hideshow2').style.display = 'none';
}
else {
if (document.layers) { // Netscape 4
document.hideshow2.display = 'none';
}
else { // IE 4
document.all.hideshow2.style.display = 'none';
document.all.hideshow2.style.height = '0px';
}
}
}

<!--
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 validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { 
		test=args[i+2]; 
		val=MM_findObj(args[i]);
		//alert("something one night " +val.value);
    if (val) { if (args[i+1] == "") { 
			nm=val.name; 
		}else{ 
			nm = args[i+1] 
		}
		if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { 
				p=val.indexOf('@');
				//alert ("val: " +val + " p " +p);
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' it is not a valid email address\n';
      } else if (test.indexOf('isCEmail')!=-1) {
				//alert("im in");
				var email1 = MM_findObj(args[i]);
				var email2 = MM_findObj(args[i+1]);
				if (email1.value != email2.value) errors+='- Make sure you confirmed your email address correctly.\n\n';
      } else if (test!='R') { 
				num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number\n';
        if (test.indexOf('inRange') != -1) { 
					p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'\n';
    		} 
			} 
		} else if (test.charAt(0) == 'R') 
			errors += '- '+nm+'\n'; 
		}
  } 
	if (errors) alert('Please complete the following:\n\n'+errors);
  document.MM_returnValue = (errors == '');
}

function popup(url,name,w,h,scroll) {
	alert('Date Picker:\n\n');
	var popwin = window.open(url,name,'width='+w+',height='+h+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+scroll+',resizable=yes');
	popwin.focus();
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

 var xmlHttp
		//alert ("loded captain");
		function sendtofriend()
		{ 
			if (document.getElementById("sendtofriend").innerHTML == "") {	
				xmlHttp=GetXmlHttpObject();
				if (xmlHttp==null)
					{
					alert ("Your browser does not support AJAX!");
					return;
					} 
				var url="/inc/send_popup.php";
				xmlHttp.onreadystatechange=function()
							{
							if(xmlHttp.readyState==4)
								{
								document.getElementById("sendtofriend").innerHTML=xmlHttp.responseText;
								document.getElementById("sendtofriend").style.display="block";
								}
							}
				xmlHttp.open("GET",url,true);
				xmlHttp.send(null);
			} else {
				document.getElementById("sendtofriend").innerHTML = "";
				document.getElementById("sendtofriend").style.display="none";
			}
			return false;
		} 
		
		function 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 bookmark(title,url){
if (window.sidebar) // firefox
window.sidebar.addPanel(title, url, "http://accommodation.drivesouthafrica.co.za");
else if(window.opera && window.print){ // opera
var elem = document.createElement('a');
elem.setAttribute('href',url);
elem.setAttribute('title',title);
elem.setAttribute('rel','sidebar');
elem.click();
}
else if(document.all)// ie
window.external.AddFavorite(url, title);
}

function booknow(st)
{
	document.form1.room.value = st;
	document.form1.submit();
}

function booknow2(st,ss)
{
	document.form1.room.value = st;
	document.form1.season.value = ss;
	document.form1.submit();
}

function submitform(st)
{
	document.form1.sort.value = st;
	document.form1.submit();
}

function submitform2(st)
{
	document.form1.pageNum.value = st;
	document.form1.submit();
}
		
//-->
