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];}
}
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_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 NewsletterSubmit() {
	var txtEmail = document.getElementById("newsletter_signup");
	var reEmail = /^[\w-\.]+\@[\w\.-]+\.[a-z]{2,4}$/;
	if (!(reEmail.test(txtEmail.value))) {
		alert ("Please enter a valid e-mail address.");
		return false;
	}
	else {
		txtEmail.form.submit();
	}
}

//Checks if the supplied fields are empty and highlights field in red if so
function ContactFormValidation (sFieldIDs) {
	var i;
	var arrFields = sFieldIDs.split(":");
	var currField;
	var borderstyle = "1px solid #ea172a";
  var bgcolorstyle = "#F4857E";
	var bSubmitForm = true;
	var email= /^[\w-\.]+\@[\w\.-]+\.[a-zA-Z]{2,4}$/;
	
	for (i = 0; i < arrFields.length; i++) {
		// Get form field reference
		currField = document.getElementById(arrFields[i]);
		
		// Check for null in the case of a non existing html element
		if (currField != null) {
			// Set fields style to default
			SetBorderStyle(currField, "default");
			
			// If field is empty then set the style to red background and border
			if (currField.name.toLowerCase() == "email" && (!(email.test(currField.value)))) {
				SetBorderStyle(currField, "error");
				bSubmitForm = false;
			}
			else if (currField.value == "") {
				SetBorderStyle(currField, "error");
				bSubmitForm = false;
			}
		}
	}
	return bSubmitForm;
}
function SetBorderStyle(fldFormField, fDefaultOrError){
	if (fDefaultOrError.toLowerCase() == "error") {
		borderstyle = "1px solid #ea172a";
		bgcolorstyle = "#F4857E";
	}
	else if (fDefaultOrError.toLowerCase() == "default") {
		borderstyle = "1px solid #000000";
		bgcolorstyle = "#FFFFFF";
	}
	
	fldFormField.style.border = borderstyle;
	fldFormField.style.background = bgcolorstyle;
}


function mmLoadMenus() {
	if (window.mm_menu_0727170019_0) return;
	window.mm_menu_0727170019_0 = new Menu("root",171,21,"Arial, Helvetica, sans-serif",15,"#ffffff","#ffffff","#165a89","#4788c0","left","middle",3,0,250,-5,7,true,true,true,0,true,true);
	mm_menu_0727170019_0.addMenuItem("History","location='history.php'");
	mm_menu_0727170019_0.addMenuItem("The&nbsp;Ritchie&nbsp;Difference","location='ritchie_difference.php'");
	mm_menu_0727170019_0.fontWeight="bold";
	mm_menu_0727170019_0.hideOnMouseOut=true;
	mm_menu_0727170019_0.menuBorder=0;
	mm_menu_0727170019_0.menuLiteBgColor='#ffffff';
	mm_menu_0727170019_0.menuBorderBgColor='#4484bc';
	mm_menu_0727170019_0.bgColor='#ffffff';
		
	// Clearance Center
	if (window.mm_menu_0727170019_1) return;
	window.mm_menu_0727170019_1 = new Menu("root",165,21,"Arial, Helvetica, sans-serif",15,"#ffffff","#ffffff","#165a89","#4788c0","left","middle",3,0,250,-5,7,true,true,true,0,true,true);
	mm_menu_0727170019_1.addMenuItem("Clearance&nbsp;Centre","location='clearance_center.php'");
	mm_menu_0727170019_1.addMenuItem("This&nbsp;Week's&nbsp;Specials","location='specials.php'");
	mm_menu_0727170019_1.addMenuItem("Current&nbsp;Flyer","location='current_flyer.php'");
	mm_menu_0727170019_1.fontWeight="bold";
	mm_menu_0727170019_1.hideOnMouseOut=true;
	mm_menu_0727170019_1.menuBorder=0;
	mm_menu_0727170019_1.menuLiteBgColor='#ffffff';
	mm_menu_0727170019_1.menuBorderBgColor='#4484bc';
	mm_menu_0727170019_1.bgColor='#ffffff';
		
	// Testimonials
	if (window.mm_menu_0727170019_3) return;
	window.mm_menu_0727170019_3 = new Menu("root",148,21,"Arial, Helvetica, sans-serif",15,"#ffffff","#ffffff","#165a89","#4788c0","left","middle",3,0,250,-5,7,true,true,true,0,true,true);
	mm_menu_0727170019_3.addMenuItem("Testimonials","location='testimonials.php'");
	mm_menu_0727170019_3.addMenuItem("Community","location='community.php'");
	mm_menu_0727170019_3.fontWeight="bold";
	mm_menu_0727170019_3.hideOnMouseOut=true;
	mm_menu_0727170019_3.menuBorder=0;
	mm_menu_0727170019_3.menuLiteBgColor='#ffffff';
	mm_menu_0727170019_3.menuBorderBgColor='#4484bc';
	mm_menu_0727170019_3.bgColor='#ffffff';		
	
	// Flooring Submenu
	if (window.mm_menu_0727170019_2) return;
	window.mm_menu_0727170019_2_1 = new Menu("Flooring",110,21,"Arial, Helvetica, sans-serif",15,"#ffffff","#ffffff","#165a89","#4788c0","left","middle",3,0,250,-5,7,true,true,true,0,true,true);
	mm_menu_0727170019_2_1.addMenuItem("Luxury&nbsp;Plank","location='luxury_plank.php'");
	mm_menu_0727170019_2_1.addMenuItem("Cork","location='cork.php'");
	mm_menu_0727170019_2_1.addMenuItem("Vinyl","location='misc_flooring.php'");
	mm_menu_0727170019_2_1.addMenuItem("Commercial","location='commercial.php'");
	mm_menu_0727170019_2_1.addMenuItem("Laminate","location='laminate.php'");
	mm_menu_0727170019_2_1.addMenuItem("Hardwood","location='hardwood.php'");
	mm_menu_0727170019_2_1.addMenuItem("Tile","location='tile.php'");
	mm_menu_0727170019_2_1.addMenuItem("Carpet","location='carpet.php'");
	mm_menu_0727170019_2_1.fontWeight="bold";
	mm_menu_0727170019_2_1.hideOnMouseOut=true;
	mm_menu_0727170019_2_1.menuBorder=0;
	mm_menu_0727170019_2_1.menuLiteBgColor='#ffffff';
	mm_menu_0727170019_2_1.menuBorderBgColor='#4484bc';
	mm_menu_0727170019_2_1.bgColor='#ffffff';
	
	//Products
	window.mm_menu_0727170019_2 = new Menu("root",143,21,"Arial, Helvetica, sans-serif",15,"#ffffff","#ffffff","#165a89","#4788c0","left","middle",3,0,250,-5,0,true,true,true,0,true,true);
	mm_menu_0727170019_2.addMenuItem("Kitchen&nbsp;Cabinets","location='kitchen_cabinets.php'");
	mm_menu_0727170019_2.addMenuItem("Bath&nbsp;&&nbsp;Plumbing","location='plumbing.php'");
	//mm_menu_0727170019_2.addMenuItem("Cabinetry","location='cabinetry.php'");
	mm_menu_0727170019_2.addMenuItem("Window&nbsp;Coverings","location='window_coverings.php'");
	mm_menu_0727170019_2.addMenuItem("Stair&nbsp;Systems","location='stair_systems.php'");
	mm_menu_0727170019_2.addMenuItem("Baseboards","location='baseboards.php'");
	mm_menu_0727170019_2.addMenuItem("Paint","location='paint.php'");
	mm_menu_0727170019_2.addMenuItem(mm_menu_0727170019_2_1,"location='flooring.php'");
	mm_menu_0727170019_2.addMenuItem("Product&nbsp;Care","location='product_care.php'");
	mm_menu_0727170019_2.fontWeight="bold";
	mm_menu_0727170019_2.hideOnMouseOut=true;
	mm_menu_0727170019_2.childMenuIcon="images/arrows.gif";
	mm_menu_0727170019_2.menuBorder=0;
	mm_menu_0727170019_2.menuLiteBgColor='#ffffff';
	mm_menu_0727170019_2.menuBorderBgColor='#4484bc';
	mm_menu_0727170019_2.bgColor='#ffffff';
 
	mm_menu_0727170019_2.writeMenus();
} // mmLoadMenus()
