 function pushtoday() {
  var now = new Date();
  var day = now.getDate();
  var monx = now.getMonth();
  var year = now.getYear();
  if (monx == 0) {
     var month = "January"
  } else if (monx == 1) {
     var month = "February"
  } else if (monx == 2) {
     var month = "March"
  } else if (monx == 3) {
     var month = "April"
  } else if (monx == 4) {
     var month = "May"
  } else if (monx == 5) {
     var month = "June"
  } else if (monx == 6) {
     var month = "July"
  } else if (monx == 7) {
     var month = "August"
  } else if (monx == 8) {
     var month = "September"
  } else if (monx == 9) {
     var month = "October"
  } else if (monx == 10) {
     var month = "November"
  } else if (monx == 11) {
     var month = "December"
  }              
  if ( (year > 100 ) && ( year < 200 ) ) {
    year = year + 1900
  }
  document.forms[0].date.value = month + " " + day + ", " + year
  //month + " " + day
 }
 
 function Bool(arg) {
doyou = confirm(arg);
if (doyou == true)
return true
}

function ShoveNow (m,y) {
  document.forms[0].cmonth.value = m
  document.forms[0].cyear.value = y  
} 


 var newWindow
function openWindow(ahtmlpath) {
 newWindow = window.open(ahtmlpath, "myWindow", "resizable=yes,scrollbars=yes,width=650,height=475")
 if (navigator.appName.indexOf("Netscape") != -1) {
    newWindow.window.focus();
  } else if (navigator.appVersion.indexOf("5") != -1)
   {newWindow.window.focus();
  }
 }
 
 var newWindow2
function openWindow2(ahtmlpath) {
 newWindow2 = window.open(ahtmlpath, "CustomerView", 
"toolbar=no,menubar=no,resizable=yes,scrollbars=yes,width=900,height=700")
newWindow2.window.focus();
/* if (navigator.appName.indexOf("Netscape") != -1) {
    newWindow2.window.focus();
  } else if (navigator.appVersion.indexOf("5") != -1)
   {newWindow2.window.focus();
  }*/
 }
 
 function myDate(arg) {
        var myYear = arg.getYear()
        if (myYear < 2000) {
           myYear = myYear + 1900
        }
        return myYear
}

function initArray() {
     this.length = initArray.arguments.length
     for (var i = 0; i < this.length; i++)
         this[i+1] = initArray.arguments[i]
}

function lastmod() {
var MonthOfYearArray = new initArray("January","February","March","April",
                                     "May","June","July","August",
                                     "September","October","November","December");
var LastModifiedDate = new Date(document.lastModified);
document.write("page last updated: ");
document.write(MonthOfYearArray[(LastModifiedDate.getMonth()+1)]," ");
document.write(LastModifiedDate.getDate(),", ",(LastModifiedDate.getYear()));
}

function clearform (arg) {
var object = document.forms[arg].elements
var repeat = object.length - 3
for (var i = 0; i < repeat; i++) {
   object[i].value=""
   object[i].checked=false
   }
}

// BEGIN MAINTENANCE CALCULATOR ///////////////////////////////////


var modules = new Array(7)    
var base
function subA (quan,k) {
     var total = 0
   if ((k==0) || (k==1) || (k==2) || (k==3) || (k==4) || (k==6) || (k==7)) {
     base = 1000
     } else if (k==5) {
     base = 5000
   }         
   //document.write("Base="+base)
   //document.write("<b>Quan="+quan+"</b>")                        
   if (quan>=1) {      
         total = total + (1 * base * 0.15)
     	
	if(quan>=2) {
            total = total + (1 * base * 0.10) 
        
      	    if (quan>=3) {
                total = total + (1* base * 0.06)
     		    
		if ((quan>=4) && (quan<=49)) {
         	     total = total + ((quan-3) * base * .03)
		}
			
		else if (quan>49)  {
			    total = total + ((49-3) * base * .03) + ((quan-49) * base * .02)
		}
	     }
	 }
     }
     
     return total
}

function calc () {
     var grandtotal = 0
     modules[0]= document.forms[0].COG.value
     modules[1]= document.forms[0].DTM.value
     modules[2]= document.forms[0].SCT.value
     modules[3]= document.forms[0].HYD.value
     modules[4]= document.forms[0].MIN.value
     modules[5]= document.forms[0].ADV.value
     modules[6]= document.forms[0].GIS.value
     modules[7]= document.forms[0].TSU.value
     
     for (var i = 0; i<8; i++) {
        modules[i] = parseInt(modules[i])
        if (isNaN (modules[i])) {
          modules[i]=0
        }                   
        if (modules[i]>0) {
          grandtotal = grandtotal + subA(modules[i],i)
          /*
          document.write(modules[i])
          document.write('\n')
          document.write(i)
          */
        }    
     }
     if (grandtotal>0) {
        //document.forms[0].debug.value = grandtotal
        var fac = Math.ceil(grandtotal)
        var gtotal= fac 
     }        
       document.forms[0].CASH.value = gtotal
 }
 
function clearall () {
 document.forms[0].COG.value = ""
 document.forms[0].DTM.value = ""
 document.forms[0].SCT.value = ""
 document.forms[0].HYD.value = ""
 document.forms[0].MIN.value = ""
 document.forms[0].ADV.value = ""
 document.forms[0].GIS.value = ""
 document.forms[0].TSU.value = ""
 document.forms[0].CASH.value = "" 
 }

void function openm () {
  window.open("maintcalc.php","MaintCalc", "WIDTH=510 HEIGHT=125")
}

void function opendsn () {
  window.open("findmods.php","MaintCalc", "WIDTH=510 HEIGHT=600")
}

void function openaddnew () {
  window.open("add_customer.php","AddCustomer")
}
function loadpage(URL)
{
window.location.href="http://update.carlsonsw.com/updates.php?product="+URL
}
