
function openWindowQuickCheck() 
{ 
    window.open('/pages/quickcheck_popup.html','quickcheck_popup','toolbar=0,resizable=1,menubar=0,location=0,status=0,scrollbars=3,width=550,height=360,screenX=30,screenY=25,left=30,top=25'); 
}

function benumberone()
{

    if (top.location != location) {
        top.location.href = document.location.href ;
    }

}

function showuserrev_rules()
{
    var tgtUrl = "/pages/userrev_rules.html";
    window.open ( tgtUrl, "userrev_rules", "toolbar=0,resizable=1,menubar=0,location=0,status=0,scrollbars=3,width=500,height=400,screenX=30,screenY=25,left=30,top=25");
}

function popularityIndex()
{
    var tgtUrl = "/pages/hotel_popularity_popup.html";
    window.open ( tgtUrl, "hotel_popularity_popup", "toolbar=0,resizable=1,menubar=0,location=0,status=0,scrollbars=3,width=500,height=400,screenX=30,screenY=25,left=30,top=25");
}

function cityPopularityIndex()
{
    var tgtUrl = "/pages/city_popularity_popup.html";
    window.open ( tgtUrl, "city_popularity_popup", "toolbar=0,resizable=1,menubar=0,location=0,status=0,scrollbars=3,width=500,height=400,screenX=30,screenY=25,left=30,top=25");
}

function smartDeals()
{
    var tgtUrl = "/pages/smart_deals_popup.html";
    window.open ( tgtUrl, "smart_deals_popup", "toolbar=0,resizable=1,menubar=0,location=0,status=0,scrollbars=3,width=350,height=350,screenX=30,screenY=25,left=30,top=25");
}

function showPricingTerms()
{
    var tgtUrl = "/pages/pricing_terms.html";
    window.open ( tgtUrl, "PricingTermsAndConditions", "toolbar=0,resizable=1,menubar=0,location=0,status=0,scrollbars=3,width=300,height=300,screenX=30,screenY=25,left=30,top=25");
}

/* added by jay 4/16/04 to support popup privacy link */
function showPrivacyPolicy()
{
    var tgtUrl = "/pages/privacy_plain.html";
    window.open ( tgtUrl, "PrivacyPolicy", "toolbar=0,resizable=1,menubar=0,location=0,status=0,scrollbars=3,width=500,height=300,screenX=30,screenY=25,left=30,top=25");
}

function OnSelectDestination ( newURL ) 
{ 
    if ( newURL != "" ) 
        if ( newURL != "none") 
            location.href = newURL; 
}

function submitForm(name) 
{ 
    eval("document." + name + ".submit()"); return; 
}

function PopupOnSelectDestination ( newURL ) 
{ 
    if ( newURL != "" ) 
        if ( newURL != "none")
            if(opener == null || opener.closed == true)
                {
                    window.open(newURL, 'TripAdvisor');
                }
            else
                {
                    opener.location.href = newURL; 
                }
    self.close();
}

function submitNewsletter()
{
    document.newsletter.submit();
    self.close();    
}

function setBlackout()
{
    document.cookie = 'NLPB=true';
    setCookie('NLPB', 'true', 1);         
}

function popDYKWindow(sUrl)
{       
    setBlackout();
    var w = window.open(sUrl, 'TripAdvisor', 'toolbar=1,location=1,status=1,menubar=1,resizable=1,copyhistory=1,scrollbars=1');
    self.close();
}

function focusOpener()
{
    if(self.opener != null)
        {
            self.opener.focus();
        }
}

function getCookie(name)
{
    var sCookies = document.cookie;
    var sPrefix = name + '=';
    
    if(sCookies == null)
        {
            return null;
        }
    
    var nBegin = sCookies.indexOf('; ' + sPrefix);
    if(nBegin == -1)
        {
            nBegin = sCookies.indexOf(sPrefix);
            if(nBegin == -1)
                {
                    return null;
                }
        }
    else
        {
            nBegin += 2;
        }
    var nEnd = sCookies.indexOf(';', nBegin);
    if(nEnd == -1)
        {
            nEnd = sCookies.length;
        }
    
    return unescape(sCookies.substring(nBegin + sPrefix.length, nEnd));
}

function setCookie(sName, sValue, nDays)
{
    var dExpires = null;
    if(nDays > 0)
        {
            dExpires = new Date();
            dExpires.setTime(dExpires.getTime() + (nDays * 24 * 3600 * 1000));
        }
    
    var sCookie = sName + "=" + escape(sValue) +
        ((dExpires == null) ? "" : "; expires="
        + dExpires.toGMTString())
	+ "; path=/";
    sCookie += "; domain=.tripadvisor.com";
    document.cookie = sCookie;

}

var nCurrentWindowOffset = 0;

function makeOptions() 
{
    var nW = 475;
    var nH = 390;
    var nXI = 24;
    var nYI = 24;
    var nX = 210;
    var nY = 5;

    if(screen.width > 1024) { 
        nW = 800;
        nH = 600;
        nX = 240;
    } else if(screen.width > 800) {
        nW = 620;
        nH = 500;
        nX = 240;
    }

    nCurrentWindowOffset ++;

    return 'toolbar=1,scrollbars=1,location=1,status=1,menubar=1,resizable=1,left=' + (nX + (nCurrentWindowOffset * nXI)) + ',top='+ (nY + (nCurrentWindowOffset * nYI)) + ',width=' + nW + ',height=' + nH;
}

