var ismac = false;
var isfirefox = false;
var intWidth = -1;
var intHeight = -1;
var framesource = null;

//if (navigator.platform.indexOf("Mac")>=0){ismac = true}
//if (ismac && navigator.userAgent.indexOf("Firefox")>=0){isfirefox = true}

if (navigator.userAgent.indexOf("Safari")>=0 || navigator.userAgent.indexOf("Firefox")>=0){ismac = true}
if (ismac && navigator.userAgent.indexOf("Firefox")>=0){isfirefox = true}



window.onerror = null;
 var bName = navigator.appName;
 var bVer = parseInt(navigator.appVersion);
 var NS4 = (bName == "Netscape" && bVer >= 4);
 var IE4 = (bName == "Microsoft Internet Explorer" 
 && bVer >= 4);
 var NS3 = (bName == "Netscape" && bVer < 4);
 var IE3 = (bName == "Microsoft Internet Explorer" 
 && bVer < 4);
 var blink_speed=900;
 var i=0;

var currentcolor = 0;
 
if (NS4 || IE4) {
 if (navigator.appName == "Netscape") {
 layerStyleRef="layer.";
 layerRef="document.layers";
 styleSwitch="";
 }else{
 layerStyleRef="layer.style.";
 layerRef="document.all";
 styleSwitch=".style";
 }
}


function Blink(layerName){

 if (NS4 || IE4) { 
 
 if(i%2==0)
 {
	 eval(layerRef+'["'+layerName+'"]'+ styleSwitch+'.visibility="visible"');
	 if ( currentcolor == 0 )
	 {
			 eval(layerRef+'["'+layerName+'"]'+ styleSwitch+'.color = "blue"');
	 		 currentcolor = 1;
	 }
	 else if (currentcolor == 1)
	 {
			 eval(layerRef+'["'+layerName+'"]'+ styleSwitch+'.color = "blue"');
			 
     		currentcolor = 2;
	 }	
	 else	
	 {
			 eval(layerRef+'["'+layerName+'"]'+ styleSwitch+'.color = "blue"');
     	   	currentcolor = 0;
	 }	
 
 
 }
 else
 {
	 eval(layerRef+'["'+layerName+'"]'+ styleSwitch+'.visibility="hidden"');


 }
 } 
 if(i<1)
 {
 i++;
 } 
 else
 {
 i--
 } 
 
 setTimeout("Blink('"+layerName+"')",blink_speed);
}
//  End -->

function centerTopLeftPos(popW, popH){
			var w = 480, h = 340;
		
			w = screen.availWidth;
			h = screen.availHeight;
			
			var topPos = (h-popH)/2;
			var leftPos = (w-popW)/2;
			return " width=" + popW + ", height=" + popH + ", left=" + leftPos + ", top = " + topPos + ", resizable=yes,scrollbars=yes,modal=yes"
	}

	function moveWindowToCenter()
	{
		
			if (document.all) {
			   /* the following is only available after onLoad */
			   w = document.body.clientWidth;
			   h = document.body.clientHeight;
			}
			else if (document.layers) {
			   w = window.innerWidth;
			   h = window.innerHeight;
			}
			
			if (document.all || document.layers) {
			   w = screen.availWidth;
			   h = screen.availHeight;
			}
			var topPos = (h-document.body.offsetHeight)/2;
			var leftPos = (w-document.body.offsetWidth)/2;

	        window.moveTo(leftPos,topPos)
	}
	
	
	function ShowPreviousFilter(){
		document.result.ShowPreviousFilter.value = "true";
		document.result.action="/PDTFilter.asp";
		document.result.target = "_top";
		document.result.submit();		
	}
	
	var TerroristCharacterErrorMsg;
	TerroristCharacterErrorMsg = "<NAME> Name should not contain '  \"  or (Shared)." ;
	function CheckForTerroristCharactersInName(namevalue)
	{
		if(namevalue.indexOf("'")> -1 ||  namevalue.indexOf("\"")> -1 ||  namevalue.indexOf("(Shared)")> -1)		
			return false;
		else
			return true;	
	}

	
	function callguidedtour(fileid,requestfor)
	{
		window.open ("tourcontrol.asp?fileid="+fileid+"&requestform="+requestfor,"MT",centerTopLeftPos(500,300))
	
	}
	
	/*XML POST VARIABLES AND FUNCTION*/
	var xmlDoc 
	var xmlHttp 
	var xmlurl
	var UseApplet=false
	function GetJSObject()
	{
		if (UseApplet)
		{
			return document.MyApplet
		}
		else
		{
			return this
		}
	}


	function initializeParameters(){
		if( navigator.appName == "Netscape" )
			xmlHttp = new XMLHttpRequest();
		else
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")
		xmlDoc = ""
	}
	
	function setMethod(){
		
	}
	
	function setURL(url){
		xmlurl = url;
	
	}
	function escapeme(val)
	{
		val = escape(val);
		val = val.replace( 
			new RegExp( "\\+", "g" ), 
				"%2B" 
			)
		return val;
	}

	function addParameter(param,value)
	{
		if (! xmlDoc == "" )
			xmlDoc = xmlDoc + "&"
		xmlDoc= xmlDoc + escapeme(param)+"=" + escapeme(value) 
	}
	function sendRequest(){
		xmlHttp.open("POST", xmlurl, false)
		xmlHttp.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded")
		xmlHttp.send(xmlDoc)
		
		if (xmlHttp.status!="500")
		{
			if(xmlHttp.responseText==null)
				return "";
			else
				return xmlHttp.responseText;
		}	
		else
		{
			return "";
		}	
			
	}	
/*XML POST END*/

	function trim(s) {
	  while (s.substring(0,1) == ' ') {
	    s = s.substring(1,s.length);
	  }
	  while (s.substring(s.length-1,s.length) == ' ') {
	    s = s.substring(0,s.length-1);
	  }
	  return s;
	}

	function replace(str, oldstr, newstr){
		while(str.indexOf(oldstr) > -1){
			str = str.replace(oldstr, newstr);
		}
		return str;
	}
	
	function replaceQueryNameExChars(str){
		str = replace(str, "{@@}", "#")
		str = replace(str, "[*]", "~")
		return str;
	}

function checknamechar(strval,strtext)
	{
		strval = strval.replace(/^\s+|\s+$/g,'');	
		if(strval.indexOf("\\") > -1 || strval.indexOf("/") > -1 || strval.indexOf(":") > -1 || strval.indexOf("*") > -1 || strval.indexOf("?") > -1 || strval.indexOf("\"") > -1 || strval.indexOf("<") > -1 || strval.indexOf(">") > -1 || strval.indexOf("|") > -1 || strval.indexOf("'") > -1 || strval.indexOf("}") > -1 || strval.indexOf("{") > -1 )
		{
			alert(strtext + " Cannot contain any of the following characters : \n\t\t \\ / : * ? \" < > | ' { }.");
			return false;
		}
		else
		{
			return true;
		}
	}

function checksinglequote(strval,strtext)
	{
		if(strval.indexOf("'") > -1 )
		{
			alert(strtext + " cannot contain \" ' \".");
			return false;
		}
		else
		{
			return true;
		}
	}

//Function for removing characters used in XSS
function RemoveBadForSumTemplate(strTemp) {

	strTemp = strTemp.replace(/\<|\>|\"|\'/g,"");
	strTemp = strTemp.replace(/\s+/gm, " ");
	return RTrimAll(LTrimAll(strTemp));

}

function RemoveBad(strTemp) {

	//strTemp = strTemp.replace(/\<|\>|\"|\'|\%|\;|\:|\*|\?|\(|\)|\&|\+|\-|\\|\=|\//g,"");
    	strTemp = strTemp.replace(/\<|\>|\"|\'|\:|\\|\//g,"");
	strTemp = strTemp.replace(/\s+/gm, " ");
	return RTrimAll(LTrimAll(strTemp));

}

function RemoveBadTag(strTemp) {

	var oriStr = strTemp;

    	strTemp = strTemp.replace(/\<|\>|\\|\//g,"");
	strTemp = strTemp.replace(/\s+/gm, " ");


	return RTrimAll(LTrimAll(strTemp));
}

function checkAlphanumSpecial(strObject) 
{ 
	var re = /^[A-Za-z0-9, \?~!#$%*\{\}\[\]\^+-\\.:&@;_()/]+$/; 

	//if (!strObject || isBlank(strObject)) return false;     
	if (!re.test(strObject.value)) return false; 
	else return true;       
}

function LTrimAll(str) {
	if (str==null){return str;}
	for (var i=0; str.charAt(i)==" " || str.charAt(i)=="\n" || str.charAt(i)=="\t"; i++);
	return str.substring(i,str.length);
}

function RTrimAll(str) {
	if (str==null){return str;}
	for (var i=str.length-1; str.charAt(i)==" " || str.charAt(i)=="\n" || str.charAt(i)=="\t"; i--);
	return str.substring(0,i+1);
}

function ReplaceString(str) {
	str = str.replace(/@/g, "^");
	str = str.replace(/ /g, "_");
	str = str.replace(/,/g, "@");
	return str;
}

function ReplaceCompareString(str) {
	str = str.replace(/\"/g, "~#~");
	return str;
}

function dateMask(dt)
{
	if(dt.value.length == 2)
	{
		if(!isNaN(dt.value))
			dt.value = dt.value + "/";
	}	
	
	if(dt.value.length == 5)
	{
		if(!isNaN(dt.value.substring(3,5)))
			dt.value = dt.value + "/";
	}
	
	if(dt.value.length > 2 & dt.value.length <5 )
	{
		if(dt.value.substring(1,2))
		{
			
		
		}
	}	
	
	dt.focus();
}

var datePat = /^(\d{1,2})(\/)(\d{1,2})\2(\d{2}|\d{4})$/;
//var datePat = /^(\d{2})(\/)(\d{2})\2(\d{2}|\d{4})$/;  
function dateCompare(dateStr1, dateStr2){
	if(dateStr1.length > 0  && dateStr2.length > 0 )
	{

			var matchArray1 = dateStr1.match(datePat); // is the format ok? 
			var matchArray2 = dateStr2.match(datePat); // is the format ok? 
			month1 = matchArray1[1];
			day1 = matchArray1[3];
			year1 = matchArray1[4];
	
			/*
			1 = date2 is greater then date1
			0 = both dates are equals
 			-1=date1 is greater then date 2	
	
	
			*/
	
			month2 = matchArray2[1];
			day2 = matchArray2[3];
			year2 = matchArray2[4];


			if (month1.indexOf("0") == 0 )
				month1 = month1.substring(1,month1.length);
			if (month2.indexOf("0") == 0 )
				month2 = month2.substring(1,month2.length);
			if (year1.indexOf("0") == 0 )
				year1 = year1.substring(1,year1.length);
			if (year2.indexOf("0") == 0 )
				year2 = year2.substring(1,year2.length);
			if (day1.indexOf("0") == 0 )
				day1 = day1.substring(1,day1.length);
			if (day2.indexOf("0") == 0 )
				day2 = day2.substring(1,day2.length);
				
	
			if ( parseInt(year2) > parseInt(year1))
				return 1;
			else if ( parseInt(year2) < parseInt(year1))
				return -1;
			else if (parseInt(month2) > parseInt(month1))
				return 1;
			else if (parseInt(month2) < parseInt(month1))
					return -1;
			else if (parseInt(day2) > parseInt(day1))
				return 1;
			else if (parseInt(day2) < parseInt(day1))
				return -1;
			else
				return 0;	
	}
	else
	{
		return 0
	
	}			
}

//Checks whether the date is in proper format i.e mm/dd/yy
function isValidDate(dateStr) 
{ 
		
		if(dateStr.length == 0 )
			return true;


		var matchArray = dateStr.match(datePat); // is the format ok? 
		if (matchArray == null) 
		{ 
			alert("Please enter the dates and time periods in format mm/dd/yy.") 
			return false; 
		} 
		month = matchArray[1]; // parse date into variables 
		day = matchArray[3]; 
		year = matchArray[4];
		
		if(day.length != 2 || month.length != 2 | year.length != 2)
		{
			alert("Please enter the dates using the format MM/DD/YY.")
			return false
		
		}
		
		if (month < 1 || month > 12) 
		{ // check month range 
			alert("Month must be between 1 and 12."); 
			return false; 
		} 
		if (day < 1 || day > 31) 
		{
			alert("Day must be between 1 and 31."); 
			return false; 
		} 
		if ((month==4 || month==6 || month==9 || month==11) && day==31) 
		{
			alert("Month "+month+" doesn't have 31 days!") 
			return false 
		} 
		if (month == 2) 
		{ // check for february 29th 
			var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); 
			if (day>29 || (day==29 && !isleap)) 
			{ 
				alert("February " + year + " doesn't have " + day + " days!"); 
				return false; 
			} 
		}

		if(year > 99 )
		{//check date for no of degits 
			alert("Year must be of 2 digits.");
			return false;
		}

		 
		return true; // date is valid 
}

var objRadChecked;
objRadChecked = false;

function FocusRadioObject(obj) {
	objRadChecked = obj.checked;
}

function FlipRadioSelection(obj) {
	if(objRadChecked == true)
		obj.checked=false;
	else
		obj.checked=true;
	
	objRadChecked = obj.checked;
}

function alignWindowToCenter(divw,divh,loadframe)
{                       
    var objdiv;
    framesource = loadframe;
    if(framesource == null)
		objdiv = document.getElementById("framediv");
	else
		objdiv = document.getElementById("framediv1");
		
    divw = divw.replace('px','');
    divh = divh.replace('px','');

    /*var topPos = (document.body.offsetHeight-divh)/2;
    var leftPos = (document.body.offsetWidth-divw)/2;*/
    if(framesource == null)
		var topPos = (screen.availHeight-divh-180)/2;
	else
		var topPos = (screen.availHeight-divh-350)/2;
    var leftPos = (screen.availWidth-divw-20)/2;
    /*var topPos = (screen.height-divh-200)/2;
    var leftPos = (screen.width-divw-50)/2;*/
    objdiv.style.left = leftPos + 'px';
    objdiv.style.top = topPos + 'px';
    CallLoader("none");
	objdiv.style.visibility = "visible";
	var popupprotection_iefix = document.getElementById("iframeframediv");	
	if(!popupprotection_iefix)
		popupprotection_iefix = parent.document.getElementById("iframeframediv");	
	if(popupprotection_iefix){
		popupprotection_iefix.style.top = objdiv.offsetTop + 'px';
		popupprotection_iefix.style.left = objdiv.offsetLeft + 'px';
		popupprotection_iefix.style.width = objdiv.offsetWidth + 'px';
		popupprotection_iefix.style.height = objdiv.offsetHeight + 'px';
		popupprotection_iefix.style.visible = "visible";
	}	
}

function ResizeTop(pagetitle){
	var objdiv, objframe, objtitle, objheader;
	objdiv = document.getElementById("framediv");
	objframe = document.getElementById("framecontent");
	objtitle = document.getElementById("fvtitle");
	objheader = document.getElementById("frameheader");
	objdiv.style.width = intWidth + 'px';
	objdiv.style.height = (intHeight+21) + 'px';
	objframe.style.width = intWidth + 'px';
	objframe.style.height = intHeight + 'px';
	objtitle.innerHTML = pagetitle;
	objheader.style.width = intWidth + 'px';
	alignWindowToCenter(intWidth + "px",intHeight + "px");		
}

// resize the popup window according to the content height and width
// called after whole page is loaded from OnLoad event of Body tag
function ResizeMe(pagetitle, loadframe){
	var objparent, objdiv, objframe, objtitle, objheader, objwidth, objheight;
	var w, h;
	var objtable;
	framesource = loadframe;
	objparent = parent.document;

	if(framesource == null)
		objdiv = objparent.getElementById("framediv");
	else
		objdiv = objparent.getElementById("framediv1");
		
	if(framesource == null)
		objframe = objparent.getElementById("framecontent");		
	else
		objframe = objparent.getElementById("framecontent1");		
	
	if(framesource == null)	
		objtitle = objparent.getElementById("fvtitle");
	else
		objtitle = objparent.getElementById("fvtitle1");
		
	if(framesource == null)
		objheader = objparent.getElementById("frameheader");
	else
		objheader = objparent.getElementById("frameheader1");

	objtitle.innerHTML = pagetitle.replace(/\^/g, '"');
	if(intWidth == -1 || intHeight == -1)
	{
		objtable = document.getElementById("outertable");
		if(intWidth == -1)	
			intWidth = objtable.offsetWidth + 15;
		if(intHeight == -1)
			intHeight = objtable.offsetHeight + 40;
			
//		if(intWidth < objheader.offsetWidth)
//			intWidth = objheader.offsetWidth + 15;	
		//objdiv.resizeTo (intWidth, intHeight);

		objframe.style.width = intWidth + 'px';
		objdiv.style.width = intWidth + 'px';
		objheader.style.width=intWidth + 'px';
		objframe.style.height = (intHeight - 21) + 'px';
		objdiv.style.height = intHeight + 'px';
	}
	parent.alignWindowToCenter(objdiv.style.width,objdiv.style.height,framesource);
	intWidth = -1;
	intHeight = -1;
}

function CallLoader(displaystyle, txt)
{
	var loaderdiv;
	var screenobj;
	loaderdiv = document.getElementById("loader");
	screenobj = screen;
	if(loaderdiv == null)
	{
		loaderdiv = parent.document.getElementById("loader");
		screenobj = parent.window.screen;
		if(parent.document.location.href.toLowerCase().indexOf("pptoptions1popup") > -1)
		{
			loaderdiv = parent.parent.document.getElementById("loader");
			screenobj = parent.parent.window.screen;			
		}
	}	
	if(loaderdiv)
	{	
		loaderdiv.style.display=displaystyle;
	    
		if(txt != null)
		{
			var loaderspan;
			loaderspan = document.getElementById("loaderspan");
			loaderspan.innerHTML=txt;
		}

		var topPos = (screenobj.availHeight-250)/2;
		var leftPos = (screenobj.availWidth-loaderdiv.offsetWidth)/2-10;
		/*var topPos = (document.body.clientHeight-250)/2;
		var leftPos = (document.body.clientWidth-loaderdiv.offsetWidth)/2-10;*/
		loaderdiv.style.left = leftPos + 'px';
		loaderdiv.style.top = topPos + 'px';	

		var popupprotection_iefix = document.getElementById("iframeframediv");	
		if(!popupprotection_iefix)
			popupprotection_iefix = parent.document.getElementById("iframeframediv");	
		if(popupprotection_iefix){
			if(displaystyle == "block"){
				popupprotection_iefix.style.top = loaderdiv.offsetTop + 'px';
				popupprotection_iefix.style.left = loaderdiv.offsetLeft + 'px';
				popupprotection_iefix.style.width = loaderdiv.offsetWidth + 'px';
				popupprotection_iefix.style.height = loaderdiv.offsetHeight + 'px';
				popupprotection_iefix.style.visible = "visible";
			}	
			else
			{
				popupprotection_iefix.style.top = "-200px";
				popupprotection_iefix.style.left = "-200px";
				popupprotection_iefix.style.width = "0px";
				popupprotection_iefix.style.height = "0px";
				popupprotection_iefix.style.visible = "hidden";	
			}	
		}	
	}
	//alert(loaderdiv.style.display);
}

function OpenPopup(act, windowWidth, windowHeight, fieldnm, fieldval, formname, loadframe, method)
{
	framesource = loadframe;
	CallLoader("block");
	var win;
	var objframe, objdiv;
	
	if(formname == null && document.jump)
		ClearJumpForm();
	if(windowWidth != null)
		intWidth = windowWidth;
	if(windowHeight != null)
		intHeight = windowHeight;
		
	//if(act.indexOf("/") > 0	|| act.indexOf("/") == -1)
	//	act = "/" + act;

	if((fieldnm != null && fieldval != null) || formname != null)	//POST
	{
		if (formname == null){
			formname = "jump";
		}
		document.forms[formname].action = act;
		if(method == null)
			document.forms[formname].method="post";
		else
			document.forms[formname].method="get";
		
		if(fieldnm != null && fieldval != null)
		{
			for (i=0;i<fieldnm.length;i++){
				AddHiddenFieldToJump(fieldnm[i], fieldval[i]);
			}
		}

		if(loadframe == null)
		{
			objframe = document.getElementById('framecontent');
			if (objframe == null)	
				objframe = parent.document.getElementById('framecontent');
		}	
		else
		{
			objframe = document.getElementById('framecontent1');				
			if (objframe == null)	
				objframe = parent.document.getElementById('framecontent1');			
		}		

		if(loadframe == null)
		{
			objdiv = document.getElementById('framediv');
			if (objdiv == null)	
				objdiv = parent.document.getElementById('framediv');
		}	
		else
		{
			objdiv = document.getElementById('framediv1');				
			if (objdiv == null)	
				objdiv = parent.document.getElementById('framediv1');			
		}
		objdiv.style.visibility = "hidden";
		objdiv.style.top="0px";
		objdiv.style.left="0px";
		document.forms[formname].target = objframe.name;
		if(windowWidth != -1){
			objframe.style.width = windowWidth + 'px';
			objdiv.style.width = objframe.style.width;
		}
		if(windowHeight != -1){
			objframe.style.height = windowHeight + 'px';
			objdiv.style.height = objframe.style.height;
		}
		document.forms[formname].submit();
	}
	else									//GET
	{
		if(loadframe == null)
			objframe = document.getElementById("framecontent")                
		else
		{
			objdiv = document.getElementById("framediv1");
			objframe = document.getElementById("framecontent1");
			objdiv.style.visibility = "";
			objdiv.style.top="0px";
			objdiv.style.left="0px";
			
			/*if(windowWidth != -1){
				objframe.style.width = windowWidth;
				objdiv.style.width = objframe.style.width;
			}
			if(windowHeight != -1){
				objframe.style.height = windowHeight;
				objdiv.style.height = objframe.style.height;
			}*/
		}
		objframe.src = act;
	}
	return win;
}

function CloseWindow(loadframe)
{

	var popupprotection_iefix = document.getElementById("iframeframediv");	
	if(popupprotection_iefix){
		popupprotection_iefix.style.top = "-200px";
		popupprotection_iefix.style.left = "-200px";
		popupprotection_iefix.style.width = "0px";
		popupprotection_iefix.style.height = "0px";
		popupprotection_iefix.style.visible = "hidden";
	}
	if(parent && parent.document) {
		popupprotection_iefix = parent.document.getElementById("iframeframediv");	
		if(popupprotection_iefix){
			popupprotection_iefix.style.top = "-200px";
			popupprotection_iefix.style.left = "-200px";
			popupprotection_iefix.style.width = "0px";
			popupprotection_iefix.style.height = "0px";
			popupprotection_iefix.style.visible = "hidden";
		}	
	}
	if(parent && parent.parent && parent.parent.main) {
		popupprotection_iefix = parent.parent.main.document.getElementById("iframeframediv");	
		if(popupprotection_iefix){
			popupprotection_iefix.style.top = "-200px";
			popupprotection_iefix.style.left = "-200px";
			popupprotection_iefix.style.width = "0px";
			popupprotection_iefix.style.height = "0px";
			popupprotection_iefix.style.visibility = "hidden";
		}
	}

	var objdiv, objframe;
	if(loadframe == null)
		objdiv = parent.document.getElementById("framediv");
	else
		objdiv = parent.document.getElementById("framediv1");
	if(loadframe == null)
		objframe = parent.document.getElementById("framecontent");
	else
		objframe = parent.document.getElementById("framecontent1");
	
	if(objdiv == null)
	{
		objdiv = parent.parent.document.getElementById("framediv");
		objframe = parent.parent.document.getElementById("framecontent");
	}
	
	if(objdiv)
	{	
		objdiv.style.height = "0px";
		objdiv.style.width = "0px";
		objframe.style.height = "0px";
		objframe.style.width = "0px";
		objframe.src = "about:blank";
		objdiv.style.visibility = 'hidden';
	}
}

function capturekey(e, loadframe)
{
	var kC  = (window.event) ?    // MSIE or Firefox?
                event.keyCode : e.keyCode;
	var Esc = (window.event) ?   
				27 : e.DOM_VK_ESCAPE // MSIE : Firefox
	if(kC==Esc)
		CloseWindow(loadframe);
}


/* Navigation Bar - Page Change */
function ChangeNoOfRecsPerPage(obj)
{
	var aplt = GetJSObject();
	aplt.initializeParameters();
	aplt.addParameter('ChangeNoOfRecsPerPage', obj.value);
	aplt.setMethod("post");
	aplt.setURL("CallBack.asp");
	aplt.sendRequest();
	Navigate(1, '');
}

function OnKeyUpNumpToPageNo(pageno, curpage, maxpage, e)
{
	var key;
	if(window.event)
		key = window.event.keyCode;
	else
		key = e.which;	
	if(key == 13)
	{
		JumpToPageNo(pageno, curpage,maxpage);	
	}
}

function JumpToPageNo(pageno, curpage, maxpage)
{
	if(pageno == curpage)
	{
		return false;
	}
	if(pageno.length > 0 && !isNaN(pageno) && pageno.indexOf(".") == -1)
	{
		if(pageno == "0" || pageno > maxpage || pageno < 1)
		{
			alert("Page number should be within 1 and " + maxpage + ".");
			return false;
		}
		else
		{
			Navigate(pageno, '');
		}
	}
	else
	{
		alert("Please enter numeric values only.");
		return false;
	}

}



/* Navigation Bar - Page Change */


/* Adjusting the toolbar and report table width on window resize event */
function onresizefun(){
	var funcName = "resizerpttable";
	var toolbaricondiv = document.getElementById("toolbaricondiv");
	var toolbariconspan = document.getElementById("toolbariconspan");
	if(toolbaricondiv)
	{ 
		toolbaricondiv.style.width="300px";
		for (i=0;i<10;i++){
			if(toolbaricondiv.offsetHeight>40)
				toolbaricondiv.style.width=(toolbaricondiv.offsetWidth + 50) + 'px';
		}
		if(toolbariconspan.offsetWidth > 0)	
			toolbaricondiv.style.width=(toolbariconspan.offsetWidth + 5) + 'px';
		if(eval("typeof " + funcName + "") == "function")
		{
			eval(funcName + "()");
		}
	}	
}

/* Adjusting the toolbar and report table width on window resize event */

function getdatediffweek(strdate1,strdate2)
{
	datDate1= Date.parse(strdate1);
	datDate2= Date.parse(strdate2);	
	//alert(Math.round((datDate2-datDate1)/(24*60*60*1000))/7);
	return Math.round(((datDate2-datDate1)/(24*60*60*1000))/7);
}

function getdatediffweek(strdate1,strdate2)
{
	datDate1= Date.parse(strdate1);
	datDate2= Date.parse(strdate2);	
	//alert(Math.round((datDate2-datDate1)/(24*60*60*1000))/7);
	return Math.round(((datDate2-datDate1)/(24*60*60*1000))/7);
}
function getFVDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}


