	function GoAction(theform,Actionx,eventTarget, eventArgument) {
		//var theform = thisform;//document.Form1;
		
		if (Actionx=="NEW")
		  doyou=true;
		else  
		  doyou = confirm("Do you want to " + Actionx + " this record? (OK = Yes   Cancel = No)"); //Your question.
        
        if (doyou == true)
        {
        	theform.__CUSTOMACTION.value = eventTarget;
		    theform.submit();
		}    
		
	}
    function validateLength512(oSrc, args){
      args.IsValid = (args.Value.length <=512);
    }
function popWindow(theURL,width,height) {
   window.open(theURL,'_new','toolbar=no,menubar=no,resizable=yes,scrollbars=yes,status=yes,location=no,width='+width+',height='+height);
   return false;
}

function redirectto(theURL) {
   window.open(theURL,'_self','');
   return false;
}


function MenuList(ID,SHOW) {
//  alert("Your text in the alert function.");
var block = document.getElementById(ID);
//var block1 = document.getElementById(ID+"1");
//var i=int(block1.style.top);
//block.style.top=i+20 ;
//block.style.left=block1.style.left;

if (SHOW==true) 
   block.style.display ="";
else
   block.style.display ="none";
  return true;
}

function rs(n,u,w,h,x)
{
				args="width="+w+",height="+h+",resizable=yes,scrollbars=yes,status=yes,dependent=yes";
				//args="width="+w+",height="+h+",resizable=yes,scrollbars=yes";
				remote=window.open(u,n,args);
				remote.focus();
				if(remote != null && remote.opener == null) remote.opener = self;
				if(x == 1) return remote;
}
function PrintDoc(n,u,w,h,x)
{
				args="width="+w+",height="+h+",toolbar=yes, menubar=yes,resizable=yes,scrollbars=yes,status=yes,dependent=yes";
				//args="width="+w+",height="+h+",resizable=yes,scrollbars=yes";
				remote=window.open(u,n,args);
				remote.focus();
				if(remote != null && remote.opener == null) remote.opener = self;
				if(x == 1) return remote;
}
function ZOOM(imgname,act)
{
	var img =  document.getElementById(imgname);
	
   if (act=="+") {
     img.style.width=parseInt(img.style.width)+200+'px';
     img.style.height=parseInt(img.style.height)+200+'px' ;
   }
   else {
   
     if ((parseInt(img.style.width)-200)>200 && (parseInt(img.style.height)-200)>200) {
       img.style.width=parseInt(img.style.width)-200+'px';
       img.style.height=parseInt(img.style.height)-200+'px' ;
     };
   };     

    
  return true;
}
function ErrMsgBox (txt) {

if (txt!='') alert(txt);

 }
 
 
 function findPosTopLeft(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curtop,curleft];
}

 function findPosTop(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curtop += obj.offsetTop
		}
	}
	return curtop;
}

 function findPosLeft(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
		}
	}
	return curleft;
}


function resetKey(sourcectrl,destctrl) {
   var s = document.getElementById(sourcectrl);
   var d = document.getElementById(destctrl);


   if (s.value!=d.value)
   {
     s.value='';
     d.value='';
   }
    return true;
}  

function countChar(sourcectrl,destctrl,maxlength) {
   var s = document.getElementById(sourcectrl);
   var d = document.getElementById(destctrl);

   d.value='' + (maxlength-s.innerHTML.length);
   return true;
}  

function limitchr(sourcectrl,destctrl,maxlength) {
   var s = document.getElementById(sourcectrl);
   var d = document.getElementById(destctrl);

   d.value='' + (maxlength-s.value.length);
   return true;
}  


function jampto(hfto)
{
   var s = document.getElementById(hfto).value;
   if (s!='') {
				remote=window.open("#"+s,"_self","");
				remote.focus();
				if(remote != null && remote.opener == null) remote.opener = self;
		document.getElementById(hfto).value="";		
				}
}
function jamptoa(s)
{
   if (s!='') {
				remote=window.open("#"+s,"_self","");
				remote.focus();
				if(remote != null && remote.opener == null) remote.opener = self;
				}
}
function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return ""
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date()
exdate.setDate(exdate.getDate()+expiredays)
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}

function checkCookie()
{
username=getCookie('username')
if (username!=null && username!="")
  {alert('Welcome again '+username+'!')}
else 
  {
  username=prompt('Please enter your name:',"")
  if (username!=null && username!="")
    {
    setCookie('username',username,365)
    }
  }
}


function setCookiebydate(name, value, expire) {
   document.cookie = name + "=" + escape(value)
   + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}

function firstVisit(name,minutelong) {
   var aa= getCookie(name)
   if (aa=="") {
     var today = new Date()
     var expires = new Date()
     expires.setTime(today.getTime() + 1000*60*minutelong)
     setCookiebydate(name, 'false', expires)
   }
   else {
     if (aa=="false") {
       var today = new Date()
       var expires = new Date()
       expires.setTime(today.getTime() + 1000*60*minutelong)
       setCookiebydate(name, 'true', expires)
     }
   }
}

function getOffsetLeft(elm) {
	var mOffsetLeft = elm.offsetLeft;
	var mOffsetParent = elm.offsetParent;
	var parents_up = 2;
	
	while(parents_up > 0) {
		mOffsetLeft += mOffsetParent.offsetLeft;
		mOffsetParent = mOffsetParent.offsetParent;
		parents_up--;
	}
	
	return mOffsetLeft;
}

function getOffsetTop(elm) {
	var mOffsetTop = elm.offsetTop;
	var mOffsetParent = elm.offsetParent;
	var parents_up = 2; //the positioning div is 2 elements up the tree
	
	while(parents_up > 0) {
		mOffsetTop += mOffsetParent.offsetTop;
		mOffsetParent = mOffsetParent.offsetParent;
		parents_up--;
	}
	
	return mOffsetTop;
}
function autoIFrameResize(id,defaultwidth){
    var newheight;
    var newwidth;
    document.getElementById(id).height= "100px";
    document.getElementById(id).width= defaultwidth + "px";


    if(document.getElementById){
        newheight=document.getElementById(id).contentWindow.document.body.scrollHeight;
        newwidth=document.getElementById(id).contentWindow.document.body.scrollWidth;
    }


    newheight=newheight+50;
    newwidth=newwidth+50;
    document.getElementById(id).height= (newheight) + "px";
    document.getElementById(id).width= (newwidth) + "px";
}

function openmenu(ID) {
var block = document.getElementById(ID);

if (block.style.display =="")
   block.style.display ="none";
else
   block.style.display ="";
  return true;
}


function setclassname(ID,clsname) {
var block = document.getElementById(ID);
    block.className=clsname;
  return true;
}

function setObjValue(ID,value)
{
   document.getElementById(ID).value=value;

}
function getObjValue(ID)
{
   return document.getElementById(ID).value;

}