// JavaScript Document

startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		try {
			for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+=" over";
					}
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		} catch (e) {  }
	}
}
window.onload=startList;

// Tech Systems unique functions
function documents_mailed() {
    var documents_mailed_sum;
    documents_mailed_sum = Number(document.documents_mailed_form.statements_mailed.value) + Number(document.documents_mailed_form.acknowledgments_mailed.value) + Number(document.documents_mailed_form.invoices_mailed.value) + Number(document.documents_mailed_form.credit_memos_mailed.value) + Number(document.documents_mailed_form.purchase_orders_mailed.value);
   documents_mailed_sum = documents_mailed_sum * 0.75 * 12;
    document.documents_mailed_form.documents_mailed_savings.value = "$" + documents_mailed_sum;
}

function daily_journals() {
	document.daily_journals_form.daily_journals_savings.value = "$" + document.daily_journals_form.daily_journals_value.value * 0.75 * 240;
}

function sales_reports() {
	document.sales_report_hours_form.sales_report_hours_savings.value = "$" + document.sales_report_hours_form.sales_report_hours.value * 0.50 * 30.00 * 12
}

function inventory() {
	document.inventory_value_form.inventory_value_savings.value = "$" + document.inventory_value_form.inventory_value.value * 0.15 * 0.30
}

function daily_orders() {
	document.daily_orders_form.daily_orders_savings.value = "$" + document.daily_orders_form.daily_orders_value.value * 1.65 * 240
}

function toggleview(element1){
	 element1 = document.getElementById(element1);
	if (element1.style.display == 'block' || element1.style.display == '')
	      element1.style.display = 'none';
	   else
	      element1.style.display = 'block';

	   return;
}

// end Tech Systems unique functions

//login
function SubmitLogin() {
  var f = document.loginform;
  var doSubmit = true;
  if (f.user.value=="") {
    if (f.password.value="") {
	  alert("Please enter a password");
	  f.password.focus();
	  doSubmit = false;
	  
	}
  alert("Please enter a login name");
  f.user.focus();
  doSubmit = false;
  }	
  if (doSubmit) {
    f.submit();
  }
}

function verifyLogin() {
  if (window.event && window.event.keyCode == 13) {
    SubmitLogin();
  }	
}

function goToLogin() {
  window.location = "customercare/requestLogin.jsp";   
}	

function registerForDemo() {
  var awin = window.open("customercare/RegisterForDemo.html","lookupwin","width=700,height=580,left=10,top=10,resizable=no,status=no,alwaysRaised=yes,dependent=yes");
  awin.focus();
}
// end login



// macromedia functions
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function toggleviewon(element1) {

   element1 = document.getElementById(element1);
      element1.style.display = 'block';
   return;
}


function toggleviewoff(element1) {
  element1 = document.getElementById(element1);
      element1.style.display = 'none';
   return;
}

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];}
}
//end macromedia functions
