// JavaScript Document

	function isEmpty(fname)
	{
		invalid = " ";
	
		flag = 1;
		for(ttt=0;ttt<fname.value.length;ttt++)
		{
			if(fname.value.charAt(ttt)!=invalid)
			{
				//alert('sdf');
				break;
			}
		}
		if(ttt==fname.value.length) flag = 0;
		if(flag==0) return true;
		if((fname.value=="") ||(fname.value==invalid))
			return true;
		else
			return false;
	}
	
	function emailCheck(email)
	{
		var tmp = "" + email + "", s = tmp.replace(/^\s*|\s*$/g, "");
		var re = /^(\w|[^_]\.|[\-])+((\@){1}([^_]))(([a-z]|[\d]|[\-]|\.)+|([^_]\.[^_])*)+\.[a-z]{2,3}$/i
		if (!re.test(s)) 
		{
			return false;
		}
		re =	 /\.(a[c-gil-oq-uwz]|b[a-bd-jm-or-tvwyz]|c[acdf-ik-orsuvx-z]|d[ejkmoz]|e[ceghr-u]|f[i-kmorx]|g[abd-ilmnp-uwy]|h[kmnrtu]|i[delm-oq-t]|j[emop]|k[eg-imnprwyz]|l[a-cikr-vy]|m[acdghk-z]|n[ace-giloprtuz]|om|p[ae-hk-nrtwy]|qa|r[eouw]|s[a-eg-ort-vyz]|t[cdf-hjkm-prtvwz]|u[agkmsyz]|v[aceginu]|w[fs]|y[etu]|z[admrw]|com|edu|net|org|mil|gov|biz)$/i
		if (!re.test(s)) 
		{
			return false;
		}
		re = /\@\@/
		return(!re.test(s));
	}
	function textCounter(field, maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
	field.value = field.value.substring(0, maxlimit);
	// otherwise, update 'characters left' counter
	//else 
	//countfield.value = maxlimit - field.value.length;
	}
	

	function CheckAll(frmNam)
	{
		var intCounter = 0 ;
		var tot=0;
		tot = eval("document."+frmNam+".elements."+"length");
		box = eval("document."+frmNam+".elements");
		tot = tot - 1;
		var intCounter = 0 ;
		for(intCounter=0;intCounter<=tot;intCounter++) 
		{
			if(box[intCounter].type=="checkbox")
			{
				box[intCounter].checked=true;
			} 
		} 
			
	}
	
	function goCan(loc)
	{
		window.location = loc;
	}
	
	function ClearAll(frmNam)
	{
		var intCounter = 0 ;
		var tot=0;
		tot = eval("document."+frmNam+".elements."+"length");
		box = eval("document."+frmNam+".elements");
		tot = tot - 1;
		var intCounter = 0 ;
		for(intCounter=0;intCounter<=tot;intCounter++) 
		{
			if(box[intCounter].type=="checkbox")
			{
				box[intCounter].checked=false;
			} 
		} 
			
	}
	
	function DeleteChecked(cnt,formname,page)
	{
		var flag = 0;
		fname = eval("document."+formname);
		//alert("JJ"); return;
		for(j=1;j<=cnt;j++)
		{
			box = eval("document."+formname+".unchk" + j);
			//alert(box.value);
			if(box.checked == true)
			{
				flag = 1;
				break;
			}
		}
		if(flag==0) //if any item not selected
		{
			if(cnt==0) alert("No record to delete");
			else alert("Please select record to delete");
		}
		else
		{
			var ids = "";
			var x = confirm("Are you sure you want to delete?");
			if(x) //to delete selected menu and its submenus
			{
				for(j=1;j<=cnt;j++)
				{
					box = eval("document."+formname+".unchk" + j);
					//alert(box.value);
					if(box.checked == true)
						ids = ids + box.value + ",";
				}
				ids = ids.substring(0,ids.length-1);
				fname.appid.value = ids;
				fname.action = page;
				fname.submit();
			}
			else
			{
				for(j=1;j<=cnt;j++)
				{
					box = eval("document."+formname+".unchk" + j);
					box.checked = false;
				}
			}
		}
	}
	function AllDigits()
	{
	  	if (!(window.event.keyCode>=48 && window.event.keyCode <=57)) 
			window.event.keyCode = 8;
	}
	
	function WindowPop(url, width_in, height_in) 
	{
		new_window = window.open(url,'window','toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=no,copyhistory=no,top=50,left=100,scrollbars=no,width=' + width_in + ',height=' + height_in);
		new_window.focus();
	}
	
	// Set the horizontal and vertical position for the popup

	PositionX = 100;
	PositionY = 100;
	
	// Set these value approximately 20 pixels greater than the
	// size of the largest image to be used (needed for Netscape)
	
	defaultWidth  = 500;
	defaultHeight = 500;
	
	// Set autoclose true to have the window close automatically
	// Set autoclose false to allow multiple popup windows
	
	var AutoClose = true;
	
	// Do not edit below this line...
	// ================================
	if (parseInt(navigator.appVersion.charAt(0))>=4){
	var isNN=(navigator.appName=="Netscape")?1:0;
	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
	var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
	var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
	function popImage(imageURL,imageTitle){
	if (isNN){imgWin=window.open('about:blank','',optNN);}
	if (isIE){imgWin=window.open('about:blank','',optIE);}
	with (imgWin.document){
	writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
	writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
	writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
	writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
	writeln('width=100-(document.body.clientWidth-document.images[0].width);');
	writeln('height=100-(document.body.clientHeight-document.images[0].height);');
	writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
	writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
	writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
	if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
	else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
	writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
	close();		
	}}