window.name = "root"




function validateEmailForm()
{
	if (document.form1.toname.value == "")
	{
		alert("Please enter a TO name.");
		document.form1.toname.focus();
		return false;
	}
	else if (document.form1.toemail.value == "")
	{
		alert("Please enter a TO email address.");
		document.form1.toemail.focus();
		return false;
	}
	else if (document.form1.fromname.value == "")
	{
		alert("Please enter a FROM name.");
		document.form1.fromname.focus();
		return false;
	}
	else if (document.form1.fromemail.value == "")
	{
		alert("Please enter a FROM email address.");
		document.form1.fromemail.focus();
		return false;
	}
	else
	{
		return true;	
	}
}


function validateContactForm()
{
	if (document.form1.fromemail.value == "")
	{
		alert("Please enter a FROM email address.");
		document.form1.fromemail.focus();
		return false;
	}
	else if (document.form1.message.value == "")
	{
		alert("Please enter your message");
		document.form1.message.focus();
		return false;
	}
	else
	{
		return true;	
	}
}




function submitHeaderSearch()

{

	if (document.form1.header_search.value == "")

	{
		alert("You must enter Search Text.");
		document.form1.header_search.focus();
	}

	else

	{

		document.form1.action = "search_results.asp?pass=1";	

		document.form1.submit();

	}

}



function searchNavigate(intPass)

{

	document.form1.action = "search_results.asp?caller=from_search&pass=" + intPass

	document.form1.submit();

}



function submitEventByDateAndFilter(intFilter)
{
	if (document.form1.date_select.value == 0)
	{
		//This means the user selected the all months drop down selection
		if (intFilter == "")
		{
			//This user is not in a specific sub category
			document.form1.action = "categoryDetails.asp?pass=1&cat=10";
			document.form1.submit();
		}
		else
		{
			//This user is in a specific sub category
			document.form1.action = "categoryDetails.asp?pass=1&cat=10&filter=" + intFilter;
			document.form1.submit();
		}
	}
	else
	{
		//The user selected a specific month in the month drop down selection
		if (intFilter == "")
		{
			document.form1.action = "categoryDetails.asp?pass=1&datefilter=1&cat=10";
			document.form1.submit();
		}
		else
		{
			document.form1.action = "categoryDetails.asp?pass=1&datefilter=1&cat=10&filter=" + intFilter;
			document.form1.submit();
		}
	}
}

function submitEventByDate()
{
	if (document.form1.date_select.value == 0)
	{
		document.form1.action = "categoryDetails.asp?pass=1&cat=10";
		document.form1.submit();
	}
	else
	{
		document.form1.action = "categoryDetails.asp?pass=1&datefilter=1&cat=10";
		document.form1.submit();
	}
}

function submitEventByText()
{
	document.form1.action = "categoryDetails.asp?cat=10&pass=1";	
	document.form1.submit();
}

function setFocus()
{
	document.form1.search_text.focus();
}

function checkSearch()
{
	var blnError;

	blnError = false;

	if (document.form1.search_text.value == "")
	{
		alert("You must enter Search Text.");
		document.form1.search_text.focus();
		blnError = true;
	}

	if (blnError)
	{
		return false;
	}
	else
	{
		return true;
	}
}

function submitTextSearch(category, pass)
{
	document.form1.action = "categoryDetails.asp?cat=" + category + "&pass=" + pass;
	document.form1.submit();
}

function submitHiddenLog(category, pass, fromintro, menuCheck, price, roomtype, specialoffers, amenities)
{
	document.form1.action = "categoryDetails.asp?cat=" + category + "&pass=" + pass + "&fromintro=" + fromintro + "&menuCheck=" + menuCheck + "&price=" + price + "&roomtype=" + roomtype + "&specialoffers=" + specialoffers + "&amenities=" + amenities;
	document.form1.submit();
}

function checkFrame()
{
	if (top.location != self.location)
	{
		top.location = self.location;
	}
	preloadImages()
}

function preloadImages()
{
	button1 = new Image();
	button1.src = "../images/outdoor_sport_on.jpg";
	button2 = new Image();
	button2.src = "../images/history_museum_on.jpg";
	button3 = new Image();
	button3.src = "../images/nightllife_art_on.jpg";
	button4 = new Image();
	button4.src = "../images/meet_convention_on.jpg";
	button5 = new Image();
	button5.src = "../images/shopping_on.jpg";
	button6 = new Image();
	button6.src = "../images/dining_on.jpg";
	button7 = new Image();
	button7.src = "../images/lodging_on.jpg";
	button8 = new Image();
	button8.src = "../images/events_on.jpg";
	button10 = new Image();
	button10.src = "../images/mapquest_logo_on.gif";
}

function rollOver(imName, newimage, ext) 
{
	if (ext == 'JPG')
	{
		document.images[imName].src = "../images/" + newimage + ".jpg";
	}
	else
	{
		document.images[imName].src = "../images/" + newimage + ".gif";	
	}
}

function openWindow(strURL)
{
	if (strURL.indexOf('http') ==-1)
	{
		strURL = "http://" + strURL;
	}
	window.open(strURL);
}

function openLodgingFrame(strURL) {
	var screenWidth = screen.width;
	var screenHeight = screen.height;
	var windowWidth;
	var windowHeight;
	var windowXPosition;
	var windowYPosition;
	var sourceWin;

	windowWidth = 800;
	windowHeight = 550;

	windowXPosition = (screenWidth / 2) - (windowWidth / 2);
	windowYPosition = 40;

	screenHeight = (screenHeight - (windowYPosition * 3));
	if (windowHeight > screenHeight) {
		windowHeight = screenHeight;
	}
	
	if (strURL.indexOf('http') ==-1) {
		strURL = "http://" + strURL;
	}

	window.open(strURL, '', 'dependent=yes,height=' + windowHeight + ',width=' + windowWidth + ',left=' + windowXPosition + ',top=' + windowYPosition + ',titlebar=yes,toolbar=yes,menubar=no,status=yes,scrollbars=yes,resizable=yes');
}

function getguide(surveyNum)
{
	surveyStr = "requestGuide.asp?survey=" + surveyNum;
	var thiswin = window.open(surveyStr,'vbsportteam','width=400,height=400,status=1,scrollbars=1,menubar=0,resizable');
}

function openMapQuest(strURL)
{
	var screenWidth = screen.width
	var screenHeight = screen.height
	var windowWidth
	var windowHeight
	var windowXPosition
	var windowYPosition

	windowWidth = 800
	windowHeight = 650

	windowXPosition = (screenWidth / 2) - (windowWidth / 2)
	windowYPosition = 40
	
//	strURL = "http://" + strURL;

	window.open(strURL, "_blank", "height=" + windowHeight + ",width=" + windowWidth + ",resizable=yes,toolbar=no,menubar=yes,status=yes,scrollbars=1");
}

function openTripConnect(strURL)
{
	var screenWidth = screen.width
	var screenHeight = screen.height
	var windowWidth
	var windowHeight
	var windowXPosition
	var windowYPosition

	windowWidth = 400
	windowHeight = 525

	windowXPosition = (screenWidth / 2) - (windowWidth / 2)
	windowYPosition = 40

	strURL = "http://" + strURL;

	window.open(strURL, '', 'dependent=yes,height=' + windowHeight + ',width=' + windowWidth + ',left=' + windowXPosition + ',top=' + windowYPosition + ',titlebar=no,toolbar=no,menubar=yes,status=no, scrollbar=yes')
}

//*****************************************************************************************

//The function getDescripSize updates the form input element with the current length in 

//characters of the form's description textarea.  Triggered by the onchange event of the

//description textarea.  This allows the user to determine how close to the 850 char max

// the description text is at any time.

//*****************************************************************************************

function getDescripSize() {

	if (document.form1.txtDescSize) {

		document.form1.txtDescSize.value=String(document.form1.description.value).length;

	}

}



function openPhoto(thePhoto,winTitle) {

	//This function opens a new browser on the client in which to present

	//the associated attraction photograph



	var photoWin

	var n = navigator.appName;

	if (n == "Microsoft Internet Explorer") {if (photoWin) {photoWin.close();}}    

   	if (n == "Netscape") {if (photoWin) { if (photoWin.document) {photoWin.close();}}}



	var crlf = String.fromCharCode(13) + String.fromCharCode(13);



    photoWin = window.open("","photoWin","scrollbars=no,menubar=no,resizable=yes,height=100,width=100",true);



	if (winTitle.length == 0)

	{

		winTitle = "Attraction Graphic"

	}

	

    photoWin.document.write("<HTML>" + crlf);

	photoWin.document.write("<HEAD>" + crlf);

	photoWin.document.write("<TITLE>" + winTitle + "</TITLE>" + crlf);

    photoWin.document.write("</HEAD>" + crlf);

    photoWin.document.write("<BODY>" + crlf);



    if (n == "Microsoft Internet Explorer") {

		photoWin.document.write("<IMG name='photo' SRC='" + thePhoto + "' ALT='" + winTitle + "' TITLE='" + winTitle +"' vspace=0 hspace=0 border=1 onload='window.resizeTo(this.width+30,this.height+60)'>" + crlf);

	}else{

		photoWin.document.write("<IMG name='photo' SRC='" + thePhoto + "' ALT='" + winTitle + "' TITLE='" + winTitle +"' vspace=0 hspace=0 border=1 onload='window.resizeTo(this.width+20,this.height+20)'>" + crlf);

	}

    photoWin.document.write("</BODY>" + crlf);

    photoWin.document.write("</HTML>" + crlf);

    photoWin.document.close();

    photoWin.focus();

}



//********************************************************************************************************

//Functions to Support the Trip Planner Cookie

//********************************************************************************************************

function saveToTrip(CharacteristicID) {

	//This function sets a client cookie and adds an Item (Characteristic ID)to the Trip Planner

	//The cookie expires after thirty days 

	var cookieDate	 = new Date();

	cookieDate.setTime (cookieDate.getTime() + 

	(1000 * 60 * 60 * 24 * 30));

	var cookieExpire = new Date();

	cookieExpire.setTime = cookieDate.getTime();



	//Check for the existence of a cookie on the client computer

	//If CharacteristicID Is Not In Cookie, Add It

	var cookieStr = unescape(document.cookie)



	if (cookieStr.indexOf("|" + CharacteristicID + "|") == -1 ) {

		//Find the end of the cookie string and add the new CharacteristicID to it

		startpos		= cookieStr.indexOf("TripID=") + 7;

		endpos			= cookieStr.lastIndexOf("|");

		cookieLength	= endpos - startpos;

		cookieStr		= cookieStr.substr(startpos,cookieLength) + "|" + CharacteristicID + "|";

		document.cookie = "TripID=" + escape(cookieStr) + ";expires=" + cookieDate.toGMTString();

	}

	

	document.location.href = "trip_planner.asp?crumbid=1"

}	



//********************************************************************************************************

function removeFromTrip(CharacteristicID) {

	//This function gets a client cookie and removes an Item (CharacteristicID) from the Trip Planner

	//The cookie is reset to expire after thirty days 

	var cookieDate	 = new Date();

	cookieDate.setTime (cookieDate.getTime() + 

	(1000 * 60 * 60 * 24 * 30));

	

	var cookieExpire = new Date();

	cookieExpire.setTime = cookieDate.getTime();



	//Netscape and Explorer don't play together well, have to use differnent delimiters

	//IE is the pipe symbol, Netscape's is ASCII character 179

	var n=navigator.appName

	if (n=="Microsoft Internet Explorer") {

		var strDelimiter = "|";

	}

	if (n=="Netscape")   {

		var strDelimiter = "|";

	}

			

	//Find The position of the CharacteristicID in the cookie and delete it

	//By rebuilding the cookie string without it

	var cookieStr	= unescape(document.cookie);

	startpos		= cookieStr.indexOf("TripID=") + 7;

	endpos			= cookieStr.lastIndexOf(strDelimiter) + 1;

	cookieLength	= endpos - startpos;

	cookieStr		= cookieStr.substr(startpos,cookieLength);

	//Remove the deleted attraction from the cookie string

	cookieStr		= cookieStr.replace(strDelimiter + CharacteristicID + strDelimiter,strDelimiter);

	//Delete the old cookie by expiring it

	document.cookie = "TripID=0;expires=" + cookieExpire.toGMTString(); 

	//Set the new cookie if the length is greater than 1

	if (cookieStr.length > 1) {

		document.cookie = "TripID=" + escape(cookieStr) + ";expires=" + cookieDate.toGMTString();

	}

	alert("This Item Has Been Removed From Your Trip Planner.");

	window.location.reload();

}	

function underlineLink(obj)

{

	obj.style.textDecoration='underline';

//	obj.style.fontWeight='bold';

}



function takeOffUnderline(obj)

{

	obj.style.textDecoration='none';

//	obj.style.fontWeight='normal';

}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+5)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
