/***************************************************************************************************************
*	File Name   : CommonFunctions.js 									*		
*	Created On  : 13/06/2004										*	
*	Description : This file Contains the functions to perform client side 					*	
***************************************************************************************************************/
//This function opens the buddielist.
function openAlertWindow(pSid)
{
	if(navigator.appName.indexOf("Internet Explorer") != -1)
	{
		winMail = window.open("alertWindow.php?"+pSid,"_blank","height=400px,width=550px,status=yes,toolbar=no,menubar=no,location=no");
	}
}


//This function opens the buddielist.
function openBuddyList(pSid)
{
	if(navigator.appName.indexOf("Internet Explorer") != -1)
	{
		//winMail = window.showModalDialog("mailEditor.php",trim(document.frmResult.mailList.value).substring(1),"dialogHeight:560px;dialogWidth:574px;scroll:no;");
		winMail = window.open("buddieList.php?"+pSid,"_blank","height=520px,width=574px,status=yes,toolbar=no,menubar=no,location=no");
	}
}

function addToBuddyList(pList,pSid)
{
	if(trim(pList))
		winMail = window.open("addToBuddyList.php?"+pSid+"&L="+pList,"_blank","height=200px,width=500px,status=yes,toolbar=no,menubar=no,location=no");
	else
		alert("Please Select Member(s) to add to your Buddie List");
}

//This function will add a mail id into an array of mail id's 
function AddIdToList(pCntId,pListField)
{
	var cntids = trim(pListField.value);

	cntids = cntids + ',' + pCntId;
	pListField.value=cntids;
}


//This function will remove the mailid from the list of mail id's 
function RemoveFromList(pCntId,pListField)
{
	var cntids=trim(pListField.value);
	tempids=cntids.replace(','+pCntId,'');
	pListField.value=tempids;
}


function openProfiler(cid,pSid)
{
	winProf = window.open("viewMemProfile.php?"+pSid+"&C="+cid,"_blank","height=600px,width=600px,left=100px,top=100px,status=yes,toolbar=no,scrollbars=yes,menubar=yes,location=no");
}

//This fucntion opens the print window.

function openPrintWindow(param)
{
	//alert(param);
	window.print();
	//winProf = window.open("printMemberList.php?<?=SID?>&"+param,"_blank","height=600px,width=800px,status=yes,toolbar=no,scrollbars=yes,menubar=yes,location=no,resizable = yes");
}

//This function shows the download menu.
function showDownloadMenu()
{
	document.getElementById('tblDownLoad').style.display="Block";
	document.getElementById('tdDownload1').focus();
	//document.getElementById('tdDownload2').focus();
}


//The function to hide the pop up menu.
function hideDownloadMenu()
{
	if(event.toElement)
	{
		if(event.toElement.name!='tdDownload1' && event.toElement.name!='toExcel' && event.toElement.name!='tdDownload2' && event.toElement.name!='toCSV')
		{
			//alert(event.srcElement.name);
			//alert(document.getElementById('tblDownLoad'));	
			document.getElementById('tblDownLoad').style.display="none";
		}
	}
}

//This function captures an paragraph and changes its properties to reduce the margin in the Para Tag 
function reduceParaSpacing(pString)
{

	re = /<P>/gi;
	newptag = "<P MARGIN-TOP: 5px;FONT-SIZE: 11px;MARGIN-BOTTOM: 5px;COLOR: #464646;FONT-FAMILY: Arial>"	
	newstr=pString.replace(re, newptag);

	return newstr; 
	//alert (newstr);	
}

//This function captures an paragraph and changes its properties to reduce the margin in the Para Tag 
function removeParaSpacing(pString)
{
	re = /<P>/gi;
	newptag  = '';
	newstr=pString.replace(re, newptag);
	repara = /<\/P>/gi;
	newptag1  = "<BR>";
	newstr1=newstr.replace(repara, newptag1);
	return newstr1; 
}


function showHelpWindow(pWin)
{
	winProf = window.open(pWin , "_blank","height=400px,width=600px,left=200px,top=100px,status=no,titlebar=no;resizable:no; toolbar=no,scrollbars=no,menubar=no,location=no");
}


function openResizableWindow(pWin)
{
	if(pWin)
		window.open(pWin,"_blank","top=100,left=150,height=300,width=300,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=1");
}

function openNewWindow(pWin)
{
	if(pWin)
		window.open(pWin,"_blank","top=50,left=50,height=300,width=300,status=yes,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=0");
}

