
var cityCode=getQueryVariable("City");
var domain="";
var cardtype="";
var prefix = cityCode.substring(0,2);
if(prefix == "Go"){
   cardtype="Go Card";
}
if(prefix == "Ex"){
   cardtype="Explorer Pass";
}
if(cityCode == "ExSFO"){
    domain ="explorerpass.com";
    cityCode="ExPAS";
}else if(cityCode == "ExBOS"){
    cityCode="ExPAS";
    domain ="explorerpass.com";
}else if(cityCode == "ExNYC"){
    cityCode="ExPAS";
    domain ="explorerpass.com";
}else if(cityCode == "ExWCO"){
    cityCode="ExPAS";
    domain ="explorerpass.com";
}else if(cityCode == "ExMIA"){
    cityCode="ExPAS";
    domain ="explorerpass.com";
}else if(cityCode == "ExCHI"){
    cityCode="ExPAS";
    domain ="explorerpass.com";
}else if(cityCode == "ExHLW"){
    cityCode="ExPAS";
    domain ="explorerpass.com";
}else if(cityCode == "ExORL"){
    cityCode="ExPAS";
    domain ="explorerpass.com";
}else if(cityCode == "ExLAS"){
    cityCode="ExPAS";
    domain ="explorerpass.com";
}else if(cityCode == "GoSFO"){
    domain ="gosanfranciscocard.com";
} else if(cityCode == "GoBOS"){
    domain ="gobostoncard.com";
} else if(cityCode == "GoCHI"){
    domain = "gochicagocard.com";
} else if(cityCode == "GoORL"){
    domain ="goorlandocard.com";
} else if(cityCode == "GoMIA"){
    domain ="gomiamicard.com";
} else if(cityCode == "GoSDO"){
    domain ="gosandiegocard.com";
} else if(cityCode == "GoSFO"){
    domain = "gosanfranciscocard.com";
} else if(cityCode == "GoSEA"){
    domain ="goseattlecard.com";
} else if(cityCode == "GoHIO"){
    domain ="gooahucard.com";
} else if(cityCode == "GoHIM"){
    domain ="gomauicard.com";
} else if(cityCode == "GoLAX"){
    domain ="golosangelescard.com";
} else if(cityCode == "GoSKI"){
    domain = "powderpassport.com";
} else if(cityCode == "seemyLA"){
    domain ="golosangelescard.com";
} else if(cityCode == "GoBLR"){
    domain ="goblueridgecard.com";
} else if(cityCode == "GoTOR"){
    domain ="gotorontocard.com";
} else if(cityCode == "sdi"){
    domain ="smartdestinations.com";
} else if(cityCode == "In"){
    domain ="tickego.com";
}

function prep() {

    //out going link tags 
    var citysite=document.getElementById("citysite");
    var returns=document.getElementById("returns");
    var security=document.getElementById("security");
    var privacy=document.getElementById("privacy");
    var contact=document.getElementById("contact");
    var contact2=document.getElementById("contact2");

    var cardtype1=document.getElementById("cardtype1");
    var cardtype2=document.getElementById("cardtype2");

    if(cardtype1 != null){
        cardtype1.innerHTML = cardtype;
    }
    if(cardtype2 != null){
        cardtype2.innerHTML = cardtype;
    } 
    //image tags
    var logo=document.getElementById("logo");
    var rightImage=document.getElementById("rightImage");
    logo.src="/template-resources/images/" + cityCode + "_city_logo.gif";
    rightImage.src="/template-resources/images/" + cityCode + "_right_image.jpg";

    //Email address href
    var infoMail=document.getElementById("infoMail");
    var infoMail2=document.getElementById("infoMail2");
    var infoMailAddress = "mail"; 
    infoMailAddress += "to:";
    infoMailAddress += "info";
    infoMailAddress += "@";
    
    //Fill out the hrefs if they exist on this page
    if(security){
        security.href="http://www." + domain + "/privacy.html#security";
    }
    if(privacy){
        privacy.href="http://www." + domain + "/privacy.html";
    }
    if(returns){
        returns.href="http://www." + domain + "/returns.html";
    }
    if(citysite){
        citysite.href="http://www." + domain;
    }
    if(contact){
        contact.href="http://www." + domain + "/contact.html";
    }
    if(contact2){
        contact2.href="http://www." + domain + "/contact.html";
    }

    if(infoMail){
        infoMailAddress += domain;
        infoMail.href=infoMailAddress;
        infoMail2.href=infoMailAddress;
    }
}

//Function to grab query string data
function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
      return pair[1];
    }
  } 
  //alert('Query Variable ' + variable + ' not found');
}

