function sendfunc(form,frmaction,hiddenName,val,targetType)
{
	if(form){
		if(hiddenName)
			hiddenName = hiddenName.split('~');
		if(val)
			val = val.split('~');

		for(i=0;i<hiddenName.length;i++){
			if(hiddenName[i])
				form.elements[hiddenName[i]].value = val[i];
		}

		form.target=targetType;
		if(frmaction){
			form.action = frmaction;
			form.submit();
		}
		return true;
	}
	else 
		return false;
}//function sendfunc(form,frmaction)

function sortfunc(form,frmaction,tosort,type)
{
	//alert(form.name)
	if(form){
		form.action = frmaction;
		form.sort.value = tosort;
		form.target = '_self';
		form.submit();
		return true;
	}
	else 
		return false;
}//function sortfunc(form,frmaction,tosort,type)

function confirmdelfunc(form,show,frmaction,hiddenName,val,targetType)
{
	var reply = confirm("This will permanantly delete the "+show);
	if(reply){
		if(hiddenName)
			hiddenName = hiddenName.split('~');
		if(val)
			val = val.split('~');

		for(i=0;i<hiddenName.length;i++){
			if(hiddenName[i])
				form.elements[hiddenName[i]].value = val[i];
		}

		form.target=targetType;
		form.action = frmaction;
		form.submit();
		return true;
	}
	else
		return false;
}//function confirmdelfunc(form,show)

function pagelimitfunc(form,frmaction,pagecnt)
{
	if(form){
		form.action = frmaction;
		form.PageCount.value = pagecnt;
		form.target = '_self';
		form.submit();
		return true;
	}
	else 
		return false;
}//end of function pagelimitfunc

var newwin;
function NewWindow(FrmAction)
{
	if (newwin) newwin.close();
	newwin = window.open(FrmAction, "win", "toolbar=no, status=no, menubar=no, scrollbars=yes, resizable=no, height=500, width=600, top=0, left=0");
	newwin.moveTo(0,0);
	if (window.focus) {newwin.focus()}
}//function NewWindow

function process(oForm) 
{ 
	//alert(oForm.name);	
	//alert('updMsg ' + document.getElementById('updMsg').innerHTML);
	if (opener && !opener.closed) 
	{ 		
		//alert(oForm.name);
		var tgt = 'content' + new Date().getTime(); 
		oForm.target = tgt; 
		opener.name = tgt; 
		//setTimeout('self.close()',1000); 
		document.getElementById('updMsg').innerHTML = 'Page Updated';
		return true; 
	} 
}//function process

function setcolor(form, clr, field)
{
	alert(form.elements[field].style.backgroundColor);
	form.elements[field].style.backgroundColor = clr;
}//function setcolor(clr)

function NewColorWindow(FrmAction)
{
	newwin = window.open(FrmAction, null, "help=no, toolbar=no, status=no, menubar=no, scrollbars=no, resizable=no, height=400, width=400, dependent=yes", true);
}//function NewWindow


function chkBlank(formelement,text){
	if (formelement.value==''){
		alert('Please enter your '+text);
		formelement.focus();
		return false;
	}
	else
		return true;
}//function chkBlank

function chkNaN(formelement,text){
	if (isNaN(formelement.value)){
		alert('Please enter a numeric value for '+text);
		formelement.focus();
		return false;
  	}
	else
		return true;
}//function chkNaN

function chkGreaterLen(formelement,text,len){
	if(formelement.value.length>parseInt(len)){
		alert('The '+text+' should not have more than '+len+' characters');
		formelement.focus();
		return false;
	}
	else
		return true;
}//function chkGreaterLen

function chkLessLen(formelement,text,len){
	if(formelement.value.length<parseInt(len)){
		alert('The '+text+' should not have less than '+len+' characters');
		formelement.focus();
		return false;
	}
	else
		return true;
}//function chkLessLen

function chkLength(msg,limit,str){ 
	if (str.value.length > limit){ 
		alert(msg+"\nshould not exceeds "+limit+" characters.");  
		str.select(); 
		return false; 
	}
	else return true;
}//function chkLength

function stripCharsInBag(s, bag) {   
	var i;
	var returnString = "";
	for (i = 0; i < s.length; i++) {   
		// Check that current character isn't whitespace.
		var c = s.charAt(i);
		if (bag.indexOf(c) == -1) returnString += c;
	}
	return returnString;
}//function stripCharsInBag







function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function addslashes(str) {
	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	str=str.replace(/\\/g,'\\\\');
	str=str.replace(/\0/g,'\\0');
	return str;
}//addslashes

function stripslashes(str) {
	str=str.replace(/\\'/g,'\'');
	str=str.replace(/\\"/g,'"');
	str=str.replace(/\\\\/g,'\\');
	str=str.replace(/\\0/g,'\0');
	return str;
}//stripslashes