// JavaScript Document

var shortForm ;

shortForm = "<form name=\"form1\" method=\"post\" action=../thanks_free_estimate.php><table width=\"190\" border=\"0\" align=\"center\" cellpadding=\"1\" cellspacing=\"0\"><tr><td class=\"TextColor4\"><strong>Please Make a Selection:</strong></td></tr><tr><td><select name=\"requiredSelection\" style=\"width:98%\" id=\"requiredSelection\" title=\"PLEASE MAKE A SELECTION\"><option selected>---- Select ---- </option><option value=\"Decks & Porches \">Decks & Porches </option><option value=\"Siding & Trim\">Siding & Trim</option><option value=\"Entranceways\">Entranceways</option><option value=\"Windows & Doors\">Windows & Doors</option><option value=\"Additions\">Additions</option><option value=\"Basements\">Basements</option><option value=\"Roofing\">Roofing</option></select></td></tr><tr><td class=\"TextColor4\"><strong>Name:</strong></td></tr><tr><td><input name=\"requiredName\" type=\"text\" style=\"width:98%\" id=\"requiredName\" title=\"NAME\"></td></tr><tr><td class=\"TextColor4\"><strong>Address:</strong></td></tr><tr><td><input name=\"requiredAddress\" type=\"text\" style=\"width:98%\" id=\"requiredAddress\" title=\"ADDRESS\"></td></tr><tr><td class=\"TextColor4\"><strong>City:</strong></td></tr><tr><td><input name=\"requiredCity\" type=\"text\" style=\"width:98%\" id=\"requiredCity\" title=\"CITY\"></td></tr><tr><td class=\"TextColor4\"><strong>Phone:</strong></td></tr><tr><td><input name=\"requiredPhone\" type=\"text\" style=\"width:98%\" id=\"requiredPhone\" title=\"PHONE\" onBlur=\"javascript: return PhoneFormat(this);\"></td></tr><tr><td class=\"TextColor4\"><strong>Email Address:</strong></td></tr><tr><td><input name=\"requiredEmail\" type=\"text\" style=\"width:98%\" id=\"requiredEmail\" title=\"EMAIL\"></td></tr><tr><td align=\"center\"><input type=\"text\" name=\"_Email\" style=\"visibility:hidden\"><input type=\"image\" src=\"images/submit_btn.gif\" alt=\"Submit\" title=\"Submit\" width=\"78\" height=\"23\" vspace=\"5\" onClick=\"javascript: return checkFreeEstimate(this.form);\"><img src=\"images/trans.gif\" alt=\"\" width=\"10\" height=\"23\" vspace=\"5\"><input type=\"image\" src=\"images/clear_form_btn.gif\" alt=\"\" width=\"95\" height=\"23\" vspace=\"5\"></td></tr></table></form>" ;

function verifyMail(obj)
	{
		if(obj.value.length != 0)
	    {
		 var str = obj.value;
		 var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
		 var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
		  if (!reg1.test(str) && reg2.test(str)&& str.indexOf(" ")<0)
		 {
			 // return true;
		 }else
		  {
			 alert("\"" + str + "\" is an invalid e-mail!");
			 obj.focus();
		    return false;
		   }
		}
	}	// function verifyMail(obj)
	//-----------------------------------------------------------------
//---------------------------------------------
function checkrequired(which) 
{ 
	var pass=true; 
	if (document.images) 
	{ 
		for (i=0;i<which.length;i++) 
		{ 
			
			var tempobj=which.elements[i]; 
			if (tempobj.name.substring(0,8)=="required") 
			{ 
				if ((tempobj.type=="file" || tempobj.type=="text"||tempobj.type=="textarea"||tempobj.type=="password" ||tempobj.type.toString().charAt(0)=="s" ) && tempobj.value=='')
				{ 
					if(tempobj.disabled==false)
					{
						pass=false; 
						break;
					}
				}
			} 
		} 
	} 

	if (!pass) 
	{
		if(tempobj.alt)
		{
			shortFieldName=tempobj.alt ; 
		}
		else if(tempobj.title)
		{
			shortFieldName=tempobj.title ; 
		}
		else
		{
			shortFieldName=tempobj.name.substring(8,30).toUpperCase(); 
		}
		alert("Please make sure the "+shortFieldName+" field was properly completed.") ;
		tempobj.focus() ;
	//	tempobj.style.backgroundColor='#F8E1F8' ;
		return false ;
	} 
	else 
		return true; 
} 
//---------------------------------------------
function PhoneFormat(obj)
{
	var re= /\D/;
	// test for this format: (xxx)xxx-xxxx
	var re2 = /^\({1}\d{3}\)\d{3}-\d{4}/; 
	// test for this format: xxx-xxx-xxxx
	//var re2 = /^\d{3}-\d{3}-\d{4}/;
	
	for (i=0; i<obj.value.length;i++){
	var num=obj.value;
	
	var newNum;
	 if (num != "" && re2.test(num)!=true){
	   if (num != ""){
		 while (re.test(num)){
		 num = num.replace(re,"");
		 }
	   }
	
	  if (num.length != 10){
		alert('Please enter a 10 digit phone number');
		obj.select();
		break;
		}
	   else {
		 // for format (xxx)xxx-xxxx
		// newNum = '(' + num.substring(0,3) + ')' + num.substring(3,6) + '-' + num.substring(6,10);
		 // for format xxx-xxx-xxxx
		  newNum = num.substring(0,3) + '-' + num.substring(3,6) + '-' + num.substring(6,10);
		 obj.value=newNum;
		 }
	   }
	  }
}
//---------------------------------------------
	function checkFreeEstimate(frm)
	{
		if (verifyMail(frm.requiredEmail) == false) return false;
		if (checkrequired(frm) == false) return false;	
		return true;
	}	// function checkForm(frm)
	
	function checkFreeEstimateReset(frm)
	{
		frm.reset();
		return false;
	}	// function checkForm(frm)
	
	var arrTestimonial = Array() ;
	
	arrTestimonial[0] = '<div align="left" class="Padding10" ><strong>&quot;Colonial Remodeling has provided very good quality, reliable service at a   fair price. We will continue to use their services for the foreseeable   future.&quot;</strong></div><div class="PaddingLR" align="center">- Mark Frey, Arlington,   VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="../testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;

	arrTestimonial[1] = '<div align="left" class="Padding10" ><strong>&quot;Colonial Remodeling built me a <A href="../decks-porches.html" class="LinksUL TextColor3">Trex deck, a shadow box fence, and a patio</a>.   The quality was outstanding, it was finished ahead of time and was on budget --   what else can you ask for?&quot;</strong></div><div class="PaddingLR" align="center">- Ryan O\'Connor, Alexandria,   VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="../testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;
	
	arrTestimonial[2] = '<div align="left" class="Padding10" ><strong>"Colonial Remodeling <A href="../siding-trim.html" class="LinksUL TextColor3">replaced our   siding</a> and <A href="../windows-doors.html" class="LinksUL TextColor3">windows</a> as well   as built a new <A href="../decks-porches.html" class="LinksUL TextColor3">screened-in   porch and deck</a>. We are very pleased with the process as well as the   finished product."</strong></div><div class="PaddingLR" align="center">- Mike & Ginger Duke,   Arlington, VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="../testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;

	arrTestimonial[3] = '<div align="left" class="Padding10" ><strong>"Working with Colonial Remodeling was a dream come true. Everyone did what   was promised with the highest quality for the best price."</strong></div><div class="PaddingLR" align="center">- Charles & Lisa Koch,   Arlington, VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="../testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;

	arrTestimonial[4] = '<div align="left" class="Padding10" ><strong>"I was extremely pleased with the effort that the team at Colonial did on the house. From the estimate to the final installation ~ the whole process went smoothly and was handled professionally."</strong></div><div class="PaddingLR" align="center">- Sean Pender, Sliver Spring, MD</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="../testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;

	arrTestimonial[5] = '<div align="left" class="Padding10" ><strong>"Just a fast note to say that the job they did was simply incredible...were incredibly professional, and gave me a result I am truly impressed with.  They were very considerate and detailed.  One of the best experiences with the house I have ever had with a vendor.  We hope to have you back for more work. And if your company ever needs a reference, put me on your list of customers willing to stand up for and behind your company and crew.<br>Stephen will be in contact with you in regards to the basement.<br>Thank you so much for everything,"</strong></div><div class="PaddingLR" align="center">- Christopher DeSimone, Alexandria, VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="../testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;

	arrTestimonial[6] = '<div align="left" class="Padding10" ><strong>"If  we keep getting people knocking on our door and walking up to our fence asking  to see our porch, you are going to owe us. Ha! Ha! I guess when you do good  work it shows."</strong></div><div class="PaddingLR" align="center">- Rosemary  Prillaman, Burke, VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="../testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;

	arrTestimonial[7] = '<div align="left" class="Padding10" ><strong>"We  are loving the new porch! Thanks again for all of the assistance and for being  so responsible. You Da Man."</strong></div><div class="PaddingLR" align="center">- Patrick  & Katie Wyman, South Riding, VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="../testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;

	arrTestimonial[8] = '<div align="left" class="Padding10" ><strong>"We  appreciate the hard work that went into making our deck and gazebo. We will  enjoy it for years to come."</strong></div><div class="PaddingLR" align="center">- Dennis  & Linda Duffle Springfield, VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="../testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;

	arrTestimonial[9] = '<div align="left" class="Padding10" ><strong>"Jon  was wonderful to work with and we are extremely happy to have chosen Colonial  Remodeling."</strong></div><div class="PaddingLR" align="center">- Mr.  & Mrs. McMahon, Reston, VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="../testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;

// -------------------------------------------------------------------------
// Array declare for the pages in ROOT.
// -------------------------------------------------------------------------
	var arrTestimonialRoot = Array() ;
	
	arrTestimonialRoot[0] = '<div align="left" class="Padding10" ><strong>"Colonial Remodeling has provided very good quality, reliable service at a   fair price. We will continue to use their services for the foreseeable   future."</strong></div><div class="PaddingLR" align="center">- Mark Frey, Arlington,   VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;

	arrTestimonialRoot[1] = '<div align="left" class="Padding10" ><strong>"Colonial Remodeling built me a <A href="../decks-porches.html" class="LinksUL TextColor3">Trex deck, a shadow box fence, and a patio</a>.   The quality was outstanding, it was finished ahead of time and was on budget --   what else can you ask for?"</strong></div><div class="PaddingLR" align="center">- Ryan O\'Connor, Alexandria,   VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;
	
	arrTestimonialRoot[2] = '<div align="left" class="Padding10" ><strong>"Colonial Remodeling <A href="siding-trim.html" class="LinksUL TextColor3">replaced our   siding</a> and <A href="windows-doors.html" class="LinksUL TextColor3">windows</a> as well   as built a new <A href="../decks-porches.html" class="LinksUL TextColor3">screened-in   porch and deck</a>. We are very pleased with the process as well as the   finished product."</strong></div><div class="PaddingLR" align="center">- Mike & Ginger Duke,   Arlington, VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;

	arrTestimonialRoot[3] = '<div align="left" class="Padding10" ><strong>"Working with Colonial Remodeling was a dream come true. Everyone did what   was promised with the highest quality for the best price."</strong></div><div class="PaddingLR" align="center">- Charles & Lisa Koch,   Arlington, VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;

	arrTestimonialRoot[4] = '<div align="left" class="Padding10" ><strong>"I was extremely pleased with the effort that the team at Colonial did on the house. From the estimate to the final installation ~ the whole process went smoothly and was handled professionally."</strong></div><div class="PaddingLR" align="center">- Sean Pender, Sliver Spring, MD</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;

	arrTestimonialRoot[5] = '<div align="left" class="Padding10" ><strong>"Just a fast note to say that the job they did was simply incredible... were incredibly professional, and gave me a result I am truely impressed with.  They were very considerate and detailed.  One of the best experiences with the house I have ever had with a vendor.  We hope to have you back for more work. And if your company ever needs a reference, put me on your list of customers willing to stand up for and behind your company and crew.<br>Stephen will be in contact with you in regards to the basement.<br>Thank you so much for everything,"</strong></div><div class="PaddingLR" align="center">- Christopher DeSimone, Alexandria, VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;

	arrTestimonialRoot[6] = '<div align="left" class="Padding10" ><strong>"If  we keep getting people knocking on our door and walking up to our fence asking  to see our porch, you are going to owe us. Ha! Ha! I guess when you do good  work it shows."</strong></div><div class="PaddingLR" align="center">- Rosemary  Prillaman, Burke, VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;

	arrTestimonialRoot[7] = '<div align="left" class="Padding10" ><strong>"We  are loving the new porch! Thanks again for all of the assistance and for being  so responsible. You Da Man."</strong></div><div class="PaddingLR" align="center">- Patrick  & Katie Wyman, South Riding, VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;

	arrTestimonialRoot[8] = '<div align="left" class="Padding10" ><strong>"We  appreciate the hard work that went into making our deck and gazebo. We will  enjoy it for years to come."</strong></div><div class="PaddingLR" align="center">- Dennis  & Linda Duffle Springfield, VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;

	arrTestimonialRoot[9] = '<div align="left" class="Padding10" ><strong>"Jon  was wonderful to work with and we are extremely happy to have chosen Colonial  Remodeling."</strong></div><div class="PaddingLR" align="center">- Mr.  & Mrs. McMahon, Reston, VA</div><div class="PaddingLR PaddingTB" align="right"><img src="images/bullet.gif" alt="" width="7" height="7" hspace="2"><strong><a href="testimonials.html" class="Links TextColor3 SmallText"> Read More</a></strong></div>' ;



//**************************************************
//Create a boolean variable to check for a valid IE instance.
var xmlhttp = false;
//Check if we are using IE.
try {
//If the javascript version is greater than 5.
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
//If not, then use the older active x object.
try {
//If we are using IE.
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
//Else we must be using a non-IE browser.
xmlhttp = false;
}
}
//If we are using a non-IE browser, create a JavaScript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
function showImage(id,page) {
var obj = document.getElementById('ajax');
serverPage = "readfromcsv.php?id=" + id + "&csv=" + page
xmlhttp.open("GET", serverPage);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
obj.innerHTML = xmlhttp.responseText;
}else
	{
		obj.innerHTML = '<table width="470" border="0" align="center" cellpadding="0" cellspacing="0" ><tr><td colspan="2" height="22"  class="BgColor3"><div class="PaddingLR"><h6 class="TextColor1" id="TitleStrong"</h6></div></td></tr><tr><td colspan="2" class="HorDotted">&nbsp;</td></tr><tr><td colspan="2"  height="300"><center><img src=\"images/loading-indicator.gif\" ><BR><BR>Downloading...</center></td></tr><tr><td colspan="2" class="PaddingTB5" id="ImgText"></td></tr></table>'
	}
}
xmlhttp.send(null);
}

//--------------------------------------------------