var PresedState="";
var State;
var activeBT;
function ChangeImg(N_Img,State){
	var myImg = N_Img;
	//if(activeBT != 	myImg){
	activeBT = 	myImg;
	var N_Img=document.getElementById(N_Img);	
	//alert(N_Img)			
	if(N_Img!=null){
		if (State==1){				
			N_Img.src=N_Img.src.replace("_off","_on");
			} else {											
			N_Img.src=N_Img.src.replace("_on","_off");
		}		
	}
	//}			
}
		
function closeBottom(){
	parent.openFrame('openBottom');
}

		
var oldId = "";

function dispSearch(id)
{
	if(oldId != id){
	newImg = 'b'+ id;
	ChangeImg(newImg,1)
	oldImg = 'b'+ oldId;
	ChangeImg(oldImg,0)
	oldId = id;
 	document.search_frame.location.href='search_frame.aspx?searchID='+id;
	}
}

function openWindow(url,w,h,s) {
	if(!s) {
		s = 'auto';
	}
	var wizWin = window.open(url, null, 'width='+w+',height='+h+',status=no,menubar=no,titlebar=no,scrollbars='+s+',resizable=no')
}

var ObjDisplayed = new Object();
ObjDisplayed.id="";

function disp(id)
{
if (ObjDisplayed.id!="") {ObjDisplayed.style.display="none";}
var Obj = eval("document.all.tr"+id);
if (Obj!=ObjDisplayed)
	{
		ObjDisplayed=Obj;
		Obj.style.display="inline";
	}
else {
	ObjDisplayed= new Object();
	ObjDisplayed.id="";
	}
}	

 //print Functions
			var myUrl
			var ppb = "<link rel='alternate' media='print'  href=";
		 	var ppe = " >";		 	
			if(window.location.href.indexOf("?") < 0){
			var myUrl = window.location.href+"?print=true";
			}else{
			var myUrl = window.location.href+"&print=true";
			}
			document.write(ppb+myUrl+ppe);				
//end -->
//open rpint window (not in use)
function openPrint(){
var n=open(myUrl,'printWin','width=600,height=478,top=0, left=0,status=no,menubar=no,titlebar=no,scrollbars=yes,resizable=no');
}
function enlarge(which,e){
	//alert('?')
	//Render image code for IE 4+ and NS6
	if (ie||ns6){
		crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage


		if (crossobj.style.visibility=="hidden"){
			crossobj.style.left=ns6? pageXOffset+e.clientX-10: document.body.scrollLeft+event.clientX-10
			crossobj.style.top=ns6? pageYOffset+e.clientY+15: document.body.scrollTop+event.clientY+15
			crossobj.innerHTML='<div align=left dir=ltr  style="z-index:99" id=drag><font face=arial style=font-size:11px>&nbsp;'+which+'</font></div>'
			crossobj.style.visibility="visible"
			}
		else{
			crossobj.style.visibility="hidden"
			if(which2!=which){
				which2=which;
				return enlarge(which,e)
				}
			}
		return false
		}
	//Render image code for NS 4
	else if (document.layers){
		if (document.showimage.visibility=="hide"){
			document.showimage.document.write('<a href="#" onMouseover="drag_dropns(showimage)"><img src="+which+" border=0></a>')
			document.showimage.document.close()
			document.showimage.left=e.x
			document.showimage.top=e.y
			document.showimage.visibility="show"
			}
		else
			document.showimage.visibility="hide"
		
		return false
		}
	//if NOT IE 4+ or NS 4, simply display image in full browser window
	else
	return true
	}
	
function setColor(el, bg) {
  if (el.style) el.style.backgroundColor = bg;
}

function echeck(str)
{
	var filter = /^[a-zA-Z0-9]+[\._a-zA-Z0-9\-]*[\._a-zA-Z0-9]@[a-zA-Z0-9\-]+[\._a-zA-Z0-9\-]*[a-zA-Z0-9]\.[a-zA-Z]{2,4}$/;
	if (!filter.test(str))
	{
		return false;
	}
	else
	{
		return true;
	}			
}


function confirmModal(msg, alertID)
{
	if (alertID){
	var URLString="Pop_Alert.aspx?alert="+alertID
	} else {
	var URLString="Pop_Alert.aspx"
	}
	
		if (navigator.appName.indexOf("Internet Explorer") == 10)
		{
			return window.showModalDialog(URLString, msg, "dialogWidth: 423px; dialogHeight: 240px; status: 0; center: 1; scroll: auto;");
		}
		else
		{
			msg = msg.replace(/<\/?[a-z][a-z0-9]*[^<>]*>/g, " \n ");
			return confirm(msg);
		}
}
function alertModal(msg)
{
		if (navigator.appName.indexOf("Internet Explorer") == 10)
		{
			return window.showModalDialog("Pop_Alert.aspx?alert=1",	msg, "dialogWidth: 423px; dialogHeight: 240px; status: 0;center: 1; scroll: auto;");
		}
		else
		{
			msg = msg.replace(/<\/?[a-z][a-z0-9]*[^<>]*>/g, " \n ");
			alert(msg);
		}
	
}	

function fRemark()
{
	alertModal('Blah Blah Blah Blah Blah Blah Blah Blah !');
}
			var bgBad = "#FFE2B5";
			var bgGood = "white";
	
	
function changeAccount(x)
{
	document.all.cAcc.value = x.value;
	document.forms[0].op.value = "ACC";
	document.forms[0].submit();
}
function fLogoff()
{
	document.forms[0].op.value = "Logoff";
	document.forms[0].submit();
}
function sendAPSum()
{
	if(window.screenTop>10000)
	{
		document.location.href = "SendAPSum.aspx";
	}
}
