var mouseX;
var mouseY;

function getMouseXY(e) // works on IE6,FF,Moz,Opera7
{ 
  if (!e) e = window.event; // works on IE, but not NS (we rely on NS passing us the event)

  if (e)
  { 
    if (e.pageX || e.pageY)
    { // this doesn't work on IE6!! (works on FF,Moz,Opera7)
      mouseX = e.pageX;
      mouseY = e.pageY;
    }
    else if (e.clientX || e.clientY)
    { // works on IE6,FF,Moz,Opera7
      mouseX = e.clientX + document.body.scrollLeft;
      mouseY = e.clientY + document.body.scrollTop;
    }  
  }
}

function navigatePage(pageIndex, className, formName, extraParameters) {
	if (extraParameters	== null) 
		extraParameters = '';

	var frm = eval("document." + formName);

	eval("frm." + className + "_pageIndex").value = pageIndex;
	frm.action = "?pageIndex="+pageIndex;

	if (eval("frm." + className + "_sortDirection") != null) 
		frm.action += "&sortDirection="+eval("frm." + className + "_sortDirection").value;
	
	if (eval("frm." + className + "_sortColumn") != null) 
		frm.action += "&sortColumn="+eval("frm." + className + "_sortColumn").value;
	
	frm.action += "&"+extraParameters;

	frm.submit();
}
function trim(str) {
	   //   /            open search
	   //     ^            beginning of string
	   //     \s           find White Space, space, TAB and Carriage Returns
	   //     +            one or more
	   //   |            logical OR
	   //     \s           find White Space, space, TAB and Carriage Returns
	   //     $            at end of string
	   //   /            close search
	   //   g            global search
	
	   return str.replace(/^\s+|\s+$/g, "");
}
function showhelp(stat) {
 	if(stat=='yes') {
		document.getElementById('help').style.display ="";
	}else {
		document.getElementById('help').style.display ="none";
	}
}
function createRequestObject(){
	var request_o; //declare the variable to hold the object.
	var browser = navigator.appName; //find the browser name
	if(browser == "Microsoft Internet Explorer"){
		request_o = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		/* Create the object using other browser's method */
		request_o = new XMLHttpRequest();
	}
	return request_o; //return the object
}

/* The variable http will hold our new XMLHttpRequest object. */
var http = createRequestObject(); 
var ObjectArray = new Array();

function getHelp(item){
	//var item = document.frmInsurance.clsjgInsurance_customerId.value;
	width = (screen.width/2)-200;
	height = (screen.height/2);
	http.open('POST', './helpAjax.php?id='+item);
	http.onreadystatechange = function(){
								if(http.readyState == 4){ //Finished loading the response
									var response = http.responseText;
									document.getElementById('help').innerHTML = response;//here you can put the html code if u need                                 
									document.getElementById('help').style.display='';
								}
							} 
	http.send(null);
	document.getElementById("help").style.left = width+"px";
	document.getElementById("help").style.top = height+"px";
}
function fillSub(){
	//var item = document.frmInsurance.clsjgInsurance_customerId.value;
	var id = document.getElementById("selUser").value;
	http.open('POST', 'fillSub.php?id='+id);
	http.onreadystatechange = function(){
								if(http.readyState == 4){ //Finished loading the response
									var response = http.responseText;
										document.getElementById("subOptions").innerHTML = response;//here you can put the html code if u need                                 
									//document.getElementById('sub').style.display='';
								}
							  } 
	http.send(null);
}
function viewSub(categoryid){
	if(document.getElementById(categoryid)){
		document.getElementById(categoryid).style.display="none";
	}
	
}
function checkNumeric(obj) {
	if(isNaN(obj.value)) {
	alert("Enter numeric value");
	obj.value = "";
	obj.focus();	
	}
}