function ValidateFormLogin()
				{
					if(document.frm_login.txtemail.value=='')
						{
							alert('Please enter your Username!');
							document.frm_login.txtemail.focus();
							return false;
						}
					if(document.frm_login.txtpass.value=='')
						{
							alert('Please enter your Password!');
							document.frm_login.txtpass.focus();
							return false;
						}
					else 
						{
							document.frm_login.submit();
						}
}

function ValidateFormForgot()
	{
		if(document.frm_forgot.txtemail_f.value=='')
			{
				alert('Please enter email.');
				document.frm_forgot.txtemail_f.focus();
				return false;
			}
		else 
			{
				document.frm_forgot.submit();
			}
	}

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];}
}


//validate_add_project
function validate_add_project()
{
	if(document.add_project.txtProjectName.value==''){ alert('Please enter Project Name.');
				document.frm_a.ProjectName.focus();document.frm_a.ProjectName.select(); return false;}
	//if(document.add_project.txtsel_SalesID.value==''){ alert('Please select Sales Person.');return false;}
	if(document.add_project.txtsel_CustomersID.value==''){ alert('Please select Customer.');return false;}
	if(document.add_project.SoldToName.value==''){ alert('Please enter Sold To Name.');
				document.add_project.SoldToName.focus();document.add_project.SoldToName.select(); return false;}
	if(document.add_project.SoldToAddress1.value==''){ alert('Please enter Sold To Address1.');
				document.add_project.SoldToAddress1.focus();document.add_project.SoldToAddress1.select(); return false;}
	if(document.add_project.SoldToCity.value==''){ alert('Please enter Sold To City.');
				document.add_project.SoldToCity.focus();document.add_project.SoldToCity.select(); return false;}
	if(document.add_project.SoldToZip.value==''){ alert('Please enter Sold To Zip.');
				document.add_project.SoldToZip.focus();document.add_project.SoldToZip.select(); return false;}
	if(document.add_project.SoldToPhone.value==''){ alert('Please enter Sold To Phone.');
				document.add_project.SoldToPhone.focus();document.add_project.SoldToPhone.select(); return false;}
				
	if(document.add_project.ShipToName.value==''){ alert('Please enter Ship To Name.');
				document.add_project.ShipToName.focus();document.add_project.ShipToName.select(); return false;}
	if(document.add_project.ShipToAddress1.value==''){ alert('Please enter Ship To Address1.');
				document.add_project.ShipToAddress1.focus();document.add_project.ShipToAddress1.select(); return false;}
	if(document.add_project.ShipToCity.value==''){ alert('Please enter Ship To City.');
				document.add_project.ShipToCity.focus();document.add_project.ShipToCity.select(); return false;}
	if(document.add_project.ShipToZip.value==''){ alert('Please enter Ship To Zip.');
				document.add_project.ShipToZip.focus();document.add_project.ShipToZip.select(); return false;}
	if(document.add_project.ShipToPhone.value==''){ alert('Please enter Ship To Phone.');
				document.add_project.ShipToPhone.focus();document.add_project.ShipToPhone.select(); return false;}
		else 
			{
				document.add_project.submit();
			}

}

//admin//
function check_form_products_add(){
			if(document.dealer_add_save.ProductID.value=='')
			{
				alert('Please enter Product ID.');document.dealer_add_save.ProductID.focus();return false;
			}
			if(document.dealer_add_save.Description.value=='')
			{
				alert('Please enter Description.');document.dealer_add_save.Description.focus();return false;
			}
		else 
			{document.dealer_add_save.submit();}

}

var good;
function checkEmailAddress(field){	
	var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
if (goodEmail)
	{
		good = true;
		}else{
		alert('Please enter a valid address.');
		document.frm_login.txtemail.focus();
		document.frm_login.txtemail.select();
		good = false;
		}
	}
function index_mailThisUrl() 
{
					good = false;
					if(document.frm_login.txtemail.value!=""){
						checkEmailAddress(document.frm_login.txtemail);
					}
}
// delete quote

											function delete_quote(a)
												{
												if(confirm('Delete quote?'))
												{document.location.href='quote.php?action=del&QuoteID='+a;}
												else{}
												}
// delete quote
// delete sales order

											function delete_salesOrder(a)
												{
												if(confirm('Delete order?'))
												{document.location.href='quote.php?action=del&QuoteID='+a+'&tip=order';}
												else{}
												}
// delete salesorder

//admin - delete door style
											function delete_doorstyle(a,b){
												if(confirm('Delete Door Style?'))
												{document.location.href='pricing.php?DID='+a+'&sel_cab_lineid='+b+'&action=del_door';}
												else{}
												}

//admin - delete options
											function delete_options(a,b){
												if(confirm('Delete Option?'))
												{document.location.href='options.php?DID='+a+'&sel_cab_lineid='+b+'&action=del_door';}
												else{}
												}

//admin - delete options

//admin - delete option
											function delete_option(a,b){
												if(confirm('Delete Option?'))
												{document.location.href='pricing.php?OID='+a+'&sel_cab_lineid='+b+'&action=del_option';}
												else{}
												}
//admin delete option
//admin - submit's
				function submit_listprice(a,b){
					document.location.href='pricing.php?sel_cab_lineid='+a+'&sel_ListPrice='+b;
					}
				function submit_GlazeAvail(a,b){
					document.location.href='pricing.php?sel_cab_lineid='+a+'&GlazeAvail=upd';
					}
			  	function submit_cabinet(a){
					document.location.href='pricing.php?sel_cab_lineid='+a;
					}
//admin - submit's
//AddBaseItems
	function check_selections(){
			kk=0;
			if((document.frm_cleanup.fes1)&&(document.frm_cleanup.qty_box1.value!="")){vv=frm_cleanup.fes1.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes1.focus(); return false;} }
			if((document.frm_cleanup.fes2)&&(document.frm_cleanup.qty_box2.value!="")){vv=frm_cleanup.fes2.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes2.focus(); return false;} }
			if((document.frm_cleanup.fes3)&&(document.frm_cleanup.qty_box3.value!="")){vv=frm_cleanup.fes3.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes3.focus(); return false;} }
			if((document.frm_cleanup.fes4)&&(document.frm_cleanup.qty_box4.value!="")){vv=frm_cleanup.fes4.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes4.focus(); return false;} }
			if((document.frm_cleanup.fes5)&&(document.frm_cleanup.qty_box5.value!="")){vv=frm_cleanup.fes5.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes5.focus(); return false;} }
			if((document.frm_cleanup.fes6)&&(document.frm_cleanup.qty_box6.value!="")){vv=frm_cleanup.fes6.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes6.focus(); return false;} }
			if((document.frm_cleanup.fes7)&&(document.frm_cleanup.qty_box7.value!="")){vv=frm_cleanup.fes7.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes7.focus(); return false;} }
			if((document.frm_cleanup.fes8)&&(document.frm_cleanup.qty_box8.value!="")){vv=frm_cleanup.fes8.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes8.focus(); return false;} }
			if((document.frm_cleanup.fes9)&&(document.frm_cleanup.qty_box9.value!="")){vv=frm_cleanup.fes9.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes9.focus(); return false;} }
			if((document.frm_cleanup.fes10)&&(document.frm_cleanup.qty_box10.value!="")){vv=frm_cleanup.fes10.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes10.focus(); return false;} }
			
			if((document.frm_cleanup.fes11)&&(document.frm_cleanup.qty_box11.value!="")){vv=frm_cleanup.fes11.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes11.focus(); return false;} }
			if((document.frm_cleanup.fes12)&&(document.frm_cleanup.qty_box12.value!="")){vv=frm_cleanup.fes12.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes12.focus(); return false;} }
			if((document.frm_cleanup.fes13)&&(document.frm_cleanup.qty_box13.value!="")){vv=frm_cleanup.fes13.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes13.focus(); return false;} }
			if((document.frm_cleanup.fes14)&&(document.frm_cleanup.qty_box14.value!="")){vv=frm_cleanup.fes14.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes14.focus(); return false;} }
			if((document.frm_cleanup.fes15)&&(document.frm_cleanup.qty_box15.value!="")){vv=frm_cleanup.fes15.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes15.focus(); return false;} }
			if((document.frm_cleanup.fes16)&&(document.frm_cleanup.qty_box16.value!="")){vv=frm_cleanup.fes16.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes16.focus(); return false;} }
			if((document.frm_cleanup.fes17)&&(document.frm_cleanup.qty_box17.value!="")){vv=frm_cleanup.fes17.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes17.focus(); return false;} }
			if((document.frm_cleanup.fes18)&&(document.frm_cleanup.qty_box18.value!="")){vv=frm_cleanup.fes18.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes18.focus(); return false;} }
			if((document.frm_cleanup.fes19)&&(document.frm_cleanup.qty_box19.value!="")){vv=frm_cleanup.fes19.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes19.focus(); return false;} }
			
			if((document.frm_cleanup.fes20)&&(document.frm_cleanup.qty_box20.value!="")){vv=frm_cleanup.fes20.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes20.focus(); return false;} }
			if((document.frm_cleanup.fes21)&&(document.frm_cleanup.qty_box21.value!="")){vv=frm_cleanup.fes21.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes21.focus(); return false;} }
			if((document.frm_cleanup.fes22)&&(document.frm_cleanup.qty_box22.value!="")){vv=frm_cleanup.fes22.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes22.focus(); return false;} }
			if((document.frm_cleanup.fes23)&&(document.frm_cleanup.qty_box23.value!="")){vv=frm_cleanup.fes23.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes23.focus(); return false;} }
			if((document.frm_cleanup.fes24)&&(document.frm_cleanup.qty_box24.value!="")){vv=frm_cleanup.fes24.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes24.focus(); return false;} }
			if((document.frm_cleanup.fes25)&&(document.frm_cleanup.qty_box25.value!="")){vv=frm_cleanup.fes25.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes25.focus(); return false;} }
			if((document.frm_cleanup.fes26)&&(document.frm_cleanup.qty_box26.value!="")){vv=frm_cleanup.fes26.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes26.focus(); return false;} }
			if((document.frm_cleanup.fes27)&&(document.frm_cleanup.qty_box27.value!="")){vv=frm_cleanup.fes27.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes27.focus(); return false;} }
			if((document.frm_cleanup.fes28)&&(document.frm_cleanup.qty_box28.value!="")){vv=frm_cleanup.fes28.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes28.focus(); return false;} }
			if((document.frm_cleanup.fes29)&&(document.frm_cleanup.qty_box29.value!="")){vv=frm_cleanup.fes29.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes29.focus(); return false;} }
			
			if((document.frm_cleanup.fes30)&&(document.frm_cleanup.qty_box30.value!="")){vv=frm_cleanup.fes30.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes30.focus(); return false;} }
			if((document.frm_cleanup.fes31)&&(document.frm_cleanup.qty_box31.value!="")){vv=frm_cleanup.fes31.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes31.focus(); return false;} }
			if((document.frm_cleanup.fes32)&&(document.frm_cleanup.qty_box32.value!="")){vv=frm_cleanup.fes32.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes32.focus(); return false;} }
			if((document.frm_cleanup.fes33)&&(document.frm_cleanup.qty_box33.value!="")){vv=frm_cleanup.fes33.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes33.focus(); return false;} }
			if((document.frm_cleanup.fes34)&&(document.frm_cleanup.qty_box34.value!="")){vv=frm_cleanup.fes34.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes34.focus(); return false;} }
			if((document.frm_cleanup.fes35)&&(document.frm_cleanup.qty_box35.value!="")){vv=frm_cleanup.fes35.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes35.focus(); return false;} }
			if((document.frm_cleanup.fes36)&&(document.frm_cleanup.qty_box36.value!="")){vv=frm_cleanup.fes36.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes36.focus(); return false;} }
			if((document.frm_cleanup.fes37)&&(document.frm_cleanup.qty_box37.value!="")){vv=frm_cleanup.fes37.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes37.focus(); return false;} }
			if((document.frm_cleanup.fes38)&&(document.frm_cleanup.qty_box38.value!="")){vv=frm_cleanup.fes38.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes38.focus(); return false;} }
			if((document.frm_cleanup.fes39)&&(document.frm_cleanup.qty_box39.value!="")){vv=frm_cleanup.fes39.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes39.focus(); return false;} }

			if((document.frm_cleanup.fes40)&&(document.frm_cleanup.qty_box40.value!="")){vv=frm_cleanup.fes40.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes40.focus(); return false;} }
			if((document.frm_cleanup.fes41)&&(document.frm_cleanup.qty_box41.value!="")){vv=frm_cleanup.fes41.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes41.focus(); return false;} }
			if((document.frm_cleanup.fes42)&&(document.frm_cleanup.qty_box42.value!="")){vv=frm_cleanup.fes42.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes42.focus(); return false;} }
			if((document.frm_cleanup.fes43)&&(document.frm_cleanup.qty_box43.value!="")){vv=frm_cleanup.fes43.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes43.focus(); return false;} }
			if((document.frm_cleanup.fes44)&&(document.frm_cleanup.qty_box44.value!="")){vv=frm_cleanup.fes44.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes44.focus(); return false;} }
			if((document.frm_cleanup.fes45)&&(document.frm_cleanup.qty_box45.value!="")){vv=frm_cleanup.fes45.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes45.focus(); return false;} }
			if((document.frm_cleanup.fes46)&&(document.frm_cleanup.qty_box46.value!="")){vv=frm_cleanup.fes46.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes46.focus(); return false;} }
			if((document.frm_cleanup.fes47)&&(document.frm_cleanup.qty_box47.value!="")){vv=frm_cleanup.fes47.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes47.focus(); return false;} }
			if((document.frm_cleanup.fes48)&&(document.frm_cleanup.qty_box48.value!="")){vv=frm_cleanup.fes48.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes48.focus(); return false;} }
			if((document.frm_cleanup.fes49)&&(document.frm_cleanup.qty_box49.value!="")){vv=frm_cleanup.fes49.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes49.focus(); return false;} }

			if((document.frm_cleanup.fes50)&&(document.frm_cleanup.qty_box50.value!="")){vv=frm_cleanup.fes50.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes50.focus(); return false;} }			
			if((document.frm_cleanup.fes51)&&(document.frm_cleanup.qty_box51.value!="")){vv=frm_cleanup.fes51.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes51.focus(); return false;} }			
			if((document.frm_cleanup.fes52)&&(document.frm_cleanup.qty_box52.value!="")){vv=frm_cleanup.fes52.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes52.focus(); return false;} }			
			if((document.frm_cleanup.fes53)&&(document.frm_cleanup.qty_box53.value!="")){vv=frm_cleanup.fes53.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes53.focus(); return false;} }			
			if((document.frm_cleanup.fes54)&&(document.frm_cleanup.qty_box54.value!="")){vv=frm_cleanup.fes54.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes54.focus(); return false;} }			
			if((document.frm_cleanup.fes55)&&(document.frm_cleanup.qty_box55.value!="")){vv=frm_cleanup.fes55.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes55.focus(); return false;} }			
			if((document.frm_cleanup.fes56)&&(document.frm_cleanup.qty_box56.value!="")){vv=frm_cleanup.fes56.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes56.focus(); return false;} }			
			if((document.frm_cleanup.fes57)&&(document.frm_cleanup.qty_box57.value!="")){vv=frm_cleanup.fes57.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes57.focus(); return false;} }			
			if((document.frm_cleanup.fes58)&&(document.frm_cleanup.qty_box58.value!="")){vv=frm_cleanup.fes58.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes58.focus(); return false;} }			
			if((document.frm_cleanup.fes59)&&(document.frm_cleanup.qty_box59.value!="")){vv=frm_cleanup.fes59.value;if(vv==""){alert('Please select a Finished End Option before proceeding to Update');frm_cleanup.fes59.focus(); return false;} }			
			
			
			document.frm_cleanup.submit();
	}
//AddBaseItems
	function ShowHide(id, visibility) {
		obj = document.getElementsByTagName("div");
		obj[id].style.visibility = visibility;
	}
