

var cstring = "<%= c_string %>";
var service;
if(cstring != ""){
  service = "ProductId="+cstring;
}
// Read a page's GET URL variables and return them as an associative array.
function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');

    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }

    return vars;
}

function HttpRequest(url){
  var pageRequest = false //variable to hold ajax object
  /*@cc_on
     @if (@_jscript_version >= 5)
        try {
        pageRequest = new ActiveXObject("Msxml2.XMLHTTP")
        }
        catch (e){
           try {
           pageRequest = new ActiveXObject("Microsoft.XMLHTTP")
           }
           catch (e2){
           pageRequest = false
           }
        }
     @end
  @*/
  
  if (!pageRequest && typeof XMLHttpRequest != 'undefined')
     pageRequest = new XMLHttpRequest()
  
  if (pageRequest){ //if pageRequest is not false
     pageRequest.open('GET', url, false) //get page synchronously
     pageRequest.send(null)
     embedpage(pageRequest)
     }
  }

  function embedpage(request){
  //if viewing page offline or the document was successfully retrieved online (status code=2000)
  if (window.location.href.indexOf("http")==-1 || request.status==200)
     document.write(request.responseText)
  }

function initialize() {
  var url = window.location.href;
  var nohttp = url.split('//')[1];
  var hostPort = nohttp.split('/')[1];
  if(hostPort == "contact-us.aspx"){
    var latlng = new google.maps.LatLng(36.10563,-115.193912);
    var myOptions = {
      zoom: 14,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    var marker = new google.maps.Marker({
      position: latlng,
      map: map
    });
  }
  var hash = getUrlVars();
  var iframeContent = "";
  if(hash['account']){
    iframeContent = '<iframe src="http://24.234.48.180:81/" width="100%" height="590px" frameborder="0" style="visibility:hidden" onload="this.style.visibility = \'visible\'"></iframe>';
  } else {
    if(service != null){
      iframeContent = '<div style="text-align:center;font-size:16px;">Have an account? <a href="reservation.aspx?account=Y">Sign In</a></div><br /><iframe src="http://24.234.48.180:81/WebConnectRes?RetailReservation=Y&'+service+'" width="100%" height="590px" frameborder="0" style="visibility:hidden" onload="this.style.visibility = \'visible\'"></iframe>';
    } else {
      iframeContent = '<div style="text-align:center;font-size:16px;">Have an account? <a href="reservation.aspx?account=Y">Sign In</a></div><br /><iframe src="http://24.234.48.180:81/WebConnectRes?RetailReservation=Y" width="100%" height="590px" frameborder="0" style="visibility:hidden" onload="this.style.visibility = \'visible\'"></iframe>';
    }
  }
  if(hostPort == "reservation.aspx?account=Y" || hostPort == "reservation.aspx"){
    if(document.getElementById("iframeDiv")){
      document.getElementById("iframeDiv").innerHTML = iframeContent;
    }
  }
}
