var win=null;function NewWindow(mypage,myname,w,h,pos,infocus){	if(pos=="random")	{		myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;	}	if(pos=="center")	{		myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;	}	else if((pos!='center' && pos!="random") || pos==null)	{		myleft=0;		mytop=20;	}	mypage2=mypage + "?lngth=" + document.calcForm.lngth.value + "&width=" + document.calcForm.width.value + "&ydtotal=" + document.calcForm.ydtotal.value + "&fttotal=" + document.calcForm.fttotal.value;	settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";	win=window.open(mypage2,myname,settings);	win.focus();}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_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_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 Nothing(){	//for links that are not ready yet.}function ReadCookie(cookieName) {	var theCookie=""+document.cookie;	var ind=theCookie.indexOf(cookieName);	if (ind==-1 || cookieName=="") 		return ""; 	var ind1=theCookie.indexOf(';',ind);	if (ind1==-1) 		ind1=theCookie.length; 	return unescape(theCookie.substring(ind+cookieName.length+1,ind1));}function WriteCooke(cookieName,cookieValue) {	 var today = new Date();	 var expire = new Date();	 nDays=1;	 expire.setTime(today.getTime() + 3600000*24*nDays);	 document.cookie = cookieName+"="+escape(cookieValue) + ";expires=";}function trim(inputString) {	// Removes leading and trailing spaces from the passed string. Also removes	// consecutive spaces and replaces it with one space. If something besides	// a string is passed in (null, custom object, etc.) then return the input.	if (typeof inputString != "string") 		return inputString;	var retValue = inputString;	var ch = retValue.substring(0, 1);	while (ch == " ") 	{ // Check for spaces at the beginning of the string	  	retValue = retValue.substring(1, retValue.length);	  	ch = retValue.substring(0, 1);	}	ch = retValue.substring(retValue.length-1, retValue.length);	while (ch == " ") 	{ // Check for spaces at the end of the string	  	retValue = retValue.substring(0, retValue.length-1);	  	ch = retValue.substring(retValue.length-1, retValue.length);	}	while (retValue.indexOf("  ") != -1) 	{ // Note that there are two spaces in the string - look for multiple spaces within the string	  	retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings	}	return retValue; // Return the trimmed string back to the user}function HydeImage(img_id){	document.getElementById(img_id).style.visibility = "hidden";}function ShowImage(img_id){	document.getElementById(img_id).style.visibility = "visible";}function myMailto(subject, MailID, server){	document.getElementById(MailID).innerHTML = " <a  class=\"myMailto\" href=\"mailto:" + MailID + "@" + server + "?subject=" + subject + "\">" + MailID + "@" + server + "</a>";}function Submit_Email_Form(form) {				if (trim(form.Name.value) == '') 	{		alert('Please include your name.');		form.Name.value = "";		form.Name.focus();		return false;	}				checkEmail = form.Email.value	if ((checkEmail.indexOf('@') < 0) || ((checkEmail.charAt(checkEmail.length-4) != '.') && (checkEmail.charAt(checkEmail.length-3) != '.'))) 	{		alert("Please include a Valid e-mail address.");		if(trim(form.Email.value) == '')			form.Email.value = "";		else			form.Email.select();		form.Email.focus();		return false;	} 		if (trim(form.Body.value) == '') 	{		alert('Please include a message.');		form.Body.value = "";		form.Body.focus();		return false;	}			else 	{		ShowImage('loader');		return true;	}}function Email_Form_Results(){	var success = ReadCookie("morris_form_results");	if(success == "true")	{		HydeImage('loader');		document.getElementById('message').innerHTML = "<span class=\"results\">Your e-mail has been sent!</span>";	}	else if(success == "false")	{		HydeImage('loader');		document.getElementById('message').innerHTML = "<span class=\"results\">There was an error sending your e-mail! Please try again later.</span>";	}	else	{		HydeImage('loader');	}}function TestFileType( fileName, fileTypes ) {	Image_Upload_Results();	if (trim(fileName) == '') 	{		alert('Please select an image to upload.');		return false;	}		dots = fileName.split(".")	fileType = "." + dots[dots.length-1];	fileTypeExists = fileTypes.join(".").indexOf(fileType);		if (fileTypeExists > -1)	{		document.getElementById('loader').style.visibility = "visible";		return true;	}	else	{		alert("Please only upload files that end in types: \n\n" + (fileTypes.join(" .")) + "\n\nPlease select a new file and try again.");		return false;	}}function getTotal() {	if (ns==1 && ie==0)	{		alert('test');		var total = (document.cont.document.calcForm.lngth.value * document.cont.document.calcForm.width.value);		fttotal = Math.round(total + (total * .10));		document.cont.document.calcForm.fttotal.value = fttotal;		ydtotal = Math.ceil(fttotal/9);		document.cont.document.calcForm.ydtotal.value = ydtotal;		document.cont.document.calcForm.subCarpetCalc.disabled = false;	}	else 	{	 	if(ns==6 && ie==6 && document.getElementById)		{	 		var width=document.forms[0].elements[1].value			var lngth=document.forms[0].elements[0].value			var total = (lngth * width)			fttotal = Math.round(total + (total * .10));			document.forms[0].elements[3].value = fttotal;			ydtotal = Math.ceil(fttotal/9);			document.forms[0].elements[2].value = ydtotal;			document.forms[0].elements[4].disabled = false;	 	}		else		{			var total = (document.all.cont.document.calcForm.lngth.value * document.all.cont.document.calcForm.width.value);			fttotal = Math.round(total + (total * .10));			document.all.cont.document.calcForm.fttotal.value = fttotal;			ydtotal = Math.ceil(fttotal/9);			document.all.cont.document.calcForm.ydtotal.value = ydtotal;			document.all.cont.document.calcForm.subCarpetCalc.disabled = false;		}	}}		function roundMe1() {	if(ns==1 && ie==0)	{	   if(isNaN(document.cont.document.calcForm.lngth.value)) 	   {			alert("You must enter a numeric value into this field.");			document.cont.document.calcForm.lngth.value = "";			document.cont.document.calcForm.lngth.focus();	   }	   else 	   {			document.cont.document.calcForm.lngth.value = Math.ceil(document.cont.document.calcForm.lngth.value);	   }	}		else 	{		if(ns==6 && ie==6 && document.getElementById)		{			if(isNaN(document.forms[0].elements[0].value)) 			{				alert("You must enter a numeric value into this field.");				document.forms[0].elements[0].value = "";				document.forms[0].elements[0].focus();	 		}	   		else 			{		 		document.forms[0].elements[0].value = Math.ceil(document.forms[0].elements[0].value);			}		}			else		{			if(isNaN(document.all.cont.document.calcForm.lngth.value)) 			{				alert("You must enter a numeric value into this field.");				document.all.cont.document.calcForm.lngth.value = "";				document.all.cont.document.calcForm.lngth.focus();	 		}	   		else 			{				document.all.cont.document.calcForm.lngth.value = Math.ceil(document.all.cont.document.calcForm.lngth.value);			}		}	}}function roundMe2() {    if(ns==1 && ie==0)	{    	if(isNaN(document.cont.document.calcForm.width.value)) 		{			alert("You must enter a numeric value into this field.");			document.cont.document.calcForm.width.value = "";			document.cont.document.calcForm.width.focus();		}		else 		{			document.cont.document.calcForm.width.value = Math.ceil(document.cont.document.calcForm.width.value);		}    }    else 	{        if(ns==6 && ie==6 && document.getElementById)		{			if(isNaN(document.forms[0].elements[1].value)) 			{				alert("You must enter a numeric value into this field.");				document.forms[0].elements[1].value = "";				document.forms[0].elements[1].focus();			}			else 			{				document.forms[0].elements[1].value = Math.ceil(document.forms[0].elements[1].value);			}        }        else		{			if(isNaN(document.all.cont.document.calcForm.width.value))			{				alert("You must enter a numeric value into this field.");				document.all.cont.document.calcForm.width.value = "";				document.all.cont.document.calcForm.width.focus();			}			else 			{				document.all.cont.document.calcForm.width.value = Math.ceil(document.all.cont.document.calcForm.width.value);			}        }    }}     function formReset() {	if (bversion=='3') 	{		for ( i=0; i<(document.calcForm.elements.length); i++) 		{			document.calcForm.elements[i].value = "";		}	}		else 	{		if(ns==1 && ie==0)		{			for ( i=0; i<(document.calcForm.elements.length); i++) 			{				document.calcForm.elements[i].value = "";			}		}		else 		{ 						for ( i=0; i<(document.calcForm.elements.length); i++ ) 			{				document.calcForm.elements[i].value = "";			}		}	}	document.calcForm.lngth.focus();}//***************************////     detect browser        ////***************************//bversion="4";var ns=0;var ie =0;if(document.getElementById && (parseInt(navigator.appVersion) >= 5 || navigator.appVersion.indexOf["MSIE 5"] != -1)){	ns=6; ie=6;}else if (document.all) { 	ns=0; ie=1;}else if (document.layers) { 	ns=1; ie=0;}else {	document.location.href = '/get.html';}function browserDetect()  {	ns4 = (document.layers)&&(navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)==4) ? 'ns4' : false;	ie4 = (document.all)&&(navigator.appName.indexOf("Microsoft") > -1)&&(parseInt(navigator.appVersion)==4) ? 'ie4' : false;	ie5 = (document.getElementById)&&(navigator.appName.indexOf("Microsoft") > -1) ? 'ie5' : false;	ns6 = (document.getElementById)&&(navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)>4) ? 'ns6' : false;	op5 = (document.getElementById)&&(navigator.appName=="Opera")&&(parseInt(navigator.appVersion)>4) ? 'op5' : false;	return (ns4 || ie5 || ie4 || ns6 || op5);}var browser = browserDetect();