	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 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 openmenu(ID) {
var block = document.getElementById(ID);

if (block.style.display =="")
   block.style.display ="none";
else
   block.style.display ="";
  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 cboSelectAction(cbocontrol)
{

    var c = document.getElementById(cbocontrol);
    
    if (confirm(c.options[c.selectedIndex].text + " ? (OK = Yes   Cancel = No)")==false) 
    {
       c.selectedIndex=0;
       return false;
    }
       
    __doPostBack("","");
    return true;

}
function disableKeyCode(key,msg) {
//if (thisEvent.keyCode==key){
// thisEvent.returnValue=false;
//}
if (event.keyCode==key){
 if (msg!='') alert(msg);
 event.returnValue=false;
} 
}
function captureKey(sourcectrl,destctrl) {
   var s = document.getElementById(sourcectrl);
   var d = document.getElementById(destctrl);


    d.value=s.value;
    return true;
}  
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 ErrMsgBox (txt) {

if (txt!='') alert(txt);

 }
function captureKey(sourcectrl,destctrl) {
   var s = document.getElementById(sourcectrl);
   var d = document.getElementById(destctrl);


    d.value=s.value;
    return true;
}  
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 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 setblank(ctrl)
{

	document.getElementById(ctrl).value= "";


} 
////////////////////
function FitMenu(objbtn,objtop,objleft) {

var clickbtn = document.getElementById(objbtn);

var block1 = document.getElementById(objtop);
var block2 = document.getElementById(objleft);
var ie=document.all && !window.opera;


iebody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body;
var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset;
var scroll_left=(ie)? iebody.scrollLeft : window.pageXOffset;


var docwidth=(ie)? iebody.clientWidth : window.innerWidth;

var docheight=(ie)? iebody.clientHeight: window.innerHeight;

    var iTopPos =findPosTop(clickbtn);
	var iLeftPos = findPosLeft(clickbtn);
	 
 //   var iTopPos =scroll_top+(docwidth-clickbtn.offsetParent.offsetWidth)/2;
//	var iLeftPos = scroll_left+(docheight-clickbtn.offsetParent.offsetHeight)/2;

 //   var iTopPos =scroll_top+(docwidth-500)/2;
//	var iLeftPos = scroll_left+(docheight-300)/2;


   block1.value=iTopPos;
   block2.value=iLeftPos;

       }
       
function FitCenter(boxwidth,boxheight,objtop,objleft) {

//var clickbtn = document.getElementById(objbtn);

var block1 = document.getElementById(objtop);
var block2 = document.getElementById(objleft);
var ie=document.all && !window.opera;


iebody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body;
var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset;
var scroll_left=(ie)? iebody.scrollLeft : window.pageXOffset;


var docwidth=(ie)? iebody.clientWidth : window.innerWidth;

var docheight=(ie)? iebody.clientHeight: window.innerHeight;

 //   var iTopPos =findPosTop(clickbtn);
	//var iLeftPos = findPosLeft(clickbtn);
	 
  //  var iTopPos =scroll_top+(docwidth-clickbtn.offsetParent.offsetWidth)/2;
//	var iLeftPos = scroll_left+(docheight-clickbtn.offsetParent.offsetHeight)/2;

    var iTopPos =scroll_top+(docheight-boxheight)/2;
	var iLeftPos = scroll_left+(docwidth-boxwidth)/2;


   block1.value=iTopPos;
   block2.value=iLeftPos;

       }       
       
       
 function jampto(hfto)
{
   var s = document.getElementById(hfto).value;
   if (s!='') {
				//args="width="+w+",height="+h+",toolbar=yes, menubar=yes,resizable=yes,scrollbars=yes,status=yes,dependent=yes";
				//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("#"+s,"_self","");
				remote.focus();
				if(remote != null && remote.opener == null) remote.opener = self;
		document.getElementById(hfto).value="";		
				}
}       

 
function javascript_prompt(msg,value,objdata) {
	
	
	var return_value = prompt(msg,value);
    var data1 = document.getElementById(objdata);
	if (return_value != null) {
	    data1.value=return_value;
	  return true;
	} else {
	  return false;
	}
}
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";
}
