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();
}

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_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function swap_pic(image,directory,sel) {
   if ((x=MM_findObj(image))!=null){
      x.src = directory + "/" + sel.options[sel.selectedIndex].value;
   }
}

function setnsubmit(sentdate) {
   if ( document.all['modified'].value == "1") {
       alert("<center>Changes have been made....<br>Please save or disregard them before changing the date!</center>");
   } else {
      document.all['datebox'].value=sentdate;
      document.form1.submit();
   }
}

function swapImage(ImageName) {
   var picUrl = document.images[ImageName].src;
   var picStart = picUrl.indexOf("Graphics"); 
   var picEnd = picUrl.length;
   var picPath = picUrl.substring(picStart, picEnd);
   var ImageName2 = "hid" + ImageName;
   if (picPath == "Graphics/off.jpg") {
      document.images[ImageName].src = 'Graphics/on.jpg';
      document.all[ImageName2].value= 'on';
   } else {
      document.images[ImageName].src = 'Graphics/off.jpg';
      document.all[ImageName2].value= 'off';
   }
   document.all['modified'].value = '1';
}     

function swapRow(ImageName) {
   var stopnow = 0;
   var colStart = ImageName.indexOf("c")
   var Row = ImageName.substring(1,colStart);
   var Col = ImageName.substring(colStart+1,ImageName.length);
   var nCol = Col;
   var startCol = Col;

   while (nCol >= 1 && stopnow == 0) {
      chkImage = "r" + Row + "c" + nCol
      var picUrl = document.images[chkImage].src;
      var picStart = picUrl.indexOf("Graphics"); 
      var picEnd = picUrl.length;
      var picPath = picUrl.substring(picStart, picEnd);
      if (picPath == "Graphics/on.jpg") {
         startCol = nCol;
         stopnow = 1;
      } else {
         startCol = nCol;
         nCol -= 1;
      }
   }

   for (i=startCol; i<=Col; i++) {
      var imgSlot = "r" + Row + "c" + i;
      var imgSlot2 = "hidr" + Row + "c" + i;     
      document.images[imgSlot].src = 'Graphics/on.jpg';
      document.all[imgSlot2].value= 'on';
   }
   document.all['modified'].value = '1';
}

function ClearRow(row) {
   for (i=0; i<=47; i++) {
      var imgSlot = "r" + row + "c" + i;
      var imgSlot2 = "hidr" + row + "c" + i;  
      document.images[imgSlot].src = 'Graphics/off.jpg';
      document.all[imgSlot2].value= 'off';
   }
   document.all['modified'].value = '1';
}

function ClearAll() {
   status = "Please Wait...while I clear the data";
   var last_row = document.all['numrows'].value;
   for (j=1; j<=last_row; j++) {
      for (i=0; i<=47; i++) {
         var imgSlot = "r" + j + "c" + i;
         var imgSlot2 = "hidr" + j + "c" + i;  
         document.images[imgSlot].src = 'Graphics/off.jpg';
         document.all[imgSlot2].value= 'off';
      }
   }
   status = "Ready";
}

function employee_dropboxAction(hidfield) {
     document.all[hidfield].value=document.all['selName'].value
     document.form1.submit();
}
	 
function popUp(location,w,h,val) {
   if (!w) { w = 440 };
   if (!h) { h = 430 };
   posX = (screen.availWidth / 2) - (w / 2)
   posY = ((screen.availHeight-100)/ 2) - (h / 2)
   winProps = "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=" + w + ",height=" + h + ",left=" + posX + ",top=" + posY
   window.open(location,'popup'+val,winProps);
}

function popUp2(location,w,h,val) {
   if (!w) { w = 440 };
   if (!h) { h = 430 };
   posX = (screen.availWidth / 2) - (w / 2)
   posY = ((screen.availHeight-100)/ 2) - (h / 2)
   winProps = "toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=" + w + ",height=" + h + ",left=" + posX + ",top=" + posY
   window.open(location,'popup'+val,winProps);
}

function chgimage(location, picpath, picbox, pic, piclinkbox, piclink) {
   opener.document.images[location].src=picpath;
   if (document.all) { //Using IE browser
      opener.document.all[picbox].value = pic;
	  opener.document.all[piclinkbox].value = piclink;
	  self.close();
   } else {
      opener.document.form1.picbox.value = pic;
	  opener.document.form1.piclinkbox.value = piclink;
	  self.close;
   }
}



