<!--

//*****************  TRANSITIONAL on www.pnf.com  *****************************


//give render_topnav and render_bottnav a root path
//FParker_root is root of frequent parker online application
var FParker_root = "https://209.195.6.11/loyalty/";    //"http://192.168.0.7/betapnf/"        
var FParker_dir  = "FParker/";
//PNF_root is root of PNF main public web site
var PNF_root = "http://www.pnf.com/";


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

var popWin = null    
var winCount = 0
var winName = "popWin"
function openPopWin(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
  var d_winLeft = 2  
  var d_winTop = 2  
  winName = "popWin" + winCount++ //unique name for each pop-up window
  closePopWin()           // close any previously opened pop-up window
  if (openPopWin.arguments.length >= 4) 
    winFeatures = "," + winFeatures
  else 
    winFeatures = "" 
  if (openPopWin.arguments.length == 6)  // location specified
    winFeatures += getLocation(winWidth, winHeight, winLeft, winTop)
  else
    winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop)
  popWin = window.open(winURL, winName, "width=" + winWidth 
           + ",height=" + winHeight + winFeatures)
  }
	
function closePopWin(){    // close pop-up window if it is open 
  if (navigator.appName != "Microsoft Internet Explorer" 
      || parseInt(navigator.appVersion) >=4) //do not close if early IE
    if(popWin != null) if(!popWin.closed) popWin.close() 
  }
	
function getLocation(winWidth, winHeight, winLeft, winTop){
  var winLocation = ""
  if (winLeft < 0)
    winLeft = screen.width - winWidth + winLeft
  if (winTop < 0)
    winTop = screen.height - winHeight + winTop
  if (winTop == "cen")
    winTop = (screen.height - winHeight)/2 - 20
  if (winLeft == "cen")
    winLeft = (screen.width - winWidth)/2
  if (winLeft>0 & winTop>0)
    winLocation =  ",screenX=" + winLeft + ",left=" + winLeft	
                + ",screenY=" + winTop + ",top=" + winTop
  else
    winLocation = ""
  return winLocation
  }

var the_url = window.location;
    the_url = the_url.toString();

function render_topnav()
{
	document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0'>");
	document.write("<tr align='left' valign='top'>");
	document.write("<td height='24' width='355'>");
	document.write("<a href='" + PNF_root + "index.htm'><img src='" + PNF_root + "images/logo.gif' width='355' height='55' border='0'></a>");
	document.write("</td>");
	document.write("<td width='194' height='24'>");
	document.write("<table width='194' border='0' cellspacing='0' cellpadding='0'>");
	document.write("<tr>");
	document.write("<td bgcolor='#FF9933' width='194'>");
	//if the url is the button that was clicked, make it the over state
	//LINK: Locations & Rates
	if (the_url.match(/locations.htm/) || the_url.match(/atlanta/) || the_url.match(/cleveland/) || the_url.match(/dallas/) || the_url.match(/houston/) || the_url.match(/lax/) || the_url.match(/ftlauderdale/) || the_url.match(/minneapolis/) || the_url.match(/neworleans/) || the_url.match(/oakland/) || the_url.match(/ontario/) || the_url.match(/sanfrancisco/) || the_url.match(/stlouis/) || the_url.match(/ccv/))
	{
		document.write("<a href='" + PNF_root + "locations.htm'><img name='Image16' border='0' src='" + PNF_root + "images/nav/locations_on1.gif' width='194' height='21'></a>");
	}
	else
	{
		document.write("<a href='" + PNF_root + "locations.htm' onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"Image16\",\"\",\"" + PNF_root + "images/nav/locations_on1.gif\",1)'><img name='Image16' border='0' src='" + PNF_root + "images/nav/locations_off1.gif' width='194' height='21'></a>");
	}
	document.write("</td>");
	document.write("</tr>");
	document.write("<tr>");
	document.write("<td bgcolor='#FF9933' width='194'>");
	//LINK: Corporate Advantage
	if (the_url.match(/frequent_parkers/) && the_url.match(/type=company/) )
	{
		document.write("<a href='" + PNF_root + "corporate_advantage/Default.htm'><img name='Image15' border='0' src='" + PNF_root + "images/nav/corp_advantage_on1.gif' width='194' height='16'></a>");
	}
	else
	{
		document.write("<a href='" + PNF_root + "corporate_advantage/Default.htm' onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"Image15\",\"\",\"" + PNF_root + "images/nav/corp_advantage_on1.gif\",1)'><img name='Image15' border='0' src='" + PNF_root + "images/nav/corp_advantage_off1.gif' width='194' height='16'></a>");
	}
	document.write("</td>");
	document.write("</tr>");
	document.write("<tr>");
	document.write("<td bgcolor='#FF9933' width='194'>");
	//LINK: For Frequent Parkers
	if (the_url.match(/frequent_parkers/) && the_url.match(/type=fp/) )
	{
		document.write("<a href='" + PNF_root + "frequent_parkers/Default.htm'><img name='Image26' border='0' src='" + PNF_root + "images/nav/parkers_on1.gif' width='194' height='18'></a>");
	}
	else
	{
		document.write("<a href='" + PNF_root + "frequent_parkers/Default.htm' onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"Image26\",\"\",\"" + PNF_root + "images/nav/parkers_on1.gif\",1)'><img name='Image26' border='0' src='" + PNF_root + "images/nav/parkers_off1.gif' width='194' height='18'></a>");
	}
	document.write("</td>");
	document.write("</tr>");
	document.write("</table>");
	document.write("</td>");
	document.write("<td width='148' height='24'>");
	document.write("<table width='148' border='0' cellspacing='0' cellpadding='0'>");
	document.write("<tr>");
	document.write("<td bgcolor='#FF9933' width='148'>");
	//LINK: For Travel Agents
	if (the_url.match(/travel_agents/))
	{
		document.write("<a href='" + PNF_root + "travel_agents/default.htm'><img name='Image27' border='0' src='" + PNF_root + "images/nav/travel_agents_on1.gif' width='148' height='21'></a>");
	}
	else
	{
		document.write("<a href='" + PNF_root + "travel_agents/Default.htm' onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"Image27\",\"\",\"" + PNF_root + "images/nav/travel_agents_on1.gif\",1)'><img name='Image27' border='0' src='" + PNF_root + "images/nav/travel_agents_off1.gif' width='148' height='21'></a>");
	}
	document.write("</td>");
	document.write("</tr>");
	document.write("<tr>");
	document.write("<td bgcolor='#FF9933' width='148'>");
	//LINK: Customer Service
	if (the_url.match(/your_comments/))
	{
		document.write("<img name='Image28' border='0' src='" + PNF_root + "images/nav/cust_on.gif' width='148' height='16'>");
	}
	else
	{
		document.write("<a href='" + PNF_root + "your_comments/default.htm' onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"Image28\",\"\",\"" + PNF_root + "images/nav/cust_on.gif\",1)'><img name='Image28' border='0' src='" + PNF_root + "images/nav/cust_off.gif' width='148' height='16'></a>");
	}
	document.write("</td>");
	document.write("</tr>");
	document.write("<tr>");
	document.write("<td bgcolor='#FF9933' width='148'>");
	//LINK: RESERVATIONS /// OR /// About Park `N Fly
	if (the_url.match(/about/))
	{
		document.write("<img name='Image29' border='0' src='" + PNF_root + "images/nav/reserve_on.gif' width='148' height='18'>");
	}
	else
	{
		document.write("<a href='http://rezpark.rezlink.com/booking/default.asp?AID=PNF00001&IATA=100015&HOP=TRUE' onMouseOut='MM_swapImgRestore()' onMouseOver='MM_swapImage(\"Image29\",\"\",\"" + PNF_root + "images/nav/reserve_on.gif\",1)'><img name='Image29' border='0' src='" + PNF_root + "images/nav/reserve_off.gif' width='148' height='18'></a>");
	}
	document.write("</td>");
	document.write("</tr>");
	document.write("</table>");
	document.write("</td>");
	document.write("<td width='100%' bgcolor='#FF9933' height='24'>&nbsp;</td>");
	document.write("</tr>");
	document.write("</table>");
}

function render_bottnav()
{
	document.write("<p><font size='1' face='Verdana, Arial, Helvetica, sans-serif' color='#999999'><br>");
	document.write("<font face='Arial, Helvetica, sans-serif'>&copy; 2006 Park 'N Fly<br>");
	document.write("<br>");
	document.write("<a href='" + PNF_root + "index.htm'><font color='999999'>home</font></a> "); 
	document.write("| <a href='" + PNF_root + "locations.htm'><font color='999999'>locations</font></a> "); 
	document.write("| <a href='" + PNF_root + "corporate_advantage/default.htm'><font color='999999'>corporate advantage</font></a> ");
	document.write("|<font color='999999'> <a href='" + PNF_root + "frequent_parkers/default.htm'><font color='#999999'>for frequent parkers</font></a></font> ");
	document.write("| <a href='" + PNF_root + "travel_agents/default.htm'><font color='999999'>for travel agents</font></a> ");
	document.write("| <a href='http://rezpark.rezlink.com/booking/default.asp?AID=PNF00001&IATA=100015&HOP=TRUE'><font color='999999'>reservations</font></a> ");
		document.write("<br>");
	document.write("<a href='" + PNF_root + "about/default.htm'><font color='999999'>about Park 'N Fly</font></a> ");
	document.write("| <a href='" + PNF_root + "your_comments/default.htm'><font color='999999'>customer service</font></a> ");
	document.write("| <a href='" + PNF_root + "sitemap.htm'><font color='999999'>site map</font></a> ");
		document.write("| <a href='javascript:openPopWin(\"" + PNF_root + "termsofuse.htm\", 420, 500, \"scrollbars=yes\", 0, 0)'><font color='999999'>terms of use</font></a> ");
	document.write("| <a href='javascript:openPopWin(\"" + PNF_root + "privacy.html\", 420, 500, \"scrollbars=yes\", 0, 0)'><font color='999999'>privacy policy</font></a></font></font></p>");
	document.write("<br><br>");
}

function render_loc_pulldown()
{
	document.write("<form name='form1'>");
	document.write("<select name='menu1' onChange='MM_jumpMenu(\"parent\",this,0)'>");
	document.write("<option selected>Select Location</option>");
	document.write("<option value='" + PNF_root + "atlanta/pnf/default.htm'>Atlanta-Park 'N Fly</option>");
	document.write("<option value='" + PNF_root + "atlanta/plus/default.htm'>Atlanta-Park 'N Fly Plus</option>");
	document.write("<option value='" + PNF_root + "atlanta/parkngo/default.htm'>Atlanta-Park 'N Go</option>");
	document.write("<option value='" + PNF_root + "cleveland/default.htm'>Cleveland</option>");
	document.write("<option value='" + PNF_root + "dallas/pnf/default.htm'>Dallas-Park 'N Fly</option>");
	//document.write("<option value='" + PNF_root + "dallas/prf/default.htm'>Dallas-Park Ride Fly</option>");
	document.write("<option value='" + PNF_root + "ftlauderdale/default.htm'>Ft. Lauderdale</option>");
	document.write("<option value='" + PNF_root + "houston/default.htm'>Houston</option>");
	document.write("<option value='" + PNF_root + "lax/default.htm'>Los Angeles - LAX</option>");
	document.write("<option value='" + PNF_root + "minneapolis/default.htm'>Minneapolis</option>");
	document.write("<option value='" + PNF_root + "neworleans/default.htm'>New Orleans</option>");
	document.write("<option value='" + PNF_root + "oakland/default.htm'>Oakland</option>");
	document.write("<option value='" + PNF_root + "ontario/default.htm'>Ontario, California</option>");
	document.write("<option value='" + PNF_root + "sandiego/default.htm'>San Diego</option>");
	document.write("<option value='" + PNF_root + "sanfrancisco/default.htm'>San Francisco</option>");
	//document.write("<option value='" + PNF_root + "stlouis/default.htm'>St. Louis</option>");
	document.write("</select>");
	document.write("</form>");
}

function choosePage(theForm,loc,url1,url2)
{

  if (theForm.origcity.selectedIndex == 0)
  {
    alert("The \"Select City\" option is not a valid selection.  Please select an Originating City.");
    theForm.origcity.focus();
    return (false);
  }

	//send the user to EzXit capture page or send them to the pnf.com app page
	//if (loc == "Ft. Lauderdale" || loc == "Ontario, California" || loc == "26" || loc == "8" || loc == "15" || loc == "21" || loc == "3" || loc == "25")//Ontario, California and 26 are same id's from diff. pages
	//{
	//	document.location.href = url1;
	//	return (false);
	//}
	//else
	//{		
	//	document.location.href = url2 + loc;
	//	return (false);
	//}
	
	//send the user to EzXit capture page or send them to the pnf.com app page
	if (loc == "Los Angeles - LAX")//Cleveland is now active on the system
	{
		document.location.href = url2 + loc;
		return (false);
	}
	else
	{
		document.location.href = url1;
		return (false);
	}
	
}

var digits = "0123456789";
var phoneNumberDelimiters = "()- ";
var validUSPhoneChars = digits + phoneNumberDelimiters;
var iUSPhone = "This field must be a 10 digit U.S. phone number (like 415 555 1212). Please reenter it now."
var pUSPhone = "10 digit U.S. phone number (like 415 555 1212)."
var g_strPhone;
//Removes all characters which appear in string bag from string s.
function stripCharsInBag (s, bag)
{   var i;
    var returnString = "";

    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }

    return returnString;
}


// Removes all characters which do NOT appear in string bag 
// from string s.

function stripCharsNotInBag (s, bag)

{   var i;
    var returnString = "";

    // Search through string's characters one by one.
    // If character is in bag, append to returnString.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) != -1) returnString += c;
    }

    return returnString;
}



// Removes all whitespace characters from s.
// Global variable whitespace (see above)
// defines which characters are considered whitespace.

function stripWhitespace (s)

{   return stripCharsInBag (s, whitespace)
}



function storePhone(elPhone)
{
	g_strPhone = new String(elPhone.value);
}
function reformatUSPhone(elPhone)
{
	var strStrippedPhone= stripCharsNotInBag(elPhone.value, '1234567890');
	var strFormattedPhone = '';
	
	//return (reformat (USPhone, "(", 3, ") ", 3, "-", 4))

	// insert "-" characters into the SSN, including trailing "-"'s
	if (strStrippedPhone.length < 3) // insert '('
		strFormattedPhone = (reformat (strStrippedPhone, '', 2));
	else if (strStrippedPhone.length < 6) // insert ')'
		strFormattedPhone = (reformat (strStrippedPhone, '', 3, '-', 2));
	else // insert 2 "-"'s, the second might be trailing
		strFormattedPhone = (reformat (strStrippedPhone, '', 3, '-', 3, '-', 4));

	if (g_strPhone == strFormattedPhone)
	{
		var strCleansedOldPhone = stripCharsNotInBag(elPhone.value, '1234567890-');
		if ((elPhone.value == strCleansedOldPhone) && (strCleansedOldPhone.length <= 12))
			elPhone.value = strFormattedPhone.substr(0,strFormattedPhone.length );
		else
			elPhone.value = strFormattedPhone.substr(0,strFormattedPhone.length);
	}
	else
		elPhone.value = strFormattedPhone; // formatted string
}
function reformatUSBusPhone(elPhone)
{
	var strStrippedPhone= stripCharsNotInBag(elPhone.value, '1234567890');
	var strFormattedPhone = '';
	
	//return (reformat (USPhone, "(", 3, ") ", 3, "-", 4))

	// insert "-" characters into the SSN, including trailing "-"'s
	if (strStrippedPhone.length < 3) // insert '('
		strFormattedPhone = (reformat (strStrippedPhone, '', 2));
	else if (strStrippedPhone.length < 6) // insert ')'
		strFormattedPhone = (reformat (strStrippedPhone, '', 3, '-', 2));	
	else if (strStrippedPhone.length < 10)// insert 2 "-"'s, the second might be trailing
		strFormattedPhone = (reformat (strStrippedPhone, '', 3, '-', 3, '-', 4));
	else if (strStrippedPhone.length ==10)
		strFormattedPhone = (reformat (strStrippedPhone, '',  3, '-', 3, '-', 4,' Ext:'));	
	else // insert 2 "-"'s, the second might be trailing
		strFormattedPhone = (reformat (strStrippedPhone, '', 3, '-', 3, '-', 4,' Ext:',4));

	if (g_strPhone == strFormattedPhone)
	{
		var strCleansedOldPhone = stripCharsNotInBag(elPhone.value, '1234567890-');
		if ((elPhone.value == strCleansedOldPhone) && (strCleansedOldPhone.length <= 12))
			elPhone.value = strFormattedPhone.substr(0,strFormattedPhone.length );
		else
			elPhone.value = strFormattedPhone.substr(0,strFormattedPhone.length);
	}
	else
		elPhone.value = strFormattedPhone; // formatted string
}
function reformat (s)
{	var arg;
	var sPos = 0;
	var resultString = "";

	for (var i = 1; i < reformat.arguments.length; i++)
	{
		arg = reformat.arguments[i];
		if (i % 2 == 1)
			resultString += arg;
		else 
		{	
			resultString += s.substr(sPos, arg);
			sPos += arg;
		}
	}
	return resultString;
}
function CheckCompleteUSPhone(frmContainer, strPhoneFieldName)
{
	var blnSuccess = true;
	g_strManditoryFieldList = '';
	
	// check that the phone fields have 13 characters
	var elPhone = frmContainer[strPhoneFieldName];
	var strPhone = new String(elPhone.value);

	if (strPhone.length > 0 && strPhone.length < 12)
	{
		alert('Please supply a phone formatted like "111-111-1111"');
		elPhone.focus();
		blnSuccess = false;
	}
	return blnSuccess;
}


// checkUSPhone (TEXTFIELD theField [, BOOLEAN emptyOK==false])
//
// Check that string theField.value is a valid US Phone.
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.

function checkUSPhone (theField, emptyOK)
{   if (checkUSPhone.arguments.length == 1) emptyOK = defaultEmptyOK;
    if ((emptyOK == true) && (isEmpty(theField.value))) return true;
    else
    {  var normalizedPhone = stripCharsInBag(theField.value, phoneNumberDelimiters)
       if (!isUSPhoneNumber(normalizedPhone, false)) 
          return warnInvalid (theField, iUSPhone);
       else 
       {  // if you don't want to reformat as (123) 456-789, comment next line out
          theField.value = reformatUSPhone(normalizedPhone)
          return true;
       }
    }
}
//-->
