/* get cslink and ulink */
var mainQueryString = "";
if ( window.top.location.search != 0 ) {
    mainQueryString = window.top.location.search;
} else {
    mainQueryString = "";
}

function getParameter ( queryString, parameterName ) {
// Add "=" to the parameter name (i.e. parameterName=value)
    var parameterName = parameterName + "=";
    if ( queryString.length > 0 ) {
// Find the beginning of the string
        begin = queryString.indexOf ( parameterName );
// If the parameter name is not found, skip it, otherwise return the value
        if ( begin != -1 ) {
// Add the length (integer) to the beginning
            begin += parameterName.length;
// Multiple parameters are separated by the "&" sign
            end = queryString.indexOf ( "&" , begin );
            if ( end == -1 ) {
                end = queryString.length
            }
// Return the string
// no need for unescape as the tagging code does this below
// return unescape ( queryString.substring ( begin, end ) );
            return queryString.substring ( begin, end );
        }
    }
// Return zero-length string if no parameter has been found
    return "";
}


var pageCslink = getParameter ( mainQueryString, 'cslink' );
var pageUlink = getParameter ( mainQueryString, 'ulink' );


/* determine pageLocationType */
if ((typeof(valuesObj) != 'undefined') && (typeof(valuesObj.recLocs) != 'undefined')) {
    var cookie = valuesObj.recLocs[0];
    if (cookie.street) {
        pageLocationType = 'address';
    } else if (cookie.city_state)  {
        pageLocationType = 'market';
    } else {
        pageLocationType = 'world';
    }
} else {
    pageLocationType = 'unavailable';
}

/* check that ModuleKey has been created above */
if (typeof(ModuleKey) == 'undefined') {
    var ModuleKey = "default";
} 

/* generate image call */
tagProt = "http";
if (document.location.protocol.indexOf('https') > -1)
{  tagProt = "https"; }
var ES = "28~" + pageProperty + "~5~" + pagePagename + "~100~cityguide~101~" + pageBrand + "~102~" + pageMarket + "~103~" + pageType + "~104~" + pageCslink + "~105~" + pageUlink + "~106~" + pageLocationType + "~136~" + ModuleKey + "~327~" + pageErrorCode + "~334~" + siteVersion + "~371~" + sessionId;
var RN = 0;
var e5 = document.URL.toLowerCase();
RN=Math.floor(Math.random()*10000);
var TR = document.referrer.toLowerCase();
DI = e5.indexOf("//");
if (DI != -1)
{  chkDom = e5.substring (DI + 2);
   DI = chkDom.indexOf ("/");
   if (DI != -1) { chkDom = chkDom.substring(0,DI) }
   var TR = document.referrer.toLowerCase();
   if (TR != "" && ((TR.indexOf (chkDom) == -1) || (TR.indexOf (chkDom) > 15)))
   {   TR = escape (TR); SI = TR.indexOf ("/");
   while (SI  >= 0)
   {  st = TR.substring (0,SI); en = TR.substring (SI+1);
      TR = st + "%2F" + en; SI = TR.indexOf ("/"); }
   ES = "2~" + TR + "~" + ES; } }

ES="7~" + screen.width + "x" + screen.height + "~" + ES;

if (typeof(ESCust) != "undefined")
{ ES = ESCust + ES;}
if (ES != "") {  ES = "&event=" + ES; }
document.write ("<img name='hs_pix_es' src='" + tagProt + "://capture.citysearch.com/spacer.gif?random=" + RN + ES + "' border=0 height=1 width=1>");
