$(document).ready(function(){

	$("#topNavContainer .topNav").hover(function(){
		($(this).children("a")).css("color","#63390c");
		$(this).addClass("hover");
	},function(){
		($(this).children("a")).css("color","white");
		$(this).removeClass("hover");
	});
	
	$("#topNavContainer .subTopNav li").hover(function(){	
		($(this).children("a")).css("background-color","#756242");	
		$(this).addClass("hover");
	},function(){		
		($(this).children("a")).css("background-color","");	
		$(this).removeClass("hover");
	});

	if($.browser.msie && jQuery.browser.version < 7) 
	{ 	
		$(function() {
			$("#topNavContainer .subTopNav").css("top","26px");
		} ); 		
	}
	
	if($.browser.safari) 
	{ 	
		$(function() {
			$("#topNavContainer .subTopNav .subSubTopNav").css("top","-22px");
		} ); 		
	}

	//$('.pics').cycle('fade');

//	$('.top_half').media( { width: 815, height: 400, autoplay: true, bgColor: ''} );
			
});

function validateNumber(sFormName, field)
{
	var val = eval("document."+sFormName+"."+field+".value");
	if(!/^\d*$/.test(val)||val==0) {
    	alert("Please enter numbers greater than zero." );
		eval("document."+sFormName+"."+field+".focus()");
		eval("document."+sFormName+"."+field+".select()");
  	}
}
/*
function makeBooking() {
		var popup = window.open('https://wic019u.server-secure.com/vs217838_secure/check_availability.asp','popupBooking','height=600,width=800,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,screenX=0,screenY=50,left=0,top=50,resizable=yes');
}

function makeNEWBooking() {
		var popup = window.open('https://wic019u.server-secure.com/vs217838_secure/step1.asp?action=cancel','NEWpopupBooking','height=700,width=800,menubar=no,scrollbars=yes,status=no,toolbar=no,screenX=0,screenY=50,left=0,top=50,resizable=yes');
}*/

function makeBooking() {
		/*var popup = window.open('https://wic019u.server-secure.com/vs217838_secure/step1.asp?action=cancel','NEWpopupBooking','height=700,width=800,menubar=no,scrollbars=yes,status=no,toolbar=no,screenX=0,screenY=50,left=0,top=50,resizable=yes');*/
		var popup = window.open('https://www.roamfree.com/bookdirect/Availability.aspx?from=03-Jan-2009&dtl=True&ap=102641&currID=1&n=2&sortby=3&cID=&tooltip=False','NEWpopupBooking','height=700,width=800,menubar=no,scrollbars=yes,status=no,toolbar=no,screenX=0,screenY=50,left=0,top=50,resizable=yes');
}

//go to booking pages with specialID
function bookSpecial(iSpecialID) {
	/*var popup = window.open('https://wic019u.server-secure.com/vs217838_secure/check_availability.asp?fromSpecial=yes&specialChoice='+iSpecialID,'popupBooking','height=600,width=800,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,screenX=0,screenY=50,left=0,top=50,resizable=yes');*/
	var popup = window.open('https://www.roamfree.com/bookdirect/Availability.aspx?from=03-Jan-2009&dtl=True&ap=102641&currID=1&n=2&sortby=3&cID=&tooltip=False','popupBooking','height=600,width=800,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,screenX=0,screenY=50,left=0,top=50,resizable=yes');
}


function viewPhoto(url) {
	var winpopup = window.open(url,'popupPhoto','width=400,height=400,menubar=yes,scrollbars=yes,status=no,toolbar=no,screenX=0,screenY=50,left=0,top=50,resizable=yes');	
}


function SelectDefaultValue(id)
{
document.getElementById(id).focus();
document.getElementById(id).select();
}

function echeck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){return false}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==(lstr-1)){return false}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==(lstr-1)){return false}
	if (str.indexOf(at,(lat+1))!=-1){return false}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){return false}
	if (str.indexOf(dot,(lat+2))==-1){return false}
	if (str.indexOf(" ")!=-1){return false}
}

function checkEmailToSend() {
	var email = document.getElementById("emailtosend").value;	
				
	var errMsg = "";

	if (email == "")	{
		errMsg += " - Your email address\n";
	}
	if (email != "") 	{
		if (echeck(email)==false)	{
			errMsg += " - a valid email address\n";
		}
	}

	if (errMsg != "")	{
		errMsg = "Please enter following fields:\n\n" + errMsg;
		alert(errMsg);
		return false;
	}
	else	{
		document.sendConferenceKitForm.submit();
	}
 }
