/* Salary.com javascript function Copyright 2006 Salary.com, Inc*/
function salGetPageName (strLocation){
    if (strLocation == "")	
		return "";
		
    var iDotIdx = 0;
    var iNumOfCharToAdd = 0;
    var iSlash = strLocation.lastIndexOf("/");
    var strPageName = "";
    
    if (strLocation.indexOf(".asp")>0)
    {    
		iDotIdx = strLocation.indexOf(".asp");
		iNumOfCharToAdd = 4;
	}
	else if (strLocation.indexOf(".html")>0)
    {    
		iDotIdx = strLocation.indexOf(".html");
		iNumOfCharToAdd = 5;
	}
	else if (strLocation.indexOf(".htm")>0)
    {    
		iDotIdx = strLocation.indexOf(".htm");
		iNumOfCharToAdd = 4;
	}
    
   
    if (iDotIdx > 0)
    {
		strPageName = strLocation.substring(iSlash+1,iDotIdx + iNumOfCharToAdd);
    }
    return strPageName;
	//var curQS = strLocation.substring(iIdx+1,strLocation.length);
    	
}

function salGetQSParam (strLocation, strParam){
    if (strLocation == "")	
		return "";
		
    var iParamIdx = 0;
    var iAmpIdx = 0;
    var strValue = "";
    var strTemp = "";
    
    if (strLocation.indexOf('?' + strParam + '=')>0)
    {    
		iParamIdx = strLocation.indexOf('?' + strParam + '=');
		iParamIdx = iParamIdx + strParam.length + 1;
		strValue = strLocation.substring(iParamIdx+1,strLocation.length+1);
		if (strValue.indexOf('&')>0)
			strValue = strValue.substring(0,strValue.indexOf('&'));
	}
	else if (strLocation.indexOf('&' + strParam + '=')>0)
    {    
		iParamIdx = strLocation.indexOf('&' + strParam + '=');
		iParamIdx = iParamIdx + strParam.length + 1;
		strValue = strLocation.substring(iParamIdx+1,strLocation.length+1);
		if (strValue.indexOf('&')>0)
			strValue = strValue.substring(0,strValue.indexOf('&'));
	} 
    
    return strValue;
    	
}

function salGetVirName (strLocation){
    if (strLocation == "")	
		return "";
	if (strLocation.indexOf('://')>0)
		strLocation = strLocation.substring(strLocation.indexOf('://')+3, strLocation.length+1);
    
    var iSlashIdx = 0;
    var strValue = "";

    if (strLocation.indexOf('/')>0)
    {    
		iSlashIdx = strLocation.indexOf('/');
		strValue = strLocation.substring(iSlashIdx+1,strLocation.length+1);
		if (strValue.indexOf('/')>0)
			strValue = strValue.substring(0,strValue.indexOf('/'));
	}   
    return strValue;
    	
}
function salGetProdName (strLocation){
    if (strLocation == "")	
		return "";

	if (strLocation.indexOf('://')>0)
		strLocation = strLocation.substring(strLocation.indexOf('://')+3, strLocation.length+1);
	
    var iSlashIdx = 0;
    var strValue = strLocation;

    if (strLocation.indexOf('/')>0)
    {    
		iSlashIdx = strLocation.indexOf('/');
		strValue = strLocation.substring(0,iSlashIdx);
	}   
	strValue = strValue.toLowerCase();
	
	/*if (strValue.toLowerCase().indexOf('monster.ca')>=0)
		return "monsterca";

	if (strValue.toLowerCase().indexOf('monster.')>=0)
		return "monster";

	if (strValue.toLowerCase().indexOf('aol.')>=0)
		return "aol";

	if (strValue.toLowerCase().indexOf('nytimes.')>=0)
		return "nytimes";

	if (strValue.toLowerCase().indexOf('hotjobs.')>=0)
		return "hotjobs";

	if (strValue.toLowerCase().indexOf('workopolis.')>=0)
		return "workopolis";

	if (strValue.toLowerCase().indexOf('employmentguide.')>=0)
		return "employmentguide";

	if (strValue.toLowerCase().indexOf('cnnmoney.')>=0)
		return "cnnmoney";

	if (strValue.toLowerCase().indexOf('aftercollege.')>=0)
		return "aftercollege";
	*/	
	var iDotSalaryIdx = 0;
    if (strValue.indexOf('.salary.com')>0)
    {  //Handles xxx.salary.com, xxx.xxx.salary.com  
		iDotSalaryIdx = strValue.indexOf('.salary.com');
		strValue = strValue.substring(0,iDotSalaryIdx);
	}  
	else
	{//Handles salary.xxx.com, salary.xxx.xxx.com  
		strValue = strValue.replace('salary.', '');
		strValue = strValue.replace('.com', '');
	}

	/*var iSecDotIdx = 0;
	if( strValue.toLowerCase() == "salary")
	{
		iSecDotIdx = strLocation.indexOf('.', iDotIdx+1);
		strValue = strLocation.substring(iDotIdx+1, iSecDotIdx);
	}*/

    return strValue;
    	
}
function salGetHiddenValue(objControl)
{
	if (objControl)
		return objControl.value;
	else
		return "";
		
}

