// JavaScript Document
function testcookie() {
alert('do cookie called2');

}
function getCookie(NameOfCookie){
    if (document.cookie.length > 0) {              
    begin = document.cookie.indexOf(NameOfCookie+"=");       
    if (begin != -1) {           
      begin += NameOfCookie.length+1;       
      end = document.cookie.indexOf(";", begin);
      if (end == -1) end = document.cookie.length;
        return unescape(document.cookie.substring(begin, end));
    } 
  }
  return null;
}

function setCookie(NameOfCookie, value, expiredays) {
var ExpireDate = new Date();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

  document.cookie = NameOfCookie + "=" + escape(value) + 
  ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

//function delCookie (NameOfCookie) {
 // if (getCookie(NameOfCookie)) {
  //  document.cookie = NameOfCookie + "=" +
  //  "; expires=Thu, 01-Jan-70 00:00:01 GMT";
 // }
//}

function DoTheCookieStuff() {
	
Preference=getCookie('Preference');

if (Preference!=null) 
     {window.location="http://www.archonhospitality.com/"+Preference}
	 //{alert('Hi - your prefered searchengine is '+Preference)}
// Since this is a samplepage you are not taken to the prefered page.
// If the script should actually take the user to the preferred page you should replace the above line
// with a line like this:      
else 
{alert('Please choose your site preference.');}
   //{window.location="http://staging1.archon.com/archonhospitality/home.htm"}
}



function languageSel(formName,sel,check) {
        //Set Variables
        var  fieldValue, localeValue, hrefTarget,objTest,bolTestResult;
        objTest = /_none/;
        fieldValue = sel.options[sel.selectedIndex].value;
        bolTestResult = objTest.test(fieldValue);
        cookieValue = "";
		
		if ( check.checked )
        {
               setCookie('Preference',fieldValue,30);
        }
		if ( fieldValue == "" )
        {
                alert('Please select a location')

        }
        
            
        else
        {
       	
		 location.href="http://www.archonhospitality.com/"+fieldValue.substring(0,2)+"/";
        }
        return false;
}

