function replace(string,text,by) {
// Replaces text with by in string
	var strLength = string.length, txtLength = text.length;
	if ((strLength == 0) || (txtLength == 0)) return string;

	var i = string.indexOf(text);
	if ((!i) && (text != string.substring(0,txtLength))) return string;
	if (i == -1) return string;

	var newstr = string.substring(0,i) + by;

	if (i+txtLength < strLength)
		newstr += replace(string.substring(i+txtLength,strLength),text,by);

	return newstr;
}

function swapChart(chartSrc, chartTitle) {
	var t = document.getElementById("chartTitle");
	document.images['chartImage'].src = chartSrc;
    t.innerHTML=chartTitle;
}
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}


function deletePort() {
	portfolioID = document.portForm.portfolioID.options[document.portForm.portfolioID.selectedIndex].value;
	if (confirm('Are you sure you want to delete this portfolio?  This cannot be undone!')) {
        	document.location.replace('deletePortfolio.php?portfolioID=' + portfolioID);
	} else {
        	return false;
	}
}

function editPort(exists) {
        var portfolioID = -1;
        if (exists) {
		portfolioID = document.portForm.portfolioID.options[document.portForm.portfolioID.selectedIndex].value;
        }
        document.location.replace('editPortfolio.php?portfolioID=' + portfolioID);
}


function openLogin(product)
  		{
		didsignup=1;
		window.open('http://secure.money.net/scripts/rtloginform?partnerid=PCQ&product=' + product,'Launch_' + product,'left=0,top=0,screenX=0,screenY=0,width=790,height=570,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no');
		}

function openSignup(product)
		{
		window.open('https://secure.money.net/realtime/cc/signup.php?partnerid=PCQ&product=' + product,'Launch_' + product,'left=0,top=0,screenX=0,screenY=0,width=790,height=570,toolbar=no,location=no,diectories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no');
		}

function windowPop(url,name,features)
  {
    window.open(url,name,features);
  }
function catchexit() {
	if(document.location){
		alert("pcq");
		window.open('http://www.money.net', '_blank');
	}
}  	

if (window.attachEvent) window.attachEvent("onload", sfHover);



// user account for google analytics urchin bot.
_uacct = "UA-685846-2";
urchinTracker();
//setTimeout("try{urchinTracker();}catch (e){}",1000);
