//this page is used to set up general functions used through out the search boxes and WCT pages. 

//used to switch the class of elements on the fly.
function change(id, newClass) {
identity=document.getElementById(id);
identity.className=newClass;
}

// used to hide and show elements. 
function show(idLayer) { document.getElementById(idLayer).style.display='block'; }
function showInline(idLayer) { document.getElementById(idLayer).style.display='inline'; }
function hide(idLayer) { document.getElementById(idLayer).style.display='none'; }

//bookmark this site
function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}

//Children selector.
function displayages(childobj)
{
if (childobj.options[0].selected){hide('children_box'); hide('minorsAge1'); hide('minorsAge2'); hide('minorsAge3'); hide('minorsAge4');}
if (childobj.options[1].selected){show('children_box'); showInline('minorsAge1'); hide('minorsAge2'); hide('minorsAge3'); hide('minorsAge4');}
if (childobj.options[2].selected){show('children_box'); showInline('minorsAge1'); showInline('minorsAge2'); hide('minorsAge3'); hide('minorsAge4');}
if (childobj.options[3].selected){show('children_box'); showInline('minorsAge1'); showInline('minorsAge2'); showInline('minorsAge3'); hide('minorsAge4');}
if (childobj.options[4].selected){ show('children_box'); showInline('minorsAge1'); showInline('minorsAge2'); showInline('minorsAge3'); showInline('minorsAge4');}
}


function verifyForm(strID)
{
	var blnPass = false;
	var objF = document.getElementById(strID);
	if(objF.chk_in.value=="mm/dd/yyyy"||objF.chk_in.value=="")
	{
		alert("Please select a check in date.");
		objF.chk_in.focus();
	}
	else if(objF.chk_out.value=="mm/dd/yyyy"||objF.chk_out.value=="")
	{
		alert("Please select a check out date.");
		objF.chk_out.focus();
	}
	else
	{
		if(strID=="airHotelSearch")
		{
			
			if(objF.leavingFrom.value=="")
			{
				alert("Please enter the city you are leaving from.");
				objF.leavingFrom.focus();
			}
			else if(objF.goingTo.value=="")
			{
				alert("Please enter the city you are going to.");
				objF.goingTo.focus();
			}
			else
			{
				objF.dateLeavingMonth.value = objF.doa_mm.value;
				objF.dateLeavingDay.value = objF.doa_dd.value;
				objF.dateReturningMonth.value = objF.dod_mm.value;
				objF.dateReturningDay.value = objF.dod_dd.value;
				blnPass = true;
			}
		}
		else if(strID=="CarSearch")
		{
			if(objF.pucity.value=="")
			{
				alert("Please enter the pick-up city.");
				objF.pucity.focus();
			}
			else if(objF.docity.value=="")
			{
				alert("Please enter the drop-off city.");
				objF.docity.focus();
			}
			else
			{
				objF.pudate_mo.value = objF.doa_mm.value;
				objF.pudate_dy.value = objF.doa_dd.value;
				objF.dodate_mo.value = objF.dod_mm.value;
				objF.dodate_dy.value = objF.dod_dd.value;
				blnPass = true;
			}
		}
		else
			blnPass = true;
	}
	return blnPass;
	
}


function newWindow(curr)

{

currWindow = window.open(curr, 'CurrConverter', 'width=460,height=310');

currWindow.focus;

}

function newWindowTracker(track)

{

trackWindow = window.open(track, 'FlightTracker', 'width=620,height=620');

trackWindow.focus;

}


var popUpWin=0;
function tellAFriend(strURL,strLogo,strColor,strTxtColor,strTxtMColor,strTxtCColor,strSubImg,strBGColor,strInvColor,strEmailHdr,strRfrColor,strAdminEmail,strDoNews,strNewsFrmURL,strNewsNameField,strNewsEmailField)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  var strsource = document.URL;
  strsource = strsource.replace(/\?/g,"[que]");
  strsource = strsource.replace(/\&/g,"[amp]");
  strsource = strsource.replace(/\%/g,"[prc]");
  strsource = strsource.replace(/\=/g,"[eql]");
  var strtitle = document.title;
  strtitle = strtitle.replace(/\?/g,"[que]");
  strtitle = strtitle.replace(/\&/g,"[amp]");
  strtitle = strtitle.replace(/\%/g,"[prc]");
  strtitle = strtitle.replace(/\=/g,"[eql]");
  var yeah = "http://72.3.158.71/ver2/tellfriend.asp"
  yeah+='?source='+ strsource +'&strurl=' + strURL +'&logo=' + strLogo + '&color=' + strColor + '&txtcolor=' + strTxtColor + '&txtmcolor=' + strTxtMColor + '&txtccolor=' + strTxtCColor + '&subimg=' + strSubImg + '&bgcolor=' + strBGColor + '&invcolor=' + strInvColor + '&emailhdr=' + strEmailHdr + '&rfrcolor=' + strRfrColor + '&txttitle=' + strtitle + '&adminemail=' + strAdminEmail + '&donews=' + strDoNews + '&newsfrmurl=' + strNewsFrmURL + '&newsnamefield=' + strNewsNameField + '&newsemailfield=' + strNewsEmailField;
  popUpWin = open(yeah, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width=380,height=595,left=50');
}


function addBookmark() {
  var url = self.location.href;
  var title = window.title;
  if (document.all && window.external)
    window.external.AddFavorite(url,document.title);
  else
        alert("Sorry. Netscape users must bookmark the pages manually by hitting <Ctrl-D>.");
}


function goOpaque(strID)
{
	fadeToMax(strID,0,100);
}
function goTransparent(strID)
{
	fadeToMax(strID,100,0);
}
function fadeToMax(strID,intStart,intMax)
{
	var speed = 2;
	var timer = 0;
	if(intStart<intMax)
	{
		for(i=intStart;i<=intMax;i++)
		{
			setTimeout("setOpacity('" + strID + "'," + i + ")",2 * timer);
			timer++;
		}
	}
	else if(intStart>intMax)
	{
		for(i=intStart;i>=intMax;i--)
		{
			setTimeout("setOpacity('" + strID + "'," + i + ")",2 * timer);
			timer++;
		}
	}
}
function setOpacity(strID,intW)
{
	document.getElementById(strID).style.opacity = intW/100;
	document.getElementById(strID).style.filter = "alpha(opacity=" + intW + ")";
}




function linkthisPage()
      {
OpenWindow=window.open("", "newwin", "height=300, width=400, top=400, left=400, toolbar=no,scrollbars=no, menubar=no");
OpenWindow.document.write("<HTML>");
OpenWindow.document.write("<HEAD>");
OpenWindow.document.write("<TITLE>Link to this Page</TITLE>");
OpenWindow.document.write("</HEAD>");
OpenWindow.document.write("<BODY BGCOLOR=&qout;#003E80&qout;>");
OpenWindow.document.write("<FONT SIZE=3>");
OpenWindow.document.write("<br><br><br><font color=&qout;#ffffff&qout;>Copy and paste this code into your html");
OpenWindow.document.write("<texarea NAME=address ROWS=7 COLS=45 padding-left=20 padding-right=20 WRAP=HARD>");
OpenWindow.document.write("<a href=&qout;"+document.URL);
OpenWindow.document.write("&qout;>");
OpenWindow.document.write(document.title);
OpenWindow.document.write("</a></texarea>");
OpenWindow.document.write("</BODY>");
OpenWindow.document.write("</HTML>");
OpenWindow.document.close();
self.name="main";
     }


function makePopup(url) {
newwindow=window.open(url,'message','height=525,width=375,top=200,left=350,resizable');
if (window.focus) {newwindow.focus()}
} 

function makeReviewPopup(url) {
newwindow=window.open(url,'message','height=600,width=480,top=200,left=300,scrollbars=1,resizable');
if (window.focus) {newwindow.focus()}
} 
