// Copyright East Branch Engineering
// Created by jyle Web Design : http://www.jylewebdesign.com
// JavaScript Source, Included in all pages
<!--
function setActiveMenu(mLink,mCell){
	var theLink = document.getElementById(mLink);
	var theCell = document.getElementById(mCell);
	theLink.className = "menuLinkActive";
	//theCell.className = "menuActive";
}

function mOverli(theObj){
	theObj.className = "activeLIOver";
}

function mOutli(theObj){
	theObj.className = "activeLI";
}

function mOverMenu(theCell){
	theCell.className = "menuOver";
}

function mOutMenu(theCell){
	theCell.className = "menu";
}

function submitOver(theButton){
	theButton.src = "images/submit_over.gif";
	window.status = "Submit";
}

function submitOut(theButton){
	theButton.src = "images/submit.gif";
	window.status = "";
}

function checkForm(theForm){
	if(theForm == "uploadForm"){ validateUpload();}
	if(theForm == "contactForm"){ validateContact();}
}

function validateUpload(){
	var missing = "";
	var theForm = document.getElementById('uploadForm');
	if(theForm.email.value == ""){missing += "* Email\n"; theForm.email.focus();}
	if(theForm.name.value == ""){missing += "* Name\n"; theForm.name.focus();}
	if(theForm.file.value == ""){missing += "* File\n"; theForm.file.focus();}
	if(missing != ""){ messageBox("Please complete the following fields:\n%s",missing);}
	else{theForm.submit();}
}

function validateContact(){
	var missing = "";
	var theForm = document.getElementById('contactForm');
	if(theForm.phone.value == ""){missing += "* Phone\n"; theForm.phone.focus();}
	if(theForm.zip.value == ""){missing += "* Zip\n"; theForm.zip.focus();}
	if(theForm.state.value == ""){missing += "* State\n"; theForm.state.focus();}
	if(theForm.city.value == ""){missing += "* City\n"; theForm.city.focus();}
	if(theForm.address.value == ""){missing += "* Address\n"; theForm.address.focus();}
	if(theForm.name.value == ""){missing += "* Name\n"; theForm.name.focus();}
	if(missing != ""){ messageBox("Please complete the following fields:\n%s",missing);}
	else{theForm.submit();}
}


// Example:
// value1 = 3; value2 = 4;
// messageBox("text message %s and %s", value1, value2);
// this message box will display the text "text message 3 and 4"
function messageBox()
{
  var i, msg = "", argNum = 0, startPos;
  var args = messageBox.arguments;
  var numArgs = args.length;
  if(numArgs)
  {
    theStr = args[argNum++];
    startPos = 0;  endPos = theStr.indexOf("%s",startPos);
    if(endPos == -1) endPos = theStr.length;
    while(startPos < theStr.length)
    {
      msg += theStr.substring(startPos,endPos);
      if (argNum < numArgs) msg += args[argNum++];
      startPos = endPos+2;  endPos = theStr.indexOf("%s",startPos);
      if (endPos == -1) endPos = theStr.length;
    }
    if (!msg) msg = args[0];
  }
  alert(msg);
}

function replaceForm(ID){
	var theDiv = document.getElementById(ID);
	replaceInnerHTML('replace_td',theDiv.innerHTML);
	
}

function replaceInnerHTML(ID,newHTML){
	var theObj = document.getElementById(ID);
	theObj.innerHTML = newHTML;
}

function replaceElementValue(ID,newValue){
	var theObj = document.getElementById(ID);
	theObj.value =  theObj.value + newValue;
}

-->
