
function doPostBack(eventTarget, eventArgument) {
		var theform;
		if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
			theform = document.forms["frmMain"];
		}
		else {
			theform = document.frmMain;
		}
		theform.GUIDEDSEARCH.value = eventTarget.split("$").join(":");
		theform.submit();
}


//Function for Lessons In Lighting to check answers to quizes
function Check(ans){
	if(ans){
		document.img1.src = "/LOL_Lessons/jsp/quiz_stuff/correct.gif";
	}
	else {document.img1.src = "/LOL_Lessons/jsp/quiz_stuff/incorrect.gif";}
}

//Function to check final exam in Lessons in Lighting
function CheckFinal() {
  var opgroup = document.exam.option
  var chkd = 0;
  for(var x=0; x < opgroup.length; x++){
    if(opgroup[x].checked){
          chkd = 1;
	}
   }
  if(chkd  == 0){
    alert("Please select an answer to continue the exam.");
	return false;
  }else{
    return true;
  }
 }

//Function to validate length of comment in myComment.jsp form
function checkMyCommentForm(){
   var missinginfo = "";
   if(document.proj.comment.value.length > 2000){
    missinginfo ="The comment contains to many characters,\n please reduce the size by " + (document.proj.comment.value.length - 2000) + " characters.";
    alert(missinginfo);
    document.proj.comment.focus();
    return false;
   }
   else return true;
 }


//Function to validate MyLightolier Project Form
function checkMyForm() {

   var missinginfo = "";
   for(i=0; i<document.proj.elements.length; i++){
     if(document.proj.elements[i].name.indexOf("qty") > -1){
     	// Reg Expression to ensure each line qty is a number and only a number
    	if(!/^\d+$/.test(document.proj.elements[i].value)){
           alert("Line quantity must be a numeric value.");
           //document.proj.elements[i].name.focus();
           return false;
        }
     }
     if(document.proj.elements[i].name.indexOf("length") > -1){
     	// Reg Expression to ensure each line qty is a number and only a number
    	if(!/^\d+$/.test(document.proj.elements[i].value)){
           alert("Length must be a numeric value representing feet.");
           //document.proj.elements[i].name.focus();
           return false;
        }
     }
     if(document.proj.elements[i].name.indexOf("price") > -1){
       if(!/^\d+(\.\d+)?$/.test(document.proj.elements[i].value)){
           alert("Price field must be a numeric value \n and should not include a comma.");
           return false;
       }
     }
   }

  // Reg Expression to ensure each line qty is a number and only a number
  if(!/^\d+(\.\d+)?$/.test(document.proj.proj_budget.value)){
           alert("Project budget must be a numeric value \n and should not include a comma.");
           //document.proj.elements[i].name.focus();
           return false;
   }
  if(document.proj.proj_state.value == "#" || document.proj.proj_state.value == "N/A" ||document.proj.proj_state.value == ""   ){
    alert("Please select the state where the project is located.");
    document.proj.proj_state.focus();
    return false;
   }
   if(document.proj.proj_name.value == ""){
    alert("Please enter a Project Name");
    document.proj.proj_name.focus();
    return false;
   }
   else return true;
 }


//Function to validate email address in the email project document form
function checkEmailDoc(){
   var missinginfo = "";
   var failedcount =0;
   var passedcount = 0;
   for(i=0; i<document.emaildoc.elements.length; i++){
     if(document.emaildoc.elements[i].name.indexOf("email") > -1){
     	passedcount++;
     	// Reg Expression to ensure each line qty is a number and only a number
     	 if((document.emaildoc.elements[i].value.indexOf('@') == -1) || (document.emaildoc.elements[i].value.indexOf('.') == -1)){
         failedcount++;
       }
     }
   }
   if(failedcount == passedcount){
        alert("A minimum of one email address is required.");
        document.emaildoc.elements[0].focus();
        return false;
   }
   return true;

}

//Function to validate email address in the email project document form
function checkDocDownload(){

   var passedcount = 0;
   for(i=0; i<document.files.elements.length; i++){
     if(document.files.elements[i].checked){
     	passedcount = 1;
     }
   }
   if(passedcount == 0){
        alert("Please select which documents you would like to download.");
        return false;
   }
   return true;

}



function MM_setTextOfTextfield() { //v3.0
  var list = document.frmsrch.srchtype;
  if(list.options[list.selectedIndex].value == "3"){
      document.frmsrch.srchorder.value = "MM-DD-YY";
  }else if(list.options[list.selectedIndex].value == "5"){
     document.frmsrch.srchorder.value = "";
      document.frmsrch.submit();
  }else{
      document.frmsrch.srchorder.value = "";
  }
}

function MM_changeProp() { //v6.0
  if(document.frmsrch.srchorder.value == "MM-DD-YY"){
      document.frmsrch.srchorder.value = "";
  }
}

function loadBottom(fl){
//  alert("FL:" + fl);
  parent.BOTTOM.location= fl;
}

function popUpCenteredWindow(location,name,type){
var iMyWidth;
var iMyHeight;
if(type == "B"){
//gets top and left positions based on user's resolution so hint window is centered.
  iMyWidth = (window.screen.width/2) - (212 + 10)//half the screen width minus half the new window width (plus 5 pixel borders).
  iMyHeight = (window.screen.height/2) - (200 + 50)//half the screen height minus half the new window height (plus title and status bars).
  msgWindow = window.open(location,name,"status=no,height=400,width=425,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes")
}else if(type == "C"){
  iMyWidth = (window.screen.width/2) - (200 + 10)//half the screen width minus half the new window width (plus 5 pixel borders).
  iMyHeight = (window.screen.height/2) - (300 + 50)//half the screen height minus half the new window height (plus title and status bars).
  msgWindow = window.open(location,name,"status=no,height=600,width=400,menubar=no,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes")
}else if(type == "D"){
  iMyWidth = (window.screen.width/2) - (400 + 10)//half the screen width minus half the new window width (plus 5 pixel borders).
  iMyHeight = (window.screen.height/2) - (300 + 50)//half the screen height minus half the new window height (plus title and status bars).
  msgWindow = window.open(location,name,"status=no,height=600,width=800,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes")
}else if(type == "P"){ //Pendalyte Popup
  iMyWidth = (window.screen.width/2) - (300 + 10)//half the screen width minus half the new window width (plus 5 pixel borders).
  iMyHeight = (window.screen.height/2) - (300 + 50)//half the screen height minus half the new window height (plus title and status bars).
  msgWindow = window.open(location,name,"toolbar=yes,status=yes,height=600,width=690,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes")
}else{
 iMyWidth = (window.screen.width/2) - (300 + 10)//half the screen width minus half the new window width (plus 5 pixel borders).
 iMyHeight = (window.screen.height/2) - (250 + 50)//half the screen height minus half the new window height (plus title and status bars).
 msgWindow = window.open(location,name,"status=no,height=350,width=650,menubar=yes,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=yes")
}
if (msgWindow.opener == null) msgWindow.opener = self;
msgWindow.focus();
}



function checkFieldsOrder() {
  msgError = "";
  var list = document.frmsrch.srchtype;
  var found = 0;
  if (list.options[list.selectedIndex].value != "4" && list.options[list.selectedIndex].value != "5" ){
        if(list.options[list.selectedIndex].value == "3"){
           if(! isDate(document.frmsrch.srchorder.value,'mm-dd-yy')){
             msgError = "The required date format is MM-DD-YY.";
            }
        }else if(document.frmsrch.srchorder.value == ""){
             msgError = "A full or partial number is required \n for this search type.";
          }
  }

  if(msgError != ""){
       alert(msgError);
       document.frmsrch.srchorder.focus();
       return false;
  }else{
       return true;
  }
 }



//Lessons In Lighting Registration Form Validator
function checkLessonReg() {

   var name = new RegExp(/\W/)
   if (name.test(Request.loginid.value ) ){
     alert("Login ID must be only alphanumeric characters.");
     Request.loginid.focus();
     return (false);
   }
   if ((Request.loginid.value == "") ||(Request.loginid.value.length < 6)) {
		  alert("Login ID must be filled in and must be at least 6 characters.");
		  Request.loginid.focus();
		  return (false);
   }
   var pwd = new RegExp(/\W/)
   if (pwd.test(Request.password.value ) )	{
		  alert("Password must be only alphanumeric characters.");
		  Request.password.focus();
		  return (false);
	}
	  if (Request.password.value.length < 6)
	  {
		  alert("The password field must be at least 6 alphanumeric characters.");
		  Request.password.focus();
		  return (false);
	  }

	 if (Request.password.value == "" ){
		  alert("Please fill in the password field.");
		  Request.password.focus();
		  return (false);
	  }

 if (Request.password2.value != Request.password.value )
  {
  alert("Password do not match please try again");
  Request.password.value = ""
  Request.password2.value = ""
  Request.password.focus();
  return (false);
  }
                var missinginfo = "";

                if(document.Request.name.value == "") {
                        missinginfo += "\n     -  Name";
                }
                if(document.Request.company.value == "") {
                        missinginfo += "\n     -  Organization";
                }
                if(document.Request.add1.value == "") {
                        missinginfo += "\n     -  Address";
                }
                if(document.Request.city.value == "") {
                        missinginfo += "\n     -  City";
                }
                if(document.Request.state.value == "") {
                        missinginfo += "\n     -  State";
                }
                if(document.Request.zip.value == "") {
                        missinginfo += "\n     -  Zip";
                }
                if ((document.Request.email.value == "") ||
                        (document.Request.email.value.indexOf('@') == -1) || (document.Request.email.value.indexOf('.') == -1)) {
                        missinginfo += "\n     -  Email address";
                }
                if (missinginfo != "") {
                        missinginfo ="_____________________________\n" +
                        "You failed to correctly fill in your:\n" +
                        missinginfo + "\n_____________________________" +
                        "\nPlease re-enter and submit again!";
                        alert(missinginfo);
                        return false;
                }
                else return true;
        }

   //Validate function for the submit for pricing form
   function chkPricingFrm() {
   	 var missinginfo = "";
         var frm = "document.Request"
                if (document.Request.fname.value == "") {
                        missinginfo += "\n     - First Name";
                }
                if (document.Request.lname.value == "") {
                        missinginfo += "\n     - Last Name";
                }
                if (document.Request.company.value == "") {
                         missinginfo += "\n     - Organization";
                }
                if (document.Request.profession.value == "") {
                        missinginfo += "\n     - Profession";
                }
               if (document.Request.add1.value == "") {
                        missinginfo += "\n     - Address 1";
                }

                if (document.Request.city.value == "") {
                        missinginfo += "\n     - City";
                }
                if (document.Request.state.value == "") {
                        missinginfo += "\n     - State";
                }

                if (document.Request.zip.value == "") {
                        missinginfo += "\n     - Zip";
                }
                if (document.Request.phone.value == "") {
                        missinginfo += "\n     - Phone";
                }
                if (document.Request.email.value == "") {
                        missinginfo += "\n     - Email";
                }
               if (missinginfo != "") {
                        missinginfo ="_____________________________\n" +
                        "You failed to correctly fill in your:\n" +
                        missinginfo + "\n_____________________________" +
                        "\nPlease re-enter and submit again!";
                        alert(missinginfo);
                        return false;
                }
                else return true;
        }
   //Validator used for Literature Request JSP Page /Literature/LitRequest.jsp

   function checkLitReques() {
                var missinginfo = "";
                var frm = "document.Request"

                if (document.Request.fname.value == "") {
                        missinginfo += "\n     - First Name";
                }
                if (document.Request.lname.value == "") {
                        missinginfo += "\n     - Last Name";
                }
                if (document.Request.title.value == "") {
                        missinginfo += "\n     - Title";
                }
                if (document.Request.company.value == "") {
                        missinginfo += "\n     - Company/School";
                }
                if (document.Request.profession.value == "") {
                        missinginfo += "\n     - Work";
                }
                if (document.Request.add1.value == "") {
                        missinginfo += "\n     - Address 1";
                }
                if (document.Request.city.value == "") {
                        missinginfo += "\n     - City";
                }

                if (document.Request.zip.value == "") {
                        missinginfo += "\n     - Zip";
                }
                if (document.Request.phone.value == "") {
                        missinginfo += "\n     - Phone";
                }
                if ((document.Request.email.value == "") ||
                        (document.Request.email.value.indexOf('@') == -1) || (document.Request.email.value.indexOf('.') == -1)) {
                        missinginfo += "\n     -  Email address";
                }

                if (missinginfo != "") {
                        missinginfo ="_____________________________\n" +
                        "You failed to correctly fill in your:\n" +
                        missinginfo + "\n_____________________________" +
                        "\nPlease re-enter and submit again!";
                        alert(missinginfo);
                        return false;
                }
                else return true;
        }


      function checkRegRequest() {
                var missinginfo = "";
                var frm = "document.Request"

                if (document.Request.fname.value == "") {
                        missinginfo += "\n     - First Name";
                }
                if (document.Request.lname.value == "") {
                        missinginfo += "\n     - Last Name";
                }
                if (document.Request.title.value == "") {
                        missinginfo += "\n     - Title";
                }
                if (document.Request.company.value == "") {
                        missinginfo += "\n     - Company/School";
                }
                if (document.Request.profession.value == "") {
                        missinginfo += "\n     - Work";
                }
                if (document.Request.add1.value == "") {
                        missinginfo += "\n     - Address 1";
                }
                if (document.Request.city.value == "") {
                        missinginfo += "\n     - City";
                }
                if (document.Request.state.value == "") {
                        missinginfo += "\n     - State";
                }

                if (document.Request.zip.value == "") {
                        missinginfo += "\n     - Zip";
                }
                if (document.Request.phone.value == "") {
                        missinginfo += "\n     - Phone";
                }
                if ((document.Request.email.value == "") ||
                        (document.Request.email.value.indexOf('@') == -1) || (document.Request.email.value.indexOf('.') == -1)) {
                        missinginfo += "\n     -  Email address";
                }

                if (missinginfo != "") {
                        missinginfo ="_____________________________\n" +
                        "You failed to correctly fill in your:\n" +
                        missinginfo + "\n_____________________________" +
                        "\nPlease re-enter and submit again!";
                        alert(missinginfo);
                        return false;
                }
                else return true;
        }

   function checkMyReg() {
                var missinginfo = "";
                var frm = "document.Request"
                if ((document.Request.j_username.value == "") ||
                        (document.Request.j_username.value.indexOf('@') == -1) || (document.Request.j_username.value.indexOf('.') == -1)) {
                        missinginfo += "\n     -  Missing a valid email address";
                }
                if (document.Request.j_password.value != document.Request.j_password2.value){
                        missinginfo += "\n     -  Passwords do not match, please try again.";
                }
                var pwd = new RegExp(/\W/)
                if (pwd.test(Request.j_password.value )){
		  missinginfo += "\n     -  Password must be only alphanumeric characters.";
		  //Request.password.focus();
	        }
	        if (Request.j_password.value.length < 6)
	        {
		  missinginfo += "\n     -  The password must be at least 6 alphanumeric characters.";
		  //Request.password.focus();
	        }
                if (missinginfo != "") {
                        missinginfo ="_____________________________\n" +
                        "Registration Error:\n" +
                        missinginfo + "\n_____________________________" +
                        "\nPlease re-enter and submit again!";
                        alert(missinginfo);
                        return false;
                }
                else return true;
        }


  //Dennise 6/28/2004 10:45AM jscript to validate SiteHelp.jsp page
   function checkSiteHelp() {
                var missinginfo = "";
                var frm = "document.Request"

                if (document.Request.fname.value == "") {
                        missinginfo += "\n     - First Name";
                }

                if (document.Request.profession.value == "" || document.Request.profession.value == "Please Select One") {
                        missinginfo += "\n     - Profession";
                }
                if (document.Request.city.value == "" || document.Request.city.value == "Please Select One") {
                        missinginfo += "\n     - City";
                }
                if (document.Request.state.value == "" || document.Request.state.value == "Please Select One") {
                        missinginfo += "\n     - State";
                }
                if ((document.Request.email.value == "") ||
                        (document.Request.email.value.indexOf('@') == -1) || (document.Request.email.value.indexOf('.') == -1)) {
                        missinginfo += "\n     - Email";
                }
                var topic = false;
               for (i=0;i<document.Request.topic.length;i++){
                    if (document.Request.topic[i].checked==true)
                    topic = true;
                }
                if(!topic)
                   missinginfo += "\n     - Topic";

                if (document.Request.description.value == "") {
                        missinginfo += "\n     - Help Message";
                }

                if (missinginfo != "") {
                        missinginfo ="_____________________________\n" +
                        "You failed to correctly fill in your:\n" +
                        missinginfo + "\n_____________________________" +
                        "\nPlease re-enter and submit again!";
                        alert(missinginfo);
                        return false;
                }
                else return true;
        }

 function checkDWLHelp() {
                var missinginfo = "";
                var frm = "document.Request"

                if (document.Request.name.value == "") {
                        missinginfo += "\n     - Name";
                }
                if ((document.Request.email.value == "") ||
                        (document.Request.email.value.indexOf('@') == -1) || (document.Request.email.value.indexOf('.') == -1)) {
                        missinginfo += "\n     - Email";
                }
                if (document.Request.description.value == "") {
                        missinginfo += "\n     - Question / Problem";
                }

                if (missinginfo != "") {
                        missinginfo ="_____________________________\n" +
                        "You failed to correctly fill in your:\n" +
                        missinginfo + "\n_____________________________" +
                        "\nPlease re-enter and submit again!";
                        alert(missinginfo);
                        return false;
                }
                else return true;
        }
//Used in CLS to Load Instruction and Specification Sheets
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  if(selObj.options[selObj.selectedIndex].value.indexOf(".PDF") > 0  ){
      var bName = navigator.appName;
      var bVer = parseFloat(navigator.appVersion);
      if (bName == "Netscape")
       //  eval(targ+".location='LOL_FileDirector.jsp?FILE="+selObj.options[selObj.selectedIndex].value+"'");
       eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
      else
       //  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
         window.open('/CLS/LOL_FileDirector.jsp?FILE=' + selObj.options[selObj.selectedIndex].value,'Lightolier','toolbar=no,resizable=yes,location=yes,directories=no,status=no,menubar=no');
       //  window.open(""http://www.designingwithlight.com/"LOL_Catalog.jsp?PDF=Y&CATREL_ID=<%= request.getParameter("CATREL_ID") %>&FL=" + selObj.options[selObj.selectedIndex].value,'Lightolier','toolbar=no,resizable=yes,location=yes,directories=no,status=no,menubar=no');
     selObj.selectedIndex=0;
  }
}



//Used in Load IES Zip Files from the downloads page of the website
function IES_jumpMenu(targ,selObj,restore){ //v3.0
      var bName = navigator.appName;
      var bVer = parseFloat(navigator.appVersion);
      if (bName == "Netscape")
       //  eval(targ+".location='LOL_FileDirector.jsp?FILE="+selObj.options[selObj.selectedIndex].value+"'");
       eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
      else
       //  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
         window.open('/CLS/LOL_FileDirector.jsp?FILE=' + selObj.options[selObj.selectedIndex].value,'Lightolier','toolbar=no,resizable=yes,location=yes,directories=no,status=no,menubar=no');
       //  window.open(""http://www.designingwithlight.com/"LOL_Catalog.jsp?PDF=Y&CATREL_ID=<%= request.getParameter("CATREL_ID") %>&FL=" + selObj.options[selObj.selectedIndex].value,'Lightolier','toolbar=no,resizable=yes,location=yes,directories=no,status=no,menubar=no');
     selObj.selectedIndex=0;
}

//igen
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function MM_checkPlugin(plgIn, theURL, altURL, autoGo) { //v4.0
  var ok=false; document.MM_returnValue = false;
  with (navigator)
   if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)) {
       ok=(plugins && plugins[plgIn]);
  } else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
      if (plgIn.indexOf("Flash")!=-1 && window.MM_flash!=null) ok=window.MM_flash;
      else if (plgIn.indexOf("Director")!=-1 && window.MM_dir!=null) ok=window.MM_dir;
      else ok=autoGo;
  }
  if (!ok) theURL=altURL; if (theURL) window.location=theURL;
}

function MM_checkBrowser(NSvers,NSpass,NSnoPass,IEvers,IEpass,IEnoPass,OBpass,URL,altURL) { //v4.0
  var newURL='', verStr=navigator.appVersion, app=navigator.appName, version = parseFloat(verStr);
  if (app.indexOf('Netscape') != -1) {
    if (version >= NSvers) {if (NSpass>0) newURL=(NSpass==1)?URL:altURL;}
    else {if (NSnoPass>0) newURL=(NSnoPass==1)?URL:altURL;}
  } else if (app.indexOf('Microsoft') != -1) {
    if (version >= IEvers || verStr.indexOf(IEvers) != -1)
     {if (IEpass>0) newURL=(IEpass==1)?URL:altURL;}
    else {if (IEnoPass>0) newURL=(IEnoPass==1)?URL:altURL;}
  } else if (OBpass>0) newURL=(OBpass==1)?URL:altURL;
  if (newURL) { window.location=unescape(newURL); document.MM_returnValue=false; }
}

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_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 to validate MyLightolier Project Form
function SelectAllDocs(theElement) {
   var theForm = theElement.form, z = 0;
     while (theForm[z].type == 'checkbox' && theForm[z].name != 'selectall') {
      theForm[z].checked = theElement.checked;
      z++;
     }
 }

function P7_Snap() { //v2.62 by PVII
  var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,args=P7_Snap.arguments;a=parseInt(a);
  for (k=0; k<(args.length-3); k+=4)
   if ((g=MM_findObj(args[k]))!=null) {
    el=eval(MM_findObj(args[k+1]));
    a=parseInt(args[k+2]);b=parseInt(args[k+3]);
    x=0;y=0;ox=0;oy=0;p="";tx=1;da="document.all['"+args[k]+"']";
    if(document.getElementById) {
     d="document.getElementsByName('"+args[k]+"')[0]";
     if(!eval(d)) {d="document.getElementById('"+args[k]+"')";if(!eval(d)) {d=da;}}
    }else if(document.all) {d=da;}
    if (document.all || document.getElementById) {
     while (tx==1) {p+=".offsetParent";
      if(eval(d+p)) {x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
      }else{tx=0;}}
     ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);var tw=x+ox+y+oy;
     if(tw==0 || (navigator.appVersion.indexOf("MSIE 4")>-1 && navigator.appVersion.indexOf("Mac")>-1)) {
      ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);
      }else{var w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;
      a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
      x=document.body.scrollLeft + event.clientX + bx;
      y=document.body.scrollTop + event.clientY;}}
   }else if (document.layers) {x=g.x;y=g.y;var q0=document.layers,dd="";
    for(var s=0;s<q0.length;s++) {dd='document.'+q0[s].name;
     if(eval(dd+'.document.'+args[k])) {x+=eval(dd+'.left');y+=eval(dd+'.top');break;}}}
   if(el) {e=(document.layers)?el:el.style;
   var xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
   if(navigator.appName=="Netscape" && parseInt(navigator.appVersion)>4){xx+="px";yy+="px";}
   if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
    xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);
    xx+="px";yy+="px";}e.left=xx;e.top=yy;}}
}

//Function to validate MyLightolier Project Form
function checkCustLine() {
      if (document.proj.cust_item.value == ""){
          alert("Item field cannot be empty");
          document.proj.cust_item.focus();
           return false;
       }
       if (document.proj.cust_mfg.value == ""){
          alert("Manufacturer field cannot be empty");
          document.proj.cust_mfg.focus();
           return false;
       }
     	// Reg Expression to ensure each line qty is a number and only a number
    	if(!/^\d+$/.test(document.proj.cust_qty.value)){
           alert("Line quantity must be a numeric value.");
           document.proj.cust_qty.focus();
           return false;
        }
     //  if(!/^\d+(\.\d+)?$/.test(document.proj.cust_price.value)){
     //      alert("Price field must be a numeric value \n and should not include a comma.");
     //       document.proj.cust_price.focus();
     //      return false;
     //  }

}
function checkAddItem() {
   var missinginfo = "";
   for(i=0; i<document.additem.elements.length; i++){
     if(document.additem.elements[i].name.indexOf("qty_") > -1){
     	// Reg Expression to ensure each line qty is a number and only a number
    	if(/^\d+$/.test(document.additem.elements[i].value)){
           //document.proj.elements[i].name.focus();
           return true;
        }
     }
  }
        alert("Please enter a quantity for the items\nto be added.");
           //document.proj.elements[i].name.focus();
           return false;
}

//Function to validate MyLightolier Project Form
function checkLineEdit() {
      if (document.lineedit.mod_note.value == ""){
          alert("Please provide a note to the user \nregarding the recommendation.");
          document.lineedit.mod_note.focus();
           return false;
       }
       for(i=0; i<document.lineedit.elements.length; i++){
           if(document.lineedit.elements[i].name.indexOf("qty") > -1 || document.lineedit.elements[i].name.indexOf("length") > -1 ){
     	     // Reg Expression to ensure each line qty is a number and only a number
    	      if(!/^\d+$/.test(document.lineedit.elements[i].value)){
              alert("Please enter a quantity for the items\nto be added.");
              return false;
             }
           }
      }
       if(!/^\d+(\.\d+)?$/.test(document.lineedit.price.value)){
           alert("Price field must be a numeric value \n and should not include a comma.");
           document.lineedit.price.focus();
           return false;
       }
     	return true;
}

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 confirmDelete(	) {
  if (confirm("Are you sure you want to remove this project?\n It will be permanently deleted.")) {
    return true;
  }else{
    return false;
  }

}
