// JavaScript Document

var xmlHttp;
var rootpath;
var divid
var bip
var forlan
 
//rootpath = "http://path.com/to/root/location/";   // be sure to change this to your URL
rnd.today=new Date(); 

rnd.seed=rnd.today.getTime(); 

function rnd() { 

rnd.seed = (rnd.seed*9301+49297) % 233280; 

return rnd.seed/(233280.0); 

};

function rand(number) { 

return Math.ceil(rnd()*number); 

}; 

$.preloadImages = function(){
	for(var i=0; i<arguments.length; i++){
		$("<img>").attr("src",arguments[i]);
	}
		
}

function ParkMaps(geocode,parkname,address1,address2,address3,addressState,addressPostcode)
{
	geo = geocode.split(",")
	if (GBrowserIsCompatible())
	{
		
		var map = new GMap2(document.getElementById("map"));					
		map.addControl(new GSmallMapControl());
		var point = new GLatLng(geo[0],geo[1]);
		map.setCenter(point, 14);

		var popup = document.createElement("div");
		popup.setAttribute("class", "MapPopup");

		var description = document.createElement("div");
		description.setAttribute("class", "MapAddress");

		var heading = document.createElement("strong");
		heading.innerHTML = parkname;
		description.appendChild(heading);

		description.appendChild(document.createElement("br"));

		description.appendChild(document.createTextNode(address1));
		description.appendChild(document.createElement("br"));

		description.appendChild(document.createTextNode(addressState + " " + addressPostcode));
		description.appendChild(document.createElement("br"));

		//var a = document.createElement("a");
		//a.setAttribute("href","#");
		//a.setAttribute("onclick","DisplayStreet(-34.913366,138.62878)");
		//a.innerHTML = "STREET VIEW";
		
		//description.appendChild(a);

		popup.appendChild(description);
		map.openInfoWindow(point, popup);

		var marker = new GMarker(point);
		GEvent.addListener (marker, "click", function() {
			marker.openInfoWindow(popup);
			
		});
		map.addOverlay(marker);					
	}	
}

function checkDirectoryFields(theform) 
{
	if(trimit(theform.name.value) == "") 
	{
		alert("Please enter your Name.");
		theform.name.focus();
		return (false);
	}
	if(trimit(theform.street.value) == "") 
	{
		alert("Please enter your Street Address.");
		theform.street.focus();
		return (false);
	}
	if(trimit(theform.city.value) == "") 
	{
		alert("Please enter your City.");
		theform.city.focus();
		return (false);
	}
	if(trimit(theform.state.value) == "") 
	{
		alert("Please enter your State.");
		theform.state.focus();
		return (false);
	}
	if(trimit(theform.country.value) == "AUSTRALIA") 
	{
		if(trimit(theform.zip.value) == "") 
			{
			alert("Please enter your Post Code or ZIP Code.");
			theform.zip.focus();
			return (false);
			}
		else
			{
			if(isNaN(theform.zip.value)) 
				{
				alert("Please enter a valid Post Code or ZIP Code.");
				theform.zip.focus();
				return (false);
				}
			}
	}
	return (true);
}



function parkfeatures()
{
	var obj1 = document.getElementById("parkfeature")
	var obj2 = document.getElementById("parkstate")
    var obj1value = obj1.options[obj1.selectedIndex].value
	var obj2value = obj2.options[obj2.selectedIndex].value

	if(obj1value == "" || obj2value == "")
	{
		alert("Please select a feature and a state")
	}
	else
	{
		var url= "parkfeaturelookup.asp?feature=" + obj1value + "&states=" + obj2value
		divid = "searchresults"
		xmlHttp=GetXmlHttpObject(stateChanged)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
	}
}

function checkFields_changedetails(theform) 
{
	if(theform.Name.value == "") 
	{
		alert("Please enter a Name.");
		theform.Name.focus();
		return (false);
	}
	if(theform.Password.value == "") 
	{
		alert("Please enter an Password.");
		theform.Password.focus();
		return (false);
	}	
	if(theform.Password.value != theform.Password1.value) 
	{
		alert("The Verified Password does not match the password.");
		theform.Password1.focus();
		return (false);
	}	
	if(theform.Password.value.length < 3)
	{
		alert("The password must be at least 3 numbers and/or characters");
		theform.Password.focus();
		return (false);
	}
	if(theform.passwordclue.value == "") 
	{
		alert("Please enter a Password Clue.");
		theform.passwordclue.focus();
		return (false);
	}
	if(theform.emailR.value == "") 
	{
		alert("Please enter an Email Address for password recovery.");
		theform.emailR.focus();
		return (false);
	}	
	if(theform.organisation.value == "") 
	{
		alert("Please enter an Organisation.");
		theform.organisation.focus();
		return (false);
	}	
}

function fastfind()
{
	var obj1 = document.getElementById("fastfind")
    var obj1value = obj1.options[obj1.selectedIndex].value
	switch(obj1value)
	{
		case "1":
			document.location.href = "states.asp?states=nsw"
			break
		case "2":
			document.location.href = "states.asp?states=nt"
			break
		case "3":
			document.location.href = "states.asp?states=qld"
			break
		case "4":
			document.location.href = "states.asp?states=sa"
			break
		case "5":
			document.location.href = "states.asp?states=vic"
			break
		case "6":
			document.location.href = "states.asp?states=wa"
			break
		case "7":
			document.location.href = "featuresearch.asp"
			break
		case "8":
			document.location.href = "plantrip.asp"
			break
		case "9":
			document.location.href = "sponsors.asp"
			break
		case "10":
			document.location.href = "https://secure.contact.com.au/members/voucher.aspx"
			break
		case "11":
			document.location.href = "holidaypass.asp"
			break
		case "12":
			document.location.href = "https://secure.contact.com.au/members/join.aspx"
			break
		case "13":
			document.location.href = "https://secure.contact.com.au/members/renew.aspx"
			break
		case "14":
			document.location.href = "clubaddress.asp"
			break	
		case "15":
			document.location.href = "directory.asp"
			break	
		case "16":
			document.location.href = "memberlogin.asp"
			break
		case "17":
			document.location.href = "http://www.mhia.com.au"
			break
		case "18":
			document.location.href = "http://www.magshop.com.au/Top_Tourist.htm?AID=11580"
			break
		case "19":
			document.location.href = "contact.asp"
			break	
		case "20":
			document.location.href = "https://secure.contact.com.au/members/join_platinum.aspx"
			break														
	}
}

function checkFields_order(theform) 
{
	if (theform.Cards.checked == 1) 
	{
		if(trimit(theform.CardsTxt.value) == "") 
		{
			alert("Please enter The Number of Cards you require.");
			theform.CardsTxt.focus();
			return false;
		}
		
	}
	
	if (theform.Passes.checked == 1) 
	{	
		if(trimit(theform.PassesTxt.value) == "") 
		{
			alert("Please enter The Number of Holiday Passes you require.");
			theform.PassesTxt.focus();
			return false;
		}
		
	}
	
	if (theform.Dir.checked == 1) 
	{
		if(trimit(theform.DirTxt.value) == "") 
		{
			alert("Please enter The Number of Directories you require.");
			theform.DirTxt.focus();
			return false;
		}
		
	}

	if (theform.Flag.checked == 1) 
	{
		if(trimit(theform.FlagTxt.value) == "") 
		{
			alert("Please enter The Number of Corporate Flags you require.");
			theform.FlagTxt.focus();
			return false;
		}
		
	}
	if (theform.EntSingle.checked == 1) 
	{
		if(trimit(theform.EntSingleTxt.value) == "") 
		{
			alert("Please enter The Number of Single Sided Metal Entrance Signs you require.");
			theform.EntSingleTxt.focus();
			return false;
		}
		
	}
	if (theform.EntDouble.checked == 1) 
	{
		if(trimit(theform.EntDoubleTxt.value) == "") 
		{
			alert("Please enter The Number of Double Sided Metal Entrance Signs you require.");
			theform.EntDoubleTxt.focus();
			return false;
		}
		
	}
	
	
	return false;
}
/*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_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_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_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 showHideLayers(layers)
{
	var obj = document.getElementById("news");
	switch(layers)
	{
		case "ohs":
			obj.innerHTML = "<font color='yellow'><b>OH&S / BUSINESS MANAGEMENT SYSTEM</b></font><p /><font color='white'>The OH&S/Business Management System is a complete management system that will markedly improve business performance, encourage Best Practice and meet OH&S Compliance by providing tasks that are required to be completed and signed-off within pre-established timeframes. The System incorporates..</font><p /><ul><li style='color:#FFFFFF'>The Organisation&rsquo;s daily compliance issues, scheduled tasks and activities</span></li><li style='color:#FFFFFF'>A daily print-off of allocated jobs and specific instructions for individual staff and/or contractors </span></li><li style='color:#FFFFFF'>Ongoing tasks that can be planned and entered years in advance or one-off jobs for tomorrow </span></li><li style='color:#FFFFFF'>An Assets Register that calculates depreciation on a daily basis </span></li><li style='color:#FFFFFF'>A Machinery/Equipment maintenance Register and Break Down/Tagging Register </span></li><li style='color:#FFFFFF'>OH&S reports that monitor the control and/or elimination of workplace hazards</span></li><li style='color:#FFFFFF'>The necessary evidence in defence of a negligence claim</span></li><li style='color:#FFFFFF'>A log that breaks down all entries into individual records, which are backed-up daily</span></li></ul><br><br><font color='yellow'>If you are interested, please contact Tubal on Tel: (08) 9246 2340, Fax: (08) 6210 1108 <br>OR Email:</font><a href='mailto:info@tubal.com.au'><font color='#FFFFFF'>info@tubal.com.au</font></a></font>"
			break;
		case "ohsmanual":
			obj.innerHTML = "<font color='yellow'><b>OH&S MANAGEMENT MANUAL</b></font><p /><font color='white'>The OH&S Management Manual is an indexed educational 500 page, 21 chapters resource for the use of general staff and management training, OH&S induction and ongoing training, formal qualification for staff/management and Traineeships<br><br><font color='yellow'>If you are interested, please contact Tubal on Tel: (08) 9246 2340, Fax: (08) 6210 1108 <br>OR Email:</font><a href='mailto:info@tubal.com.au'><font color='#FFFFFF'>info@tubal.com.au</font></a></font><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>"
			break;
		case "bizAdmin":
			obj.innerHTML = "<font color='yellow'><b>BUSINESS ADMIN</b></font><p /><font color='white'>Business Administration enables Organisations to allocate desired components of the System to managers and staff through individual Log-ons and Passwords<br><br><font color='yellow'>If you are interested, please contact Tubal on Tel: (08) 9246 2340, Fax: (08) 6210 1108 <br>OR Email:</font><a href='mailto:info@tubal.com.au'><font color='#FFFFFF'>info@tubal.com.au</font></a></font><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>"
			break;
		case "staff":
			obj.innerHTML = "<font color='yellow'><b>STAFF FILE</b></font><p /><font color='white'>The Human Resource component provides...</font><p /><ul><li style='color:#FFFFFF'>Individual staff files</span></li><li style='color:#FFFFFF'>Organisational policies, procedures and codes of practice</span></li><li style='color:#FFFFFF'>Training plans</span></li><li style='color:#FFFFFF'>Staff and management performance evaluations</span></li><li style='color:#FFFFFF'>OH&S and workplace induction training</span></li><li style='color:#FFFFFF'>Formal qualification and General management/staff training</span></li></ul><br><br><font color='yellow'>If you are interested, please contact Tubal on Tel: (08) 9246 2340, Fax: (08) 6210 1108 <br>OR Email:</font><a href='mailto:info@tubal.com.au'><font color='#FFFFFF'>info@tubal.com.au</font></a></font>"
			break;
		case "accredit":
			obj.innerHTML = "<font color='yellow'><b>ONLINE ACCREDITATION</b></font><p /><font color='white'>Online Accreditation enables Organisations to achieve Quality Accreditation through a succinct, uncomplicated process, which comprises of...</font><p /><ul><li style='color:#FFFFFF'>Self assessment checklist</span></li><li style='color:#FFFFFF'>Questionnaire, that when completed will enable the Organisation's Business, Marketing and Environmental Plans to be produced. These are essential components of Quality Accreditation</span></li><li style='color:#FFFFFF'>Access to the required Human Resource components</span></li><li style='color:#FFFFFF'>Workplace OH&S and risk management inspection checklist and required processes</span></li><li style='color:#FFFFFF'>Access to the Compliance Management System</span></li><li style='color:#FFFFFF'>Final Accreditation acceptance sign-off</span></li></ul><br><br><font color='yellow'>If you are interested, please contact Tubal on Tel: (08) 9246 2340, Fax: (08) 6210 1108 <br>OR Email:</font><a href='mailto:info@tubal.com.au'><font color='#FFFFFF'>info@tubal.com.au</font></a></font><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>"
			break;	
		case "job":
			obj.innerHTML = "<font color='yellow'><b>JOB DESCRIPTION</b></font><p /><font color='white'>The Job Descriptions meet the National Competency Standards, therefore, do not only satisfy arbitration issues, but also, offer employees the opportunity to transfer their workplace competency into formal Qualifications.  The Job Descriptions take moments to produce, simply tick the required competencies, then apply and print the results<br><br><font color='yellow'>If you are interested, please contact Tubal on Tel: (08) 9246 2340, Fax: (08) 6210 1108 <br>OR Email:</font><a href='mailto:info@tubal.com.au'><font color='#FFFFFF'>info@tubal.com.au</font></a></font><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>"			
			break;
		case "accident":
			obj.innerHTML = "<font color='yellow'><b>ACCIDENT REPORTING</b></font><p /><font color='white'>The Accident Reporting meets National OH&S and accident reporting procedures through access to employer/ employee reporting documentation, respective insurance companies and State reporting procedures and addresses for both soft and hard copy<br><br><font color='yellow'>If you are interested, please contact Tubal on Tel: (08) 9246 2340, Fax: (08) 6210 1108 <br>OR Email:</font><a href='mailto:info@tubal.com.au'><font color='#FFFFFF'>info@tubal.com.au</font></a></font><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>"					
			break;
		case "audit":
			obj.innerHTML = "<font color='yellow'><b>AUDITTING</b></font><p /><font color='white'>The OH&S Auditing provides access to the Organisation's photo/documented OH&S risk management plan & report, insurance risk management photo report and an Organisational OH&S risk assessment template<br><br><font color='yellow'>If you are interested, please contact Tubal on Tel: (08) 9246 2340, Fax: (08) 6210 1108 <br>OR Email:</font><a href='mailto:info@tubal.com.au'><font color='#FFFFFF'>info@tubal.com.au</font></a></font><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>"
			break;
	}
}
function RecoverLayers()
{
	var obj = document.getElementById("news");
	obj.innerHTML = "<font color='yellow'><b>INTRODUCTION</b></font><p /><font color='white'> Tubal's Compliance Management System is a Nationally unique web based quality management concept, which has taken some 3 years to develop. Tubal and Contact have sponsored components of the System to Top Tourist members as a means of management support as well as providing members with the opportunity to assess the System first hand.</font><p /><font color='white'>By implementing the System, Parks will meet ALL the components of Accreditation,will comply with new OH&S Legislation (meets AS/NZS OH&S Systems 4801), attract lower insurance premiums, be able to adopt existing or change policies procedures and codes of practice, establish training plans for staff and management, run induction training, conduct Traineeships, or gain formal Caravan Park Qualifications.?More importantly, Parks will be able to apply a Quality Management System that will log all entries and can be viewed and controlled anywhere in the world. For further information Click <a href='tubal_brochure.pdf'><font color='yellow'>Here</a> to view our brochure or please don't hesitate to contact us if you require further information.</span><br><br><font color='yellow'>If you are interested, please contact Tubal on Tel: (08) 9246 2340, Fax: (08) 6210 1108 <br>OR Email:</font><a href='mailto:info@tubal.com.au'><font color='#FFFFFF'>info@tubal.com.au</font></a></font><p>&nbsp;</p><p>&nbsp;</p>"
}

function checkFields_membersearch(theform) 
{
	if(theform.Name.value == "") 
	{
		alert("Please enter a Surname.");
		theform.Name.focus();
		return (false);
	}
	if(theform.Suburb.value == "" & theform.Postcode.value == "") 
	{
		alert("Please enter a Town/Suburb or Postcode.");
		theform.Suburb.focus();
		return (false);
	}	
}
function lanchek()
{
	var names = document.getElementById("names");
	var org = document.getElementById("org");
	var email = document.getElementById("email");
	var subject = document.getElementById("subject");
	var comments = document.getElementById("comments");
	if(names.value=="" || org.value=="" || email.value=="" || subject.value=="" || comments.value=="")
	{
		alert("Some of the new topic fields have not been filled out yet.");
		return false;
	}
	else
	{
		var url= "languagelookup.asp?names=" + names.value + "&org=" + org.value + "&email=" + email.value + "&subject=" + subject.value + "&comments=" + comments.value
		divid = "warnings"
		xmlHttp=GetXmlHttpObject(stateChanged)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
		if(forlan != "good")
		{
			forlan = "";
			return false;
		}
	}
	return true;
}
function reply(msgid)
{
	document.getElementById("replyarea").innerHTML="<hr><div id='warnings'></div><table><tr><td align='left'>Your name:</td><td align='left'><input type='text' id='names' name='names' class='compstyle'></td></tr><tr><td align='left'>Organisation:</td><td align='left'><input type='text' id='org' name='org' class='compstyle'></td></tr><tr><td align='left'>Your email address:</td><td align='left'><input type='text' id='email' name='email' class='compstyle'></td></tr><tr><td align='left'>Subject:</td><td align='left'><input type='text' id='subject' name='subject' class='compstyle'></td></tr><tr><td valign='top' align='left'>Your comments:</td><td align='left'><textarea id='comments' name='comments' COLS=60 ROWS=8 class='compstyle'></textarea></td></tr><tr><td>&nbsp;</td><td><INPUT TYPE='submit' VALUE='Submit' name='save' class='compstyle'><INPUT TYPE='reset' VALUE='Reset' class='compstyle'></td></tr></table>"	
}
function reumes(groups)
{
	//alert(groups)
	var url= "resumelookup.asp?group=" + groups
	divid = "resumelist"
	xmlHttp=GetXmlHttpObject(stateChanged)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)	
}
function eventform()
{
	document.getElementById("eventform").innerHTML = "<!--#include file='../../../seccgi/contact/add-calSQL.inc' -->"
}
function threads(msgid)
{
	//document.getElementById("headimg").innerHTML = "<img src='images/head"+ rand(10) +".jpg' />"
	var url= "threadslookup.asp?msgid=" + msgid
	divid = "threads"
	xmlHttp=GetXmlHttpObject(stateChanged)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}
function parksearch(states,booknow)
{
	switch(states.toLowerCase())
	{
		case "nsw":
			document.getElementById("headimg").innerHTML = "<img src='images/head15.jpg' width='750' height='289'/>"
			break
		case "nt":
			document.getElementById("headimg").innerHTML = "<img src='images/head16.jpg' width='750' height='289'/>"
			break
		case "qld":
			document.getElementById("headimg").innerHTML = "<img src='images/head20.jpg' width='750' height='289'/>"
			break
		case "sa":
			document.getElementById("headimg").innerHTML = "<img src='images/head22.jpg' width='750' height='289'/>"
			break
		case "vic":
			document.getElementById("headimg").innerHTML = "<img src='images/head23.jpg' width='750' height='289'/>"			
			break
		case "wa":
			document.getElementById("headimg").innerHTML = "<img src='images/head24.jpg' width='750' height='289'/>"			
			break
	}
	if(booknow != "")
	{
		document.getElementById("lbooknow").innerHTML = "<a href='"+ booknow +"'><img src='images/booknow.gif' border=0 /></a>"
		document.getElementById("lbooknow").style.visibility = 'visible'
	}

	var url= "parkslookup.asp?states=" + states
	divid = "parks"
	xmlHttp=GetXmlHttpObject(stateChanged)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
	//alert(states)
}

function headerimgs(pics)
{
	document.getElementById("headimg").innerHTML = "<img src='images/"+ pics +"' width='750' height='289'/>"
	
}

function test(states)
{
	var i
	var submenus = "&nbsp;"
	var obj = document.getElementById("parklist")
	var parks = obj.options[obj.selectedIndex].value
	if(parks!="header1" && parks!="header2")
	{
		stringArray = parks.split("+")
		var town = stringArray[1]
		var park = stringArray[0]
		var keyid = stringArray[2]
		var booknow = stringArray[3]
		var iconsArray = stringArray[4].split("/")
		//alert(booknow.indexOf("none"))
		if(booknow.indexOf("none")<0)
		{
			document.getElementById("lbooknow").innerHTML = "<a href='"+ booknow +"'><img src='images/booknow.gif' border=0 /></a>"
			document.getElementById("lbooknow").style.visibility = 'visible'
		}
		else
		{
			document.getElementById("lbooknow").style.visibility = 'hidden'
		}
		document.getElementById("statparks").innerHTML = town + "  |  " + park
		
		for(i=0;i<iconsArray.length;i++)
		{
			if(iconsArray[i] != "")
				submenus = submenus + "<img src='images/ttpa_icons_" + iconsArray[i] + ".gif'>"
		}
		document.getElementById("submenus").innerHTML = ""
		document.getElementById("submenus").innerHTML = "<div id='insubmenus'>"+ submenus +"</div>"
		var url= "parkdetailslookup.asp?keyid=" + keyid + "&states=" + states
		divid = "pdetails"
		xmlHttp=GetXmlHttpObject(stateChanged)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
	}	
}

function test2(keyid, states, town, park, booknow,icons)
{
	var i
	var submenus = "&nbsp;"
	var iconsArray = icons.split("/")
	for(i=0;i<iconsArray.length;i++)
	{
		if(iconsArray[i] != "")
			submenus = submenus + "<img src='images/ttpa_icons_" + iconsArray[i] + ".gif'>"
	}
	document.getElementById("statparks").innerHTML = town + "  |  " + park
	document.getElementById("submenus").innerHTML = ""
	document.getElementById("submenus").innerHTML = "<div id='insubmenus'>"+ submenus +"</div>"
	if(booknow.indexOf("none")<0)
	{
		document.getElementById("lbooknow").innerHTML = "<a href='"+ booknow +"'><img src='images/booknow.gif' border=0 /></a>"	
		document.getElementById("lbooknow").style.visibility = 'visible'
	}
	else
	{
		document.getElementById("lbooknow").style.visibility = 'hidden'
	}
		
	var url= "parkdetailslookup.asp?keyid=" + keyid + "&states=" + states
	divid = "pdetails"
	xmlHttp=GetXmlHttpObject(stateChanged)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
}

function ReturnParkList(states)
{
	var obj = document.getElementById("townslist")
	var towns = obj.options[obj.selectedIndex].value
	document.location.href="states.asp?states="+states+"&towns="+towns 
	/*if(towns != "header1")
	{
		var url= "towndetailslookup.asp?town=" + towns + "&states=" + states
		divid = "pdetails"
		xmlHttp=GetXmlHttpObject(stateChanged)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)	
	}*/
}

function ReturnTC()
{
	var obj = document.getElementById("sts")
	states = obj.options[obj.selectedIndex].value
	//alert(states)
	if(states != "selects")
	{
		var url= "stateslookup.asp?states=" + states
		divid = "towns"
		xmlHttp=GetXmlHttpObject(stateChanged)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
	}
	else
	{
		document.getElementById("towns").innerHTML = "<select class='compstyle' style='width:180px;height:20px'><option>Select a Town/City</option></select>"
	}
} 

window.onload = function() 
{
	/*var divs = document.getElementById("tst1")
	divs.style.top=document.body.scrollTop+(document.body.offsetHeight-divs.offsetHeight)/2 
	divs.style.left=document.body.scrollLeft+(document.body.offsetWidth-divs.offsetWidth)/2*/
	/*var url= "bgimg.asp"
	divid = "headimg"
	xmlHttp=GetXmlHttpObject(stateChanged)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)*/
	$.preloadImages('images/head0.jpg','images/head1.jpg','images/head2.jpg','images/head3.jpg','images/head4.jpg','images/head5.jpg','images/head6.jpg','images/head7.jpg','images/head8.jpg');
	document.getElementById("headimg").innerHTML = "<img src='images/head"+ rand(8) +".jpg' width='750' height='289'/>";
	var domain = window.location.href;
	var splitDomain = domain.split("/")	
	var splitFile = splitDomain[3].split("?");
	if(splitFile[0] == "newcc.asp" || splitFile[0] == "addnewcc.asp")
	{
		var fdate1,fdate2,tdate1,tdate2,fdate4,tdate4
		fdate1  = new Epoch('fdate1','popup', document.getElementById('date_joined'),false);
		//tdate1  = new Epoch('tdate1','popup', document.getElementById('expiry_date'),false);
	}
}  

function checkFields() 
{
	var fromtown = document.getElementById("fromtown")
	var totown = document.getElementById("totown")
	var fromstate = document.getElementById("fromstate")
	var tostate = document.getElementById("tostate")
	var routetype = document.getElementById("routetype")
	var viatown = document.getElementById("viatown1")
	var viastate = document.getElementById("viastate1")
	var i = 0
	
	if(fromtown.value == "") 
	{
		alert("Please enter your start town.");
		i=1;
	}	
	if(totown.value == "") 
	{
		alert("Please enter your finish town.");
		i=1;		
	}	
	if(fromstate.options[fromstate.selectedIndex].value == "Select") 
	{
		alert("Please enter your start state.");
		i=1;		
	}
	if(tostate.options[tostate.selectedIndex].value == "Select") 
	{
		alert("Please enter your finish state.");
		i=1;		
	}
	if(i!=1)
	{
		var url= "triplookup.asp?fromtown="+fromtown.value+"&totown="+totown.value+"&fromstate="+fromstate.options[fromstate.selectedIndex].value+"&tostate="+tostate.options[tostate.selectedIndex].value +"&routetype="+routetype.options[routetype.selectedIndex].value+"&viastate="+viastate.options[viastate.selectedIndex].value+"&viatown="+viatown.value
		divid = "tripdetails"
		xmlHttp=GetXmlHttpObject(stateChanged)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
/*alert("<Iframe width='95%' height='2500' frameborder=0 scrolling='auto' MARGINWIDTH=10 SRC='http://www.nowwhereroute.com/contact/tripplanner/mappage.aspx?parkType=contact&fromTown="&fromtown.value&"&fromstate="&fromstate.options[fromstate.selectedIndex].value&"&viatown1="&viatown.value&"&viastate1="&viastate.value&"&totown="&totown.vlue&"&tostate="&tostate.options[tostate.selectedIndex].value&"&routeType="&routetype.options[routetype.selectedIndex].value&"'></Iframe>")	*/
	}
}

function checkClubAddress(theform) 
{
	if(trimit(theform.memno.value) > "") 
	{
		if(isNaN(theform.memno.value)) 
		{
			alert("Please enter a valid Top Tourist Membership Number.");
			theform.memno.focus();
			return (false);
		}
	}
	if(trimit(theform.name.value) == "") 
	{
		alert("Please enter your Name.");
		theform.name.focus();
		return (false);
	}
	if(trimit(theform.street.value) == "") 
	{
		alert("Please enter your New Street Address.");
		theform.street.focus();
		return (false);
	}
	if(trimit(theform.city.value) == "") 
	{
		alert("Please enter your New City.");
		theform.city.focus();
		return (false);
	}
	if(trimit(theform.state.value) == "") 
	{
		alert("Please enter your New State.");
		theform.state.focus();
		return (false);
	}
	if(trimit(theform.zip.value) == "") 
	{
		alert("Please enter your New Post Code or ZIP Code.");
		theform.zip.focus();
		return (false);
	}
	else
	{
		if(isNaN(theform.zip.value)) 
		{
			alert("Please enter a valid Post Code or ZIP Code.");
			theform.zip.focus();
			return (false);
		}
	}
	if(trimit(theform.oldstreet.value) == "") 
	{
		alert("Please enter your OLD Street Address.");
		theform.oldstreet.focus();
		return (false);
	}
	if(trimit(theform.oldcity.value) == "") 
	{
		alert("Please enter your OLD City.");
		theform.oldcity.focus();
		return (false);
	}
	if(trimit(theform.oldstate.value) == "") 
	{
		alert("Please enter your OLD State.");
		theform.oldstate.focus();
		return (false);
	}
	if(trimit(theform.oldzip.value) == "") 
	{
		alert("Please enter your OLD Post Code or ZIP Code.");
		theform.oldzip.focus();
		return (false);
	}
	else
	{
		if(isNaN(theform.oldzip.value)) 
		{
			alert("Please enter a valid OLD Post Code or ZIP Code.");
			theform.oldzip.focus();
			return (false);
		}
	}
	return (true);
}

function trimit(input)
{
  var lre = /^\s*/;
  var rre = /\s*$/;
  input = input.replace(lre, "");
  input = input.replace(rre, "");
  return input;
}

function stateChanged()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
		if(divid == "headimg")
			document.getElementById(divid).innerHTML="<img src='images/head"+ xmlHttp.responseText +".jpg'>"
		else
		{
			if(xmlHttp.responseText=="good")
				forlan = xmlHttp.responseText
			else
		        document.getElementById(divid).innerHTML=xmlHttp.responseText
		}
			
    }
}

function GetXmlHttpObject(handler)
{
    var objXmlHttp=null
 
    if (navigator.userAgent.indexOf("Opera")>=0)
    {
        alert("Opera not supported...")
        return;
    }
    if (navigator.userAgent.indexOf("MSIE")>=0)
    {
        var strName="Msxml2.XMLHTTP"
        if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
        {
            strName="Microsoft.XMLHTTP"
        }
        try
        {
            objXmlHttp=new ActiveXObject(strName)
            objXmlHttp.onreadystatechange=handler
            return objXmlHttp
        }
        catch(e)
        {
            alert("Error. Scripting for ActiveX might be disabled")
            return
        }
    }
    if (navigator.userAgent.indexOf("Mozilla")>=0)
    {
        objXmlHttp=new XMLHttpRequest()
        objXmlHttp.onload=handler
        objXmlHttp.onerror=handler
        return objXmlHttp
    }
} 