
	/*
	
	The Snowville Inn
	august 4 2011
	
	
	
	
	*/
	
	

	
	
	
	
	function changePic(img_name, img_src){
		document.getElementById(img_name).src=img_src;
	}
	
	
		
	
	
	
	
	function ranNum(uNum) {
		var nRan = new Number();
		uNum = Number(uNum);
		//generate random between 1 and uNum
		nRan=Math.floor( (Math.random()*uNum) + 1);
		return nRan;
	}
	
	
	
	
	
	
	
	
	
	
	
	
		
	//handles the checkboxes and using words to interact with.
	function clickCB(strCB) {
		//document.getElementById(strCB).focus()
		if(document.getElementById(strCB).checked) {
			document.getElementById(strCB).checked = false;
		} else {
			document.getElementById(strCB).checked = true;	
		}	
		///document.getElementById(strCB).Blur()
	}






	
	
	
	function verifyZipCodeLength(sBoxName, sZip) {
		if (sZip.length < 5) {
			alert("the Zip-code length needs to be five digits");
			document.getElementById(sBoxName).focus();
		} else {
			return true;
		}
	}
	

	
	
	
	function verifyBasicValue(sBox, sValueNot, sAlert)  {	
					
					if(document.getElementById(sBox).value.charCodeAt(0) == 32 && document.getElementById(sBox).value.length == 1){
						//sends error if the first character is a [space] 
						//need to adjust so that it strips each and every leading " " before it checks values.....
						alert(sAlert);
						document.getElementById(sBox).value = '';
						document.getElementById(sBox).focus();
						return false;
					} else if(!document.getElementById(sBox).value == sValueNot) {
						return true;
					} else {
						alert(sAlert);
						document.getElementById(sBox).focus();
						return false;		
					}
						
	}	
	
	
	function checkEmailBox(str) {
				//quick check for a . and an @ that are at the least not the first character...
				return (str.indexOf(".") > 0) && (str.indexOf("@") > 0);
			}
	

	
	
	
	
	function showHideADiv(sDiv, sDisplay) {

		if (document.all) { //IS IE 4 or 5 (or 6 beta)
			eval( "document.all." + sDiv + ".style.display = sDisplay");
		}
		if (document.layers) { //IS NETSCAPE 4 or below
			document.layers[sDiv].display = sDisplay;
		}
		if (document.getElementById && !document.all) {
			hza = document.getElementById(sDiv);
			hza.style.display = sDisplay;
		}
	}



	function showByDropDown(sDivSection, bVal){
		if(bVal == 1) {
			showHideADiv(sDivSection, 'block');
		} else {
			showHideADiv(sDivSection, 'none');
		}
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	function checkMLform() {
			if( checkEmailBox(document.getElementById('tE').value) ) {
				if(verifyBasicValue('tFN', '', 'Please provide Your First Name prior to hitting the join button.') ) {
				if(verifyBasicValue('tLN', '', 'Please provide Your Last Name prior to hitting the join button.') ) {
				if(verifyBasicValue('tA1', '', 'Please provide Your Address prior to hitting the join button.') ) {
				if(verifyBasicValue('tC', '', 'Please provide Your City prior to hitting the join button.') ) {
				if(verifyBasicValue('tS', '', 'Please provide Your State prior to hitting the join button.') ) {
				if(verifyBasicValue('tZ', '', 'Please provide Your Zip Code prior to hitting the join button.') ) {
				
					document.getElementById('frmMailingList').submit();
				
				}
				}
				}
				}
				}
				}
			} else {
				alert("Please provide a proper Email Address before hitting the join button.");
				document.getElementById('tE').focus();
			}										
			
	}
	

	
	
	
	function closeML() {
		hide('dJoinML');
	}
	
	function showML() {
		show('dJoinML');
	}
	
	/*   NAVIGATION */
	
	
	
function hide(id) {
	document.getElementById(id).style.display = 'none'; 
}

function show(id) {
	document.getElementById(id).style.display = 'block'; 
}

function hideAll() {
	hide("subnav_home");	
	hide("subnav_accomm");
	hide("subnav_reservations");
	hide("subnav_weddings");
	hide("subnav_dining");
	hide("subnav_directions");
	hide("subnav_about");
}

function showHome() {

	show("subnav_home");
	
	hide("subnav_accomm");
	hide("subnav_reservations");
	hide("subnav_weddings");
	hide("subnav_dining");
	hide("subnav_directions");
	hide("subnav_about");

}

function showAccom() {
	show("subnav_accomm");

	hide("subnav_home");
	hide("subnav_reservations");
	hide("subnav_weddings");
	hide("subnav_dining");
	hide("subnav_directions");
	hide("subnav_about");	
}

function showRates() {

	show("subnav_reservations");

	hide("subnav_home");
	hide("subnav_accomm");
	hide("subnav_weddings");
	hide("subnav_dining");
	hide("subnav_directions");
	hide("subnav_about");
}


function showWeddings() {

	show("subnav_weddings");

	hide("subnav_home");
	hide("subnav_reservations");
	hide("subnav_accomm");
	hide("subnav_dining");
	hide("subnav_directions");
	hide("subnav_about");
}

function showDining() {

	show("subnav_dining");

	hide("subnav_home");
	hide("subnav_reservations");
	hide("subnav_accomm");
	hide("subnav_weddings");
	hide("subnav_directions");
	hide("subnav_about");
}

function showDirections() {
	show("subnav_directions");

	hide("subnav_home");
	hide("subnav_reservations");
	hide("subnav_accomm");
	hide("subnav_weddings");
	hide("subnav_dining");
	hide("subnav_about");
}


function showAbout() {
	show("subnav_about");

	hide("subnav_home");
	hide("subnav_reservations");
	hide("subnav_accomm");
	hide("subnav_weddings");
	hide("subnav_dining");
	hide("subnav_directions");
	
}
