﻿nn4 = (document.layers) ? true : false;
ie4 = (document.all) ? true : false;
dom = (document.createTextNode)? true : false;

var newwindow='';

function hideCalendar(oCalendar)
{
oCalendar.hide();
oCalendar.get_element().blur();
}

function popupWindow(fileUrl, winW, winH, winN, scrollB)
{
	var winWidth = (winW)? winW : 740;
	var winHeight = (winH)? winH : 520;
	var winName = (winN)? winN : 'popupWin'
	var scrollBars = (scrollB==1)? 'yes' : 'no'
	if (nn4 || ie4 || dom)
	{
		if (screen.width < winWidth + 50) { winWidth = screen.width - 50; scrollbars = 'yes' }
		if (screen.height < winHeight + 100) { winHeight = screen.height - 100; scrollbars = 'yes' }
		posX = Math.round((screen.width - winWidth) / 2);
		posY = Math.round((screen.height - winHeight) / 2);
		posCode = (nn4)? "screenX="+posX+",screenY="+posY : "left="+posX+",top="+posY;
	}
	else
	{
		posCode = "";
	}
	var popupWin = window.open(fileUrl, winName,"menubar=no,toolbar=no,scrollbars=" + scrollBars + ",status=yes,resizable=yes,width=" + winWidth + ",height=" + winHeight + "," + posCode);
	if (popupWin) popupWin.focus();
}

function add_to(cid){if(document.frm.txt_to.value ==""){var total_p = cid;}else{var total_p = document.frm.txt_to.value +" , "+ cid;};document.frm.txt_to.value=total_p;}
function keypress(textarea,maxlen){if(textarea.value.length > maxlen){textarea.value = textarea.value.substring(0,maxlen);}}
function symbolcount(textarea, textfield, maxlen){n = maxlen - textarea.value.length;	textfield.value = "" + n;}
function stoptimer(){if(navigator.appName=='Netscape' && isrun==1){clearTimeout(timID);isrun=0;};return true;}
function setviewer(textar,textf,limit)
{
	if(navigator.appName=='Netscape' && isrun==0){isrun=1;textarr=textar;textff=textf;limitt=limit;timID=setTimeout("viewer()",timeoutt);};
	return true;
}

function viewer()
{
	if(isrun==1)
	{
		isrun=2;
		textff.focus();
		textarr.focus();  
		keypress(textarr,140); 
		symbolcount(textarr,textff,limitt);
		isrun=1;
		timID=setTimeout("viewer()",timeoutt);
	}     
}
