/*
Author:		Rusty Swayne (rusty@mindfly.com)
			common client side javascript functions

*/

var PlayQue;

function ChangeSalesFormAction()
{
	if(checkContactForm())
	{
		document.forms[0].action = '/action_salesContact.asp';
		return true;
	}
	else
		return false;
	
}



function highlighter(name, action)
// Purpose:			provides simple mouse over functionality based on "name" attribute
//					in image tag referenced.
// Precondition:	javascript variables must be defined in accordance to name and name_f2 =)
{
	if (document.images)
	{
		if(action == "on") 
		{
		document.images[name].src = eval(name + "_f2.src");
		}
		else
		document.images[name].src = eval(name + ".src");
	}
}

function ShowDoc(sURL, windowName, width, height) 
// Purpose:	Launches File in new window
{
  myRemote = launch(sURL, windowName,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes,width=" + width + ",height=" + height + ",left=100,top=50","parentWin");
}

function ShowWinner(sURL, windowName, width, height) 
// Purpose:	Launches File in new window
{
  myRemote = launch(sURL, windowName,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,alwaysRaised=yes,width=" + width + ",height=" + height + ",left=100,top=50","parentWin");
}

function ShowPop(sURL, windowName, width, height) 
// Purpose:	Launches File in new window
{
  myRemote = launch(sURL, windowName,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,alwaysRaised=yes,width=" + width + ",height=" + height + ",left=100,top=50","parentWin");
}


function launch(newURL, newName, newFeatures, orgName) {
  var remote = open(newURL, newName, newFeatures);
  if (remote.opener == null)
    remote.opener = window;
  remote.opener.name = orgName;
  return remote;
}

function checkContactForm()
{
	
	var msg	= "";

	if(document.forms[0].B_FirstName.value == "")
	{
		msg = msg + "++ Brides First Name is required\n\r";
		document.forms[0].B_FirstName.focus();
	}
		
	if(document.forms[0].B_LastName.value == "")
	{
		msg = msg + "++ Brides Last Name is required\n\r";
		document.forms[0].B_LastName.focus();
	}

	if(document.forms[0].G_FirstName.value == "")
	{
		msg = msg + "++ Grooms First Name is required\n\r";
		document.forms[0].G_FirstName.focus();
	}
	
	if(document.forms[0].G_LastName.value == "")
	{
		msg = msg + "++ Grooms Last Name is required\n\r";
		document.forms[0].G_LastName.focus();
	}

	if(document.forms[0].B_Address1.value == "")
	{
		msg = msg + "++ Address field is required\n\r";
		document.forms[0].B_Address1.focus();
	}
	
	if(document.forms[0].B_City.value == "")
	{
		msg = msg + "++ City field is required\n\r";
		document.forms[0].B_City.focus();
	}
	
	if(document.forms[0].B_State.value == "")
	{
		msg = msg + "++ State field is required\n\r";
		document.forms[0].B_State.focus();
	}
	
	if(document.forms[0].B_Zip.value == "")
	{
	
		msg = msg + "++ Zip Code field is required\n\r";
		document.forms[0].B_Zip.focus();
	}
	
	if(document.forms[0].B_Phone.value == "")
	{
		msg = msg + "++ Phone field is required\n\r";
		document.forms[0].B_Phone.focus();
	}
	
	if(document.forms[0].B_Email.value == "")
	{
		msg = msg + "++ Email Address field is required\n\r";
		document.forms[0].B_Email.focus();
	}
	
	if(msg != "")
	{
		alert("The following errors were detected\r\n" + msg);
		return false;
	}else{
		return true;
	}
	
}

function checkEventForm()
{
	
	var msg	= "";

	if(document.forms[0].Company.value == "")
	{
		msg = msg + "++ Company is required\n\r";
		document.forms[0].Company.focus();
	}

	if(document.forms[0].G_FirstName.value == "")
	{
		msg = msg + "++ First Name is required\n\r";
		document.forms[0].G_FirstName.focus();
	}
	
	if(document.forms[0].G_LastName.value == "")
	{
		msg = msg + "++ Last Name is required\n\r";
		document.forms[0].G_LastName.focus();
	}

	if(document.forms[0].B_Address1.value == "")
	{
		msg = msg + "++ Address field is required\n\r";
		document.forms[0].B_Address1.focus();
	}
	
	if(document.forms[0].B_City.value == "")
	{
		msg = msg + "++ City field is required\n\r";
		document.forms[0].B_City.focus();
	}
	
	if(document.forms[0].B_State.value == "")
	{
		msg = msg + "++ State field is required\n\r";
		document.forms[0].B_State.focus();
	}
	
	if(document.forms[0].B_Zip.value == "")
	{
	
		msg = msg + "++ Zip Code field is required\n\r";
		document.forms[0].B_Zip.focus();
	}
	
	if(document.forms[0].B_Phone.value == "")
	{
		msg = msg + "++ Phone field is required\n\r";
		document.forms[0].B_Phone.focus();
	}
	
	if(document.forms[0].B_Email.value == "")
	{
		msg = msg + "++ Email Address field is required\n\r";
		document.forms[0].B_Email.focus();
	}
	
	if(document.forms[0].numberofrooms.value == "")
	{
		msg = msg + "++ Total number of Hotel Rooms field is required\n\r";
		document.forms[0].numberofrooms.focus();
	}
	
	if(document.forms[0].numberofpeople.value == "")
	{
		msg = msg + "++ Number of people field is required\n\r";
		document.forms[0].numberofpeople.focus();
	}
	
	

	
	if(msg != "")
	{
		alert("The following errors were detected\r\n" + msg);
		return false;
	}else{
		return true;
	}
	
}

function NumberofRooms()
{
if( document.forms[0].numberofrooms.value > 500)
{
	alert("Please contact the casino directly if your event requires more than 500 rooms");
	document.forms[0].numberofrooms.value = 500;
}

}
