function imgChange( oImg, sImg )
{	oImg.src = sImg;
	oImg.style.cursor="pointer"; }	

function fnRedirect( sUrl, sTarget, sPage, iMenu1Id ){	document.location.href = sUrl; }
function setLocation(sPage) { document.location.href = sPage; }
function PreLoadImages( aImages, sImgFolder ) {
	for ( var i = 0; i < aImages.length; i++ )	{
		var imageObject = new Image();
		imageObject.src = sImgFolder + aImages[ i ];	}			
}
function OpenForum() {
    var page = 'http://commercialestimators.com/forums/69.aspx';
    var title = 'CommercialEstimators';
    var width = '1000';
    var height = '600';
    var options = 'resizable=yes,scrollbars=yes,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes';
    var fixed = 'no';
	var popupWidth;
	var popupHeight;
	var popupTop;
	var popupLeft;
	if (fixed=='yes') {
		if (width==0)
			popupWidth = screen.width - 100;
		else
			popupWidth = width;
		if (height==0)
			popupHeight = screen.height - 100;
		else
			popupHeight = height;
	} else {
		if (width==0)
			popupWidth = screen.width - 100;
		else
			popupWidth = screen.width * width / 800;
		if (height==0)
			popupHeight = screen.height - 100;
		else
			popupHeight = screen.height * height / 600;
	}
	//center the popup
	var screenX;
	var screenY;
	screenY = screen.availHeight;
	screenX = screen.availWidth;
	popupLeft = (screenX - popupWidth) / 2;
	popupTop = (screenY - popupHeight) / 2;
	if (navigator.appName.indexOf("Microsoft")<0) {
		popupLeft = (popupLeft - pageXOffset);
		popupTop = (popupTop - pageYOffset);
	}
	if (popupTop<0) popupTop=0;
	if (popupLeft<0) popupLeft=0;
		
	//opens the popup
	if (navigator.appName.indexOf("Microsoft")>=0) 
	{
		if (options != '') options+=',';
		options+='width='+popupWidth+',height='+popupHeight+',left='+ popupLeft +',top='+popupTop;
	}
	else
	{
		if (options != '') options+=',';
		options+='width='+popupWidth+',height='+popupHeight+',screenX='+ popupLeft +',screenY='+popupTop;
	}
    var floater=window.open(page,title,options);
    floater.focus();
    return floater;
}
function ClickOptions(option)
{
    switch (option)
    {
    case 1 : document.location ="features.aspx"; break;
    case 2 : document.location ="pricing.aspx"; break;
    case 3 : document.location ="training.aspx"; break;
    case 4 : document.location ="demos.aspx"; break;
    case 5 : OpenForum(); break;
    case 6 : document.location ="tryit.aspx"; break;
    case 7 : document.location ="subs.aspx"; break;
    }
}
function openDemos(movieFile) {
    var page = 'trainingPopup.asp?movieFile=?'+movieFile;
    winStats='toolbar=no,location=no,directories=no,menubar=no,'
    winStats+='scrollbars=yes,width=1016,height=517';
    if (navigator.appName.indexOf("Microsoft")>=0) {
        winStats+=',left=10,top=10'
    }else{
        winStats+=',screenX=10,screenY=25'
    }
    floater=window.open(page,"",winStats)
}

function parseDate(obj, sDate) {
    var sYear = sDate.substring(0, 4);
    var sMonth = sDate.substring(5, 7);
    var sDay = sDate.substring(8, 10);
    var dDate = new Date(sYear, sMonth - 1, sDay);
    obj.innerHTML = dateFormat(dDate, "mm/dd/yyyy");
}

function parseDate1(obj, sDate, prefix) {
    var sYear = sDate.substring(0, 4);
    var sMonth = sDate.substring(5, 7);
    var sDay = sDate.substring(8, 10);
    var dDate = new Date(sYear, sMonth - 1, sDay);
    obj.innerHTML = prefix;
    obj.innerHTML += dateFormat(dDate, "mm/dd/yyyy");
}
function parseText(obj, sText, nCharacter){
    if (sText.length > nCharacter){
        sText = sText.substr(0,nCharacter-3) + "...";
    }
    obj.innerHTML = sText;
}
function replaceText(id) {
    var value = document.getElementById("spNewsDesc_" + id).innerHTML;
    value = value.replace(/&amp;/gi, "&");
    value = value.replace(/&lt;/gi, "<");
    value = value.replace(/&gt;/gi, ">");
    document.getElementById("spNewsDesc_" + id).innerHTML = value;
}

