// JavaScript Document

// Hide/Show  Marina Tariff
function hideShowNav(idName) {
	elemntRow = document.getElementById(idName);
	if ( elemntRow.style.display == "block" ) {
		elemntRow.style.display = "none";
	} else {
		hideAll();	
		elemntRow.style.display = "block";		
	}
}
function hideAll() {
		document.getElementById("childNav").style.display = "none"
//		document.getElementById("childNav2").style.display = "none"
}

// Hide/Show  Marina View
function hideShowMar(idName) {
	elemntRow = document.getElementById(idName);
	if ( elemntRow.style.display == "block" ) {
		elemntRow.style.display = "none";
	} else {
		hideAllMar();	
		elemntRow.style.display = "block";		
	}
}
function hideAllMar() {
		document.getElementById("childNav2").style.display = "none"
}

// Client side email validation
function validateform()
{
	    if (document.contactForm.frmName.value.length < 1)
	        {
	        alert("You have forgotton to enter your name.")
	        document.contactForm.frmName.focus()
			return false;
		}
		
	    if (document.contactForm.frmEmail.value.length < 1)
	        {
	        alert("Please enter your email address")
	        document.contactForm.frmEmail.focus()
	        return false;
	     }
		 
	    if (document.contactForm.frmEmail.value.length > 0)
	        {
				if (document.contactForm.frmEmail.value.indexOf("@",0) == - 1 || document.contactForm.frmEmail.value.indexOf(".",0) == - 1)
				{
				alert("Your email address is not valid. Please enter a valid email address")
				document.contactForm.frmEmail.focus()
				return false;
				}
	        }
			
		if (document.contactForm.frmComments.value.length < 1)
	        {
	        alert("Tell us why you are contacting us")
	        document.contactForm.frmComments.focus()
			return false;
		}	
	return true;
}

// Used for map
imgMapZoomIn=new Image();
imgMapZoomIn.src="/images/general_images/map_zoom_in.gif" ;

function swapImage() {
	elemntImg = document.getElementById("map");
	if ( elemntImg.src.indexOf("/images/map_far.gif" ) != -1 ) {
		elemntImg.src = "/images/map_close.gif";
	} else {
		elemntImg.src = "/images/map_far.gif";
	}
}

