//////////////////////////////////////////////////////////////////
// Step 1                                                       //
// Retreiving a pre-saved Cookie                                //
// Script Received from                                         //
// http://www.elated.com/articles/javascript-and-cookies/       //
//////////////////////////////////////////////////////////////////

function get_cookie ( cookie_name )
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}

var referrer2 = get_cookie ( "phhreferrer" );
//document.write("-------------------------"); // Commented out as in realtime, these statements are not needed.
//document.write("<br>"); // Commented out as in realtime, these statements are not needed.
//document.write(referrer2); // Commented out as in realtime, these statements are not needed.
//document.write("<br>"); // Commented out as in realtime, these statements are not needed.
//document.write("-------------------------"); // Commented out as in realtime, these statements are not needed.


///////////////////////////////////////////////////////////////////////////////////////////
// Step 2                                                                                //
// Take the VAR from the pre-saved Cookie                                                //
// and make a URL out of it                                                              //
// Script Received from                                                                  //
// http://stackoverflow.com/questions/975050/passing-javascript-variable-to-a-href       //
// Originally the Function's name was openPage, but we changed                           //
// it to ReservationURL and OnlineDepositURL                                             //
///////////////////////////////////////////////////////////////////////////////////////////

ReservationURL = function ReservationURL () { 
location.href = "https://secure40.securewebsession.com/penthousehotel.com/forms/formhotel.php?referrer3="+referrer2; 
}

OnlineDepositURL = function OnlineDepositURL () { 
location.href = "https://secure40.securewebsession.com/penthousehotel.com/forms/formcc.php?referrer3="+referrer2; 
}


///////////////////////////////////////////////////////////////////////////////////////////
// Step 3                                                                                //
// Take the VAR from the pre-saved Cookie                                                //
// and make a Form Statement out of it                                                   //
// Script fixed by "Philip M" at CodingForums :                                          //
// http://www.codingforums.com/showthread.php?t=209251                                   //
///////////////////////////////////////////////////////////////////////////////////////////

function WriteContactFormStatement () { 
ContactFormValue = referrer2; 
document.write('<input type="hidden" name="userReferrersName" value="' + ContactFormValue + '" />'); 
} 

function WriteMailingListFormStatement () { 
ContactFormValue = referrer2; 
document.write('<input type="hidden" name="userReferrersName" value="' + ContactFormValue + '" />'); 
} 

