function deletePortfolio()
{
        document.myPortfolio.action='deletePortfolio.jef';
		document.myPortfolio.method='post';
		document.myPortfolio.submit();

}

function displayPortfolio()
{
var portfolioName= document.portfolioNameData.portfolioSelect.value;
 if(portfolioName!='select'){
        document.portfolioNameData.portfolioSelect1.value = document.portfolioNameData.portfolioSelect.value;
        document.portfolioNameData.portfolioSelect.disabled=true;
        document.portfolioNameData.action='portfolioDisplay.jef';
		document.portfolioNameData.method='get';
		document.portfolioNameData.copyCondition.value='notCopied';
		document.portfolioNameData.submit();
		
		}else{
			alert('Please select the portfolio name');
			if(document.getElementById("hidePortNm")!=null){
				document.portfolioNameData.portfolioSelect.value=document.getElementById("hidePortNm").value;
			}
		}
}
  

function savePortfolio()
{
    var portfolioName=document.portfolioForm.name.value;
   var portfolioListName= document.portfolioNameData.portfolioSelect.value;
  
  if(portfolioName==''){
		alert("Please enter the portfolioName");
		document.portfolioForm.name.focus();
		return false;
}else{
	    document.portfolioForm.action='portfolioInsert.jef';
		document.portfolioForm.method='post';
		document.portfolioForm.submit();
	return true;
	}
return true;		
}

function editPortfolio()
{	  

document.portfolioNameData.copyCondition.value='copy'; 
document.getElementById('copyPortfolio').value=document.portfolioNameData.copyCondition.value;
document.portfolioNameData.action='portfolioDisplay.jef';
document.portfolioNameData.method='post';
document.portfolioNameData.submit();
		
			
}

function partDelPortfolio(){
		document.myPortfolio.action='saveDeletePro.jef';
		document.myPortfolio.method='post';
		document.myPortfolio.submit();
}


function updatePortfolio()
{
        document.myPortfolio.action='updatePortfolio.jef';
		document.myPortfolio.method='post';
		document.myPortfolio.submit();
}
function  portfolioPrint()
					{
				document.portfolioNameData.portfolioShow.value='print';
                document.portfolioNameData.action='portfolioDisplay.jef';
		        document.portfolioNameData.method='post';
		       document.portfolioNameData.submit();
					} 

function enableForm(index)
{
var index=index;



if(document.getElementById('copyPortfolio')!= null){
document.getElementById('copyPortfolio').value='copy';
}
if(document.getElementById('copyCondition')!= null){
document.getElementById('copyCondition').value='copy';
}


if(document.getElementById('portSucc')!=  null){
document.getElementById('portSucc').style.display = "none";
}
if(document.getElementById('portFail')!=  null){
document.getElementById('portFail').style.display = "none";
}
if(document.getElementById('delete')!= null){
document.getElementById('delete').style.display = "none";
}
if(document.getElementById('print')!= null){
document.getElementById('print').style.display = "none";
}

if(document.getElementById('email')!= null){
document.getElementById('email').style.display = "none";
}

if(document.getElementById('demo1')!= null){
document.getElementById('demo1').value="";

}
if(document.getElementById('createId')!= null){
document.getElementById('createId').style.display = "none";
}

document.myPortfolio.txt_port1.disabled=false;
document.myPortfolio.txt_port1.value='';
document.myPortfolio.txt_port1.focus();
for(var i=0;i<index;i++){
if(document.getElementById('comment'+i)!=null){
	document.getElementById('comment'+i).disabled=false;
 	}
}
}
// Removes leading whitespaces
function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
	return LTrim(RTrim(value));
	
}
function alphanumericTxtArea(id)
{
	var id = id;
	var alphane = document.getElementById(id).value;
	document.getElementById(id).value = trim(alphane);
	var numaric =  trim(alphane);
	for(var j=0; j<numaric.length; j++)
		{
		  var alphaa = numaric.charAt(j);
		  var hh = alphaa.charCodeAt(0);
		  
			if((hh > 47 && hh<58) || (hh > 64 && hh<91) || (hh > 96 && hh<123) || (hh>=38 && hh<=41) || (hh == 32) || (hh==34) || (hh == 44) || (hh==46))
			{
			
		  }else if(hh==13){
		  	alert("Enter is not allowed.");
		  	document.getElementById(id).focus();
			 return false;
		  }
		else{
			//alert("Please enter only valid Characters:- Alpha Numerics,\nSpace, dot(.), Single Quote('), Double Quote(\"),\nparathences (()), amberson (&)  and comma(,).");
			alert("Character ("+alphaa+") not allowed.");
			document.getElementById(id).focus();
			 return false;
		  }
		}
		
return true;
}
function alphaNumericNoSpace(id){
	var id = id;
	var alphane = document.getElementById(id).value;
	document.getElementById(id).value  =  trim(alphane);
	var numaric =  trim(alphane);
	for(var j=0; j<numaric.length; j++){
		  var alphaa = numaric.charAt(j);
		  var hh = alphaa.charCodeAt(0);
		  if((hh > 47 && hh<58) || (hh > 64 && hh<91) || (hh > 96 && hh<123) || hh == 32){
				
		  }else{
			alert("Please enter only Alpha Numeric values.");
			document.getElementById(id).value='';
			document.getElementById(id).focus();
  		  	return false;
		  }
		}
		
return true;
}
function AJAXCallClose(url){
//AJAX
//	var url = 'findCustomerProject.jef?repName='+repName+'&custName='+specCustName;
	var model = '';
	var arr = new Array();
	if (window.XMLHttpRequest) {
	   self.xmlHttpReq = new XMLHttpRequest();
	} else if (window.ActiveXObject) { 
	   self.xmlHttpReq = new ActiveXObject('Microsoft.XMLHTTP');
	}
  	self._async=Boolean(true);
	self.xmlHttpReq.open('POST', url, true);
	self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  	self.xmlHttpReq.onreadystatechange = function() {
  		if (self.xmlHttpReq.readyState == 4) {
  	  		if(self.xmlHttpReq.status == 200){
				var response = self.xmlHttpReq.responseText;
			}
	  	}
	 }
    self.xmlHttpReq.send('');
//AJAX   
}
