function addToPortfolio(pfID) {
	
	var src="/jsp/intrade/portfolio/portfoliomanage.jsp";
	src +="?add=true&portfolio="+pfID;
	
	if(document.pfForm.pf != null){             
		if(document.pfForm.pf.length > 1){
			for(var i = 0; i < document.pfForm.pf.length; i++){
				if(document.pfForm.pf[i].checked)
					src +="&ContractID="+document.pfForm.pf[i].value;
			}
		}else{
			if(document.pfForm.pf.checked)
				src +="&ContractID="+document.pfForm.pf.value;
		}
	}

	resultWin =	window.open(src,"port_results","scrollbars=1,width=700,height=400,resizable=yes,status=no");
	resultWin.focus();



}



function showPFLinks(){
    
	var username = GetCookie("username");
	var show =  username != null && username.length >0;
	
        var elemAry = $('searchResultsDiv').getElementsByTagName("INPUT");
    
	if(null != elemAry){
		for(var i=0;i<elemAry.length;i++){                                             
                     
			var elem = elemAry[i];
			if(show)
				elem.style.visibility="visible";
			else
				elem.style.visibility="hidden";
		
		}
	}

    elemAry = document.getElementsByTagName("A");
	if(null != elemAry){
		for(var i=0;i<elemAry.length;i++){
			var elem = elemAry[i];
			if(elem.parentNode.className=="pf"){
				elem.title="Subscribe for marketdata update messages";
			}
			if(show)
				elem.style.visibility="visible";
		
		}
	}



}


function addMessage(conID){
	showWin("/messaging/addMDSubscription.jsp?conID="+conID, "mdsub", 750, 500, false, false);
	return false;
}
