//gets the psid value from the cookie
function getpsidcookie() {
	var PSID = "";
    var dc = document.cookie;
    var prefix = PSID + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

// returns prod env true/false...add prod apps as needed
function isProduction() {
	var theLocation = document.location.href;
	if (theLocation.indexOf("www.sybase.com") > -1 ||
	    theLocation.indexOf("search.sybase.com") > -1 ||
	    theLocation.indexOf("downloads.sybase.com") > -1 ||
	    theLocation.indexOf("profile.sybase.com") > -1 ||
	    theLocation.indexOf("login.sybase.com") > -1 ||
	    theLocation.indexOf("my.sybase.com") > -1 ||
	    theLocation.indexOf("eshop.sybase.com") > -1 ||
	    theLocation.indexOf("certification.sybase.com") > -1 ||
	    theLocation.indexOf("info.sybase.com") > -1 ||
	    theLocation.indexOf("forums.sybase.com") > -1 ||
	    theLocation.indexOf("case-express.sybase.com") > -1 ||
	    theLocation.indexOf("sybooks.sybase.com") > -1 ||
	    theLocation.indexOf("infocenter.sybase.com") > -1 ||
	    theLocation.indexOf("ptnrweb.sybase.com") > -1 ||
	    theLocation.indexOf("crm.sybase.com") > -1 ||
	    theLocation.indexOf("jobs.sybase.com") > -1 ||
	    theLocation.indexOf("surveys.sybase.com") > -1 ||
	    theLocation.indexOf("sed.sybase.com") > -1 ||
	    theLocation.indexOf("slc.sybase.com") > -1  ){
		
		return true;
	} else {
		return false;
	}
}

// returns domain env true/false...add prod apps as needed
function whichApp() {
	var theLocation = document.location.href;
	var theQueryString = document.location.search;
	var app = "";
	
	if (theLocation.indexOf("/eshop") > -1 ){		
		return "eshop";
	} 
	
	if (theLocation.indexOf("/search/simple.do") > -1 ||
	    theLocation.indexOf("/search/advanced.do") > -1 ){		
		return  "search";
	}
	
	return "none"
 
}

//gets the correct websidestory account number for env
function getWSSAccount() {
	if (isProduction()){
	    account_no = "DM55021041AA94EN3"  
   	} else {
	    account_no = "DM550401PMDV94EN3"   	
   	} 
	return account_no;
}
