function openWindow(page,w,h){
	myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;
	settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes";
	win=window.open(page,'popupwin',settings);
	win.focus();
}

function openWindowR(page,w,h,r){ // control With respect to resize 
	myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;
	settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable="+r;
	win=window.open(page,'popupwin',settings);
	win.focus();
}


/* This is to Change the Title of the Parent in Frames
	@param String contains Title
*/
function setTitle(strTitle){
	str1 = " ::: ";
	strDomain = "NetPayDue.com : ";
	parent.document.title = str1 + strDomain + strTitle + str1; 
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);



function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}


function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

function callSelectAll() {//v1.1
	var sF = arguments[0], bT = arguments[1], bC = arguments[2], oF = MM_findObj(sF);
	    for (var i=0; i<oF.length; i++) {
			if (oF[i].type == "checkbox") {
				if (bT) {
					oF[i].checked = !oF[i].checked;
				} else {
					oF[i].checked = bC;
				}
			}
		} 
}

function helpwindow(theURL) { //v1.0
	var x = screen.width - 440;
	var help = window.open(theURL,"Help","toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=426,height=400,left="+x+",top=140");
	help.focus();

}

function MM_popupMsg() { //v1.0
  alert("This option is not available for the demo version.");
}
function mark1(fObj){
     if(fObj.checked == true){
          fObj.parentNode.parentNode.style.backgroundColor = "#FCFFE1";
     } else {
          fObj.parentNode.parentNode.style.backgroundColor = "#FFFFFF";
     }
}
function mark2(fObj){
     if(fObj.checked == true){
          fObj.parentNode.parentNode.style.backgroundColor = "#FCFFE1";
     } else {
          fObj.parentNode.parentNode.style.backgroundColor = "#F5F9F5";
     }
}

// These below scripts are inserted by Mady 15/07/2005
// These are to be used only for the template purpose
// used for page navigation

function testLinkto(){ 
// This is test function to check the value set to hidden field
// "linkto" in the top.htm page which appears in the topFrame.
alert(parent.frames["topFrame"].document.nav.linkto.value);
}

function setLinktoURL(url){ // This function will set the url to the hidden field linkto
	parent.frames["topFrame"].document.nav.linkto.value = url;
}


function submitLinktoForm(){
// This funtion will be called by action button
if (parent.frames["topFrame"].document.nav.linkto.value == 1) {
	alert("Please select one of the options...");
} else {
	document.forms[0].action = parent.frames["topFrame"].document.nav.linkto.value;
	document.forms[0].submit();
	}
}


function testLinkto2(){ 
// This is test function to check the value set to hidden field
// "linkto2" in the top.htm page which appears in the topFrame.
alert(parent.frames["topFrame"].document.nav.linkto2.value);
}

function setLinktoURL2(url){ // This function will set the url to the hidden field linkto2
	parent.frames["topFrame"].document.nav.linkto2.value = url;
}


function submitLinktoForm2(){
// This funtion will be called by action button
if (parent.frames["topFrame"].document.nav.linkto2.value == 1) {
alert("Please select one of the options...");
} else {
	document.forms[0].action = parent.frames["topFrame"].document.nav.linkto2.value;
	document.forms[0].submit();
	}
}


function testLinkto3(){ 
// This is test function to check the value set to hidden field
// "linkto3" in the top.htm page which appears in the topFrame.
alert(parent.frames["topFrame"].document.nav.linkto3.value);
}

function setLinktoURL3(url){ // This function will set the url to the hidden field linkto3
	parent.frames["topFrame"].document.nav.linkto3.value = url;
}


function submitLinktoForm3(){
// This funtion will be called by action button
if (parent.frames["topFrame"].document.nav.linkto3.value == 1) {
alert("Please select one of the options...");
} else {
	document.forms[0].action = parent.frames["topFrame"].document.nav.linkto3.value;
	document.forms[0].submit();
	}
}

function empChange(){
	// This funtion is for the search button option
	// onselction of the serach by option it will 
	// change the value of the searchField textfield 
   	frm= document.forms[0];
	if (frm.empSelect.value == "1") {
   		frm.searchField.disabled=false;
   		frm.searchField.value ='Enter Surname here';
   		frm.searchField.style.color ='#999999';
	} else if (frm.empSelect.value == "2") {
   		frm.searchField.disabled=false;
   		frm.searchField.value ='Enter Forename here';
   		frm.searchField.style.color ='#999999';
	} else {
   		frm.searchField.disabled=true;
   		frm.searchField.value ='';
   		frm.searchField.style.color ='#CCCCCC';
	}    
}

function WindowOnLoad(func){
	var oldOnLoad = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
		if (oldOnLoad) {
			oldOnLoad();
		}
		func();
		}
	}
}
WindowOnLoad(addCopyright);
function addCopyright(){
	var textblock=document.createElement("p");
	textblock.setAttribute("align", "center");
	textblock.className ='Copyright';
	textblock.innerHTML = '&copy; Copyright Able Payroll Ltd.';
	document.body.appendChild(textblock);
}
