
/*
	File:		clientsides.js
	
	Author:		Joe McCorison	(joe@mindfly.com)
	
	Purpose:	Various client side scripts
	
	Updates:	
*/

// BEGIN WINDOW SCRIPTS
// ---------------------------------------------------------------

function toggleBox(szDivID, iState, LayerText) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    		document.getElementById(szDivID).innerHtml = LayerText;
		}
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}


function enableButton(buttonName)
{
	document.blackOutDates.input_action.disabled = false;
}

function Redirect(sUrl)
{	
	window.location = sUrl;
}

function back()
{
	var back;
	back = window.history;
	back.back(-1);	
}

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=250,top=150","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;
}

/*
Author:		Rusty Swayne (rusty@mindfly.com)
			common client side javascript functions

*/
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 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=250,top=150","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=250,top=150","subWin");
}


function IsEmpty(aTextField,varName) {
   if ((aTextField.value.length==0) || (aTextField.value==null)) {
      aTextField.style.backgroundColor='#7B9CCB';      
      return false;
   }else{ aTextField.style.backgroundColor='#f1e3ac'; 
   return true; 
  }
}

function errorCheckRes()
{
 var holder = 0;
 var numRooms = 0;
 
 if(!IsEmpty(document.resrvForm.FirstName,'FirstName')){
    holder++;
 }

 if(!IsEmpty(document.resrvForm.LastName,'LastName')){
    holder++;
 }  
   
 if(!IsEmpty(document.resrvForm.Line1,'Line1')){
    holder++;
 }  
 
 if(!IsEmpty(document.resrvForm.City,'City')){
    holder++;
 }
 
 if(!IsEmpty(document.resrvForm.Zip,'Zip')){
    holder++;
 }
 
 if(!IsEmpty(document.resrvForm.Phone,'Phone')){
    holder++;
 }
 
 if(!IsEmpty(document.resrvForm.Email,'Email')){
    holder++;
 }
 
if(document.resrvForm.Num_Rooms.value > 3)
	{
		
		numRooms++;
	}
	

 
    if(holder > 0){
     alert("Please fill in the required fields highlighted in the form!");
     return false;
    }else if(numRooms > 0){
    alert("Call hotel directly for group reservations for 4 or more.");	
     return false;
    }else{
     return true;
    } 
}

function errorCheckResCC()
{
 var holder = 0;
 
 if(!IsEmpty(document.resrvForm.CardNumber,'CardNumber')){
    holder++;
 }

 /*if(!IsEmpty(document.resrvForm.VerificationCode,'VerificationCode')){
    holder++;
 } */ 

 
    if(holder > 0){
     alert("Please fill in the required fields highlighted in the form!");
     return false;
    }else{
     return true;
    } 
}



var home 		=	new Image();
home.src		=	"images/btn_home.gif";

var home_f2 	=	new Image();
home_f2.src	=	"images/btn_home_f2.gif";

var contact 	=	new Image();
contact.src		=	"images/btn_contact.gif";

var contact_f2 	=	new Image();
contact_f2.src	=	"images/btn_contact_f2.gif";

var floor 	=	new Image();
floor.src		=	"images/btn_floor.gif";

var floor_f2 	=	new Image();
floor_f2.src	=	"images/btn_floor_f2.gif";

var map  	=	new Image();
map.src	=	"images/btn_map.gif";

var map_f2 =	new Image();
map_f2.src	=	"images/btn_map_f2.gif";

var lease  	=	new Image();
lease.src	=	"images/btn_lease.gif";

var lease_f2 =	new Image();
lease_f2.src	=	"images/btn_lease_f2.gif";

var feature  	=	new Image();
feature.src	=	"images/btn_feature.gif";

var feature_f2 =	new Image();
feature_f2.src	=	"images/btn_feature_f2.gif";

function highlighter(name, action)
{	if (document.images)
	{	if(action == "on") 	{
		document.images[name].src = eval(name + "_f2.src");	}
		else document.images[name].src = eval(name + ".src");
	}
}

//pdf window


function loadPDF() {
var load = window.open('/pdfs/GHA_rentalapp_2009.pdf','','scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no'); 
}

	