var visibleVar="null";

		if (navigator.appName == "Netscape") {
			layerStyleRef="layer.";
			layerRef="document.layers";
			styleSwitch="";
			visibleVar="show";
		}else{
			layerStyleRef="layer.style.";
			layerRef="document.all";
			styleSwitch=".style";
			visibleVar="visible";
		}

		function showLayer(layerName){
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.display="block"');
		}

		function hideLayer(layerName){
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.display="none"');
		}


		function zmena()
		{
		
			if (document.calform.oneWay.checked == true)
			{
			hideLayer("oneway");
			hideLayer("oneway2");
			hideLayer("oneway3");
			}
			else
			{
			showLayer("oneway");
			showLayer("oneway2");
			showLayer("oneway3");
			}
		}

	function addDays(myDate,days)
		{
			return new Date(myDate.getTime() + days*24*60*60*1000);
		}

		function den(pocet,jmeno)
		{
			now = addDays(new Date(),pocet);
			dName = now.getDate();
			document.write ("<Select name='"+jmeno+"' style='width:50' class='inputbox'>")
			for (od=1; od<32; od++)
			{
				od = String(od);
				if ((od.length) == 1)
					{odb = "0" + od}
				else
					{odb = od}
				document.write ("<option value=" + odb);
				if (dName == od) {
					document.write (" selected ");
				}
				document.write (">" + od + "</option>");
			}
			document.write ("</Select>")
		}

		function mesic(jmeno)
		{
			document.write ("<select name='"+jmeno+"' style='width=84;' class='inputbox'>")
				var yr, mMonth,mesicjm
				mMonth = now.getMonth();
				mMonth = mMonth + 1
				for (odm=1; odm < 13; odm++)
				{
					odmb = (odm + 1)
					odmb = String(odm);
					if ((odmb.length) == 1)
						{odmb = "0" + odm}
					else
						{odmb = odm}
					
					if (odmb == 01) {mesicjm = "Jan"}
					if (odmb == 02) {mesicjm = "Feb"}
					if (odmb == 03) {mesicjm = "Mar"}
					if (odmb == 04) {mesicjm = "Apr"}
					if (odmb == 05) {mesicjm = "May"}
					if (odmb == 06) {mesicjm = "Jun"}
					if (odmb == 07) {mesicjm = "Jul"}
					if (odmb == 08) {mesicjm = "Aug"}
					if (odmb == 09) {mesicjm = "Sep"}
					if (odmb == 10) {mesicjm = "Oct"}
					if (odmb == 11) {mesicjm = "Nov"}
					if (odmb == 12) {mesicjm = "Dec"}
					

					document.write ("<option value=" + odmb);
						if (mMonth == odm) {
							document.write (" selected ");}
					document.write (">" + mesicjm + "</option>");
				}
				document.write ("</select>")
				}

				function rok(jmeno)
				{
					yr = now.getFullYear();
					document.write ("<select name='"+jmeno+"' style='width=55' class='inputbox'>")
					for (odr = yr;odr < (yr+2); odr++)
					{
	   					document.write ("<option value="+odr+">"+odr+"</option>")
	   				}
	   				document.write ("</select>")
	   			}



				function FinishLoading(){
					hideLayer("oneway");
					hideLayer("oneway2");
					hideLayer("oneway3");
					hideLayer("span0");
					showLayer("span1");
				}



function validate(){

//***** VALIDATE EMAIL ADDRESS *****

	if (document.FB.email.value.length == 0) {
      	alert ("The 'Email' field requires a selection");
		document.FB.email.focus();
       	return false;
		}
		
invalidChars = " /:,;" ;									//check for invalid characters

	for (i=0; i < invalidChars.length; i++){
		badChar = invalidChars.charAt(i);
		if(document.FB.email.value.indexOf(badChar, 0) > -1) {
			alert ("The Email address entered does not appear to be valid. Please check it is correct.");
			document.FB.email.select();
			return false;
		}
	}	

atPos = document.FB.email.value.indexOf("@", 1);				//ensure there is an "@" sign in an  
																//acceptatble position in the email string
	if ( (atPos == -1 ) ||
		  (document.FB.email.value.indexOf("@", atPos + 1) > -1) ) 
		  {
		    alert ("The Email address does not appear to be valid. Please check it is correct.");
			document.FB.email.select();
			return false;
		  }
	
	periodPos = document.FB.email.value.indexOf(".", atPos);	//ensure there is a period "." in an
																//acceptable position in the email string
	if ( (periodPos == -1 ) ||
	     (periodPos + 3 > document.FB.email.value.length) )
	   {
		alert ("The Email address entered does not appear to be valid. Please check it is correct.");    
		document.FB.email.select();
		return false;
	   }
//***** END OF EMAIL VALIDATION *****

	if (document.FB.name.value.length == 0) {
      	alert ("The 'Name' field requires an entry");
		document.FB.name.focus();
       	return false;
		}
	
}
