function startList()
	{
	if (document.getElementById) 
		{
		navRoot = document.getElementById("menu");
		for (i=0; i<navRoot.childNodes.length; i++) 
			{
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") 
				{					
				node.onmouseover=function(){this.className+=" over"}
				node.onmouseout =function(){this.className=this.className.replace(" over", "")}
				for (j=0; j<node.childNodes.length;j++){node2=node.childNodes[j];if (node2.nodeName=="A"){if (node2.href==location.href)node2.className="focus"}}
				}
			}
				
		theObjects = document.getElementsByTagName("object");
		for (var i = 0; i < theObjects.length; i++) {theObjects[i].outerHTML = theObjects[i].outerHTML;}
		}
	}

function trimString(str)
	{str=this!=window?this:str;return str.replace(/^\s+/g,'').replace(/\s+$/g,'');}

function flash_movie()
	{
	if (document.all)
	{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="700" height="200" id="movie" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="/images/movie.swf" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#ffffff" />');
	document.write ('<param name="wmode" value="transparent"/>')
	document.write('<embed src="/images/movie.swf" quality="high" bgcolor="#ffffff" width="700" height="200" name="movie" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
	}
	else
	{
   document.write ('<object type="application/x-shockwave-flash" data="/images/movie.swf" id=movie width="700" height="200">')
	document.write ('<param name="movie" value="/images/movie.swf"/>')
	document.write ('<param name="wmode" value="transparent"/>')
	document.write ('</object>') 
	}
	}

function obr(a,b,c){win=window.open(a,b,c)}
function image(img){obr('/gallery_pop.asp?img='+img,'pop','resizable=1,scrollbars=1,width=800,height=600')}

function contact()
	{
	empty = false;
	fm 	= document.details;
	checker(fm.yname,"You must enter your Name");
	//checker(fm.address,"You must enter the first line of your address");
	//checker(fm.town,"You must enter the town or city");
	//checker(fm.pcode,"You must enter your Post Code");
	checker(fm.tel,"You must enter a telephone number");
	email_validator(fm.email)
	if (empty == false){fm.submit()}
	}

function page()
	{
	empty=false;fm=document.page;
	checker(fm.heading,"The page must have a heading");
	checker(fm.content,"Your content must not be blank");
	if (empty == false){fm.submit()}
	}
	
function login()
	{
	empty=false;fm=document.members
	checker(fm.userid,'The user name must not be blank');checker(fm.password,'The password must not be blank')
	if(empty==false){fm.submit()}
	}
	
function cevent()
	{
	empty = false;
	fm 	= document.details;
	checker(fm.heading,"You must enter an event heading");
	checker(fm.location,"You must enter an event location");
	checker(fm.contact,"You must enter some contact details");
	if (empty == false){fm.submit()}
	}

function attraction()
	{
	empty = false;
	fm 	= document.details;
	checker(fm.heading,"You must enter an event heading");
	checker(fm.info,"You must enter a brief description");
	if (empty == false){fm.submit()}
	}
	
function news()
	{
	empty = false;
	fm 	= document.details;
	checker(fm.heading,"You must enter a heading");
	checker(fm.content,"You must enter an article");
	if (empty == false){fm.submit()}
	}

function checker(obj,msg){if(obj.value=="" && empty==false){alert(msg);empty=true;obj.focus()}}

function delete_event(id)
	{ok=window.confirm('Click OK to delete this record');if (ok==true){location.href=('?u=2&id='+id)}}

function delete_attraction(id,i)
	{ok=window.confirm('Click OK to delete this record');if (ok==true){location.href=('?u=2&img='+i+'&id='+id)}}

function delete_news(id,i)
	{ok=window.confirm('Click OK to delete this record');if (ok==true){location.href=('?u=4&img='+i+'&id='+id)}}

	
//Email Validator Functions
function email_validator(obj)
	{
	var emailStr=obj.value;var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)!£$%^&*()+='#~?<>@,;:\\\\\\\"\\.\\[\\]";var validChars="\[^\\s" + specialChars + "\]";var quotedUser="(\"[^\"]*\")";var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+';var word="(" + atom + "|" + quotedUser + ")";var userPat=new RegExp("^" + word + "(\\." + word + ")*$");var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");var matchArray=emailStr.match(emailPat)
	if ((matchArray==null) && empty==false){message("Email address seems incorrect (check @ and .'s)",obj)}
	if (empty==false){var user=matchArray [1];var domain=matchArray [2];if (user.match(userPat)==null){message("The username doesn't seem to be valid.",obj)}}
	if (empty==false){var IPArray=domain.match(ipDomainPat);if (IPArray!=null){for (var j=1;j<=4;j++){if (IPArray[j]>255){message("Destination IP address is invalid!",obj)}}}}
	if (empty==false){var domainArray=domain.match(domainPat);if (domainArray==null){message("The domain name doesn't seem to be valid.",obj)}}
	if (empty==false){var atomPat=new RegExp(atom,"g");var domArr=domain.match(atomPat);var len=domArr.length;if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3){message("The address must end in a three-letter domain, or two letter country.",obj)}}
	if ((len<2) && empty==false){message("This address is missing a hostname!",obj)}
	}
function message(msg,obj){alert(msg);empty=true;obj.focus()}
// End Email Validator Functions
//==============================

function formatNumber(myNum,numOfDec)
   {
  var decimal = 1
  for(i=1; i<=numOfDec;i++){decimal = decimal *10}
  var myFormattedNum = (Math.round(myNum * decimal)/decimal).toFixed(numOfDec)
  return(myFormattedNum)
   } 

function calc()
	{
	tot=0;
	for (var a=0;a<5;a++)
		{
		l=eval('document.details.line'+a);q=eval('document.details.qty'+a);p=eval('document.details.price'+a);pr=eval('document.details.prod'+a)
		if(l.value!=""){s=l.value*q.value;p.value=formatNumber(s,2);tot=tot+s;pr.value=l.options[l.selectedIndex].text}
		}
		document.details.total.value=formatNumber(tot,2)
	}
	
function get_days()
	{
	fm=document.details;a=new Date(fm.sy.options[fm.sy.selectedIndex].text,fm.sm.options[fm.sm.selectedIndex].value,0);b=a.getDate();fm.sd.options.length=b;for(x=0;x<b;x++){fm.sd.options[x].text=x+1}
	}

function get_days2()
	{
	fm=document.details;a=new Date(fm.ey.options[fm.ey.selectedIndex].text,fm.em.options[fm.em.selectedIndex].value,0);b=a.getDate();fm.ed.options.length=b;for(x=0;x<b;x++){fm.ed.options[x].text=x+1}
	}


window.onload=startList
