function BuildLinkWithKeywords()
{
    var strSearch = document.getElementById("txtSearch").value;
    var strCityZip = document.getElementById("txtCityZip").value;
	
	 if (strSearch.length == 0 & strCityZip.length == 0)
	 {
    	alert ("You must specify at least one keyword or a city!")
	 }
	 else
	 {
	    strSearch = strSearch.replace(/&/g," and ");
	    strSearch = strSearch.replace(/,/g," ");
	    strSearch = strSearch.replace(/  /g," ");
	    window.location = "/search.asp?strFunction=BuildCustomerListFromKeywords&strSearch=" + strSearch + "&strCityZip=" + strCityZip + "&intRecordFrom=1&intSearch=1";
	    // 2010-05-05 Search URL Cleanup idea 
	    // window.location = "/search.asp?q=" + strSearch + "&city=" + strCityZip + "&intRecordFrom=1&intSearch=1";
	 }
}

function StatChangeCust(intCustId)
{
	window.location = "/default.asp?strFunction=GetStatReports&intCustId=" + intCustId;
}

function BuildAlphaLink(strLetter)
{
	window.location = "/bizlist.asp?strFunction=BuildAlphaCustList&strLetter=" + strLetter + "&optSort1=" + document.getElementById("optSort1").checked + "&optSort2=" + document.getElementById("optSort2").checked;
}

function OpenMap(intCustId)
{
	if (window.screen.width < 1024)
	{
		window.open("/usertracking.asp?strCode=MAP&intCustId=" + intCustId + "&strDescription=Map","","width=750,height=500,scrollbars=yes,left=" + ((window.screen.width - 750)/2) + ",top=" + ((window.screen.height - 500) /2));
	}
	else if (window.screen.width < 1025)
	{
		window.open("/usertracking.asp?strCode=MAP&intCustId=" + intCustId + "&strDescription=Map","","width=750,height=600,scrollbars=yes,left=" + ((window.screen.width - 750)/2) + ",top=" + ((window.screen.height - 600) /2));
	}
	else
	{
		window.open("/usertracking.asp?strCode=MAP&intCustId=" + intCustId + "&strDescription=Map","","width=750,height=730,left=" + ((window.screen.width - 750)/2) + ",top=" + ((window.screen.height - 730) /2));
	}
}

function OpenMap2(intCustId)
{
	if (window.screen.width < 1024)
	{
		window.open("map.asp?intCustId=" + intCustId,"","width=750,height=500,scrollbars=yes,left=" + ((window.screen.width - 750)/2) + ",top=" + ((window.screen.height - 500) /2));
	}
	else if (window.screen.width < 1025)
	{
		window.open("map.asp?intCustId=" + intCustId,"","width=750,height=600,scrollbars=yes,left=" + ((window.screen.width - 750)/2) + ",top=" + ((window.screen.height - 600) /2));
	}
	else
	{
		window.open("map.asp?intCustId=" + intCustId,"","width=750,height=730,left=" + ((window.screen.width - 750)/2) + ",top=" + ((window.screen.height - 730) /2));
	}
}

function OpenBizProfile(intCustId)
{
	window.open("/usertracking.asp?strCode=PRO&intCustId=" + intCustId + "&strDescription=Profile","","width=470,height=520,left=" + ((window.screen.width - 470)/2) + ",top=" + ((window.screen.height - 520) /2));
}

function OpenBizProfile2(intCustId)
{
	window.open("/bizprofile.asp?intCustId=" + intCustId,"","width=470,height=520,left=" + ((window.screen.width - 470)/2) + ",top=" + ((window.screen.height - 520) /2));
}

function OpenEmplProfile(intAdId)
{
	window.open("/employment/emplprofile.asp?intAdId=" + intAdId,"","width=470,height=520,scrollbars=yes,left=" + ((window.screen.width - 470)/2) + ",top=" + ((window.screen.height - 520) /2));
}

function BuildOH(intCustId)
{
    window.open("/usertracking.asp?strCode=HRS&intCustId=" + intCustId + "&strDescription=Hours","","width=210,height=210,left=" + ((window.screen.width - 210)/2) + ",top=" + ((window.screen.height - 210)/2));
}

function BuildOH2(intCustId)
{
	var IE = document.all?true:false;		
	if (!IE)
	{
		if (((intY) + 210) > (window.screen.height))
		{
			if (((intX) + 210) > (window.screen.width))
			{
				window.open("oh.asp?intCustId=" + intCustId,"","width=210,height=210,left=" + (window.screen.width -210) + ",top=" + (window.screen.height -210));
			}
			else
			{
				window.open("oh.asp?intCustId=" + intCustId,"","width=210,height=210,left=" + intX + ",top=" + (window.screen.height -210));
			}
		}
		else
		{
			if (((intX) + 210) > (window.screen.width))
			{
				window.open("oh.asp?intCustId=" + intCustId,"","width=210,height=210,left=" + (window.screen.width -210) + ",top=" + intY);
			}
			else
			{
				window.open("oh.asp?intCustId=" + intCustId,"","width=210,height=210,left=" + intX + ",top=" + intY);
			}
		}
	}
	else
	{
		if (((window.event.screenY) + 210) > (window.screen.height))
		{
			if (((window.event.screenX) + 210) > (window.screen.width))
			{
				window.open("oh.asp?intCustId=" + intCustId,"","width=210,height=210,left=" + (window.screen.width -210) + ",top=" + (window.screen.height -210));
			}
			else
			{
				window.open("oh.asp?intCustId=" + intCustId,"","width=210,height=210,left=" + window.event.screenX + ",top=" + (window.screen.height -210));
			}
		}
		else
			{
			if (((window.event.screenX) + 210) > (window.screen.width))
			{
				window.open("oh.asp?intCustId=" + intCustId,"","width=210,height=210,left=" + (window.screen.width -210) + ",top=" + window.event.screenY);
			}
			else
			{
				window.open("oh.asp?intCustId=" + intCustId,"","width=210,height=210,left=" + window.event.screenX + ",top=" + window.event.screenY);
			}
		}
	}
}

function OpenDiscounts(intCustId)
{
	var IE = document.all?true:false;		
	if (!IE)
	{
		if (((intY) + 330) > (window.screen.height))
		{
			if (((intX) + 330) > (window.screen.width))
			{
				window.open("discount.asp?intCustId=" + intCustId,"","width=330,height=183,scrollbars=yes,left=" + (window.screen.width -330) + ",top=" + (window.screen.height -330));
			}
			else
			{
				window.open("discount.asp?intCustId=" + intCustId,"","width=330,height=183,scrollbars=yes,left=" + intX + ",top=" + (window.screen.height -330));
			}
		}
		else
		{
			if (((intX) + 330) > (window.screen.width))
			{
				window.open("discount.asp?intCustId=" + intCustId,"","width=330,height=183,scrollbars=yes,left=" + (window.screen.width -330) + ",top=" + window.event.screenY);
			}
			else
			{
				window.open("discount.asp?intCustId=" + intCustId,"","width=330,height=183,scrollbars=yes,left=" + intX + ",top=" + intY);
			}
		}
	}
	else
	{
		if (((window.event.screenY) + 330) > (window.screen.height))
		{
			if (((window.event.screenX) + 330) > (window.screen.width))
			{
				window.open("discount.asp?intCustId=" + intCustId,"","width=330,height=183,scrollbars=yes,left=" + (window.screen.width -330) + ",top=" + (window.screen.height -330));
			}
			else
			{
				window.open("discount.asp?intCustId=" + intCustId,"","width=330,height=183,scrollbars=yes,left=" + window.event.screenX + ",top=" + (window.screen.height -330));
			}
		}
		else
			{
			if (((window.event.screenX) + 330) > (window.screen.width))
			{
				window.open("discount.asp?intCustId=" + intCustId,"","width=330,height=183,scrollbars=yes,left=" + (window.screen.width -330) + ",top=" + window.event.screenY);
			}
			else
			{
				window.open("discount.asp?intCustId=" + intCustId,"","width=330,height=183,scrollbars=yes,left=" + window.event.screenX + ",top=" + window.event.screenY);
			}
		}
	}
}

function imagechange(imagePath,imageID,imageName) 
{
   document.images[imageID].src = imagePath + "buttons/" + imageName + ".gif";
}


function m_on(imagename)
{
	if (document.images)
	{
		document [imagename].src = eval(imagename + "_MO.src");
	}
}

function m_out(imagename)
{
	if (document.images)
	{
		document [imagename].src = eval(imagename + ".src");
	}
}

function DTCRound(value, decimals)
{
    return(
              parseFloat(value) != "NaN" && parseInt(decimals) != "NaN" 
              ? (Math.round(value * Math.pow(10, decimals))) / Math.pow(10, decimals) 
              : "NaN"
              );
}

function clickSwitch(linker,switchbox)
{
    box = document.getElementById(switchbox);
    link = document.getElementById(linker);
    link.innerHTML=box.style.display=='none'?'Collapse Article':'Read More';
    box.style.display=box.style.display=='none'?'':'none';
}


