window.onload=load;

function load(){
testimonials();
leftNav()
document.getElementById("vertnavlogos").style.display="block";
sethnav();
}

var path=location.pathname.toLowerCase();
var aArray = document.getElementsByTagName("a");
var liArray = document.getElementsByTagName("li");

function leftNav(){
var i;

if(path=="/" || path=="/default.aspx" || path=="/categories/75/default.aspx" || path=="/categories/76/default.aspx" || path=="/categories/77/default.aspx" ||
path=="/categories/78/default.aspx" ||  path=="/categories/101/default.aspx"){
for(i=6;i<11;++i){
liArray[i].style.display="block";
}
aArray[0].style.background="url(/data/styleimages/rtBtnSd.png) no-repeat right -150px";
aArray[0].style.color="#F7BD30";
liArray[0].style.background="url(/data/styleimages/lftbtnsd.gif) no-repeat left -150px";
}
else if(path=="/categories/79/default.aspx" || path=="/categories/82/default.aspx" || path=="/categories/81/default.aspx" || path=="/categories/84/default.aspx" || path=="/categories/100/default.aspx" || path=="/categories/85/default.aspx" || path=="/categories/86/default.aspx" || path=="/categories/83/default.aspx" || path=="/categories/80/default.aspx"){
for(i=11;i<19;++i){
liArray[i].style.display="block";
}
aArray[1].style.background="url(/data/styleimages/rtBtnSd.png) no-repeat right -150px";
aArray[1].style.color="#F7BD30";
liArray[1].style.background="url(/data/styleimages/lftbtnsd.gif) no-repeat left -150px";
}
else if(path=="/categories/74/default.aspx" || path=="/categories/74/default.aspx" || path=="/categories/98/default.aspx" || path=="/categories/97/default.aspx"){
for(i=19;i<21;++i){
liArray[i].style.display="block";
}
aArray[3].style.background="url(/data/styleimages/rtBtnSd.png) no-repeat right -150px";
aArray[3].style.color="#F7BD30";
liArray[3].style.background="url(/data/styleimages/lftbtnsd.gif) no-repeat left -150px";
}
else if(path=="/categories/69/default.aspx" || path=="/categories/99/default.aspx" || path=="/categories/91/default.aspx" || path=="/categories/92/default.aspx" || path=="/categories/93/default.aspx"){
for(i=21;i<24;++i){
liArray[i].style.display="block";
}
aArray[4].style.background="url(/data/styleimages/rtBtnSd.png) no-repeat right -150px";
aArray[4].style.color="#F7BD30";
liArray[4].style.background="url(/data/styleimages/lftbtnsd.gif) no-repeat left -150px";
}
else if(path=="/categories/72/default.aspx" || path=="/categories/87/default.aspx" || path=="/categories/88/default.aspx" || path=="/categories/89/default.aspx" || path=="/categories/90/default.aspx" || path=="/categories/96/default.aspx"){
for(i=24;i<29;++i){
liArray[i].style.display="block";
}
aArray[5].style.background="url(/data/styleimages/rtBtnSd.png) no-repeat right -150px";
aArray[5].style.color="#F7BD30";
liArray[5].style.background="url(/data/styleimages/lftbtnsd.gif) no-repeat left -150px";
}
else if(path=="/pages/295/default.aspx")
{
for(i=11;i<19;++i){
liArray[i].style.display="block";
}
aArray[1].style.background="url(/data/styleimages/rtBtnSd.png) no-repeat right -150px";
aArray[1].style.color="#F7BD30";
liArray[1].style.background="url(/data/styleimages/lftbtnsd.gif) no-repeat left -150px";
aArray[16].style.background="url(/data/styleimages/localNavImg.gif) no-repeat right -150px";
aArray[16].style.color="#CD0921";

}
}

function testimonials(){

var textArray = new Array("<p>\"Custom Brush Co. does an excellent job in a timely fashion, and follows up on problems, if any. Our siding has an excellent seal from the weather. The value of our home has increased. The color was matched perfectly. Love it.\" <span class='author'>- Paul &amp; Norma H.</span> </p>", "<p>\"Custom Brush Co. is very thorough about everything and very proud of their work. They see things that need to be done, like repairs, and make sure it happens. I look at my new paint job every day and see how lovely it is! I've received lots of compliments on it. Custom Brush Co. does beautiful work. They are reliable and very neat - no drips!\" <span class='author'>- Nancy L.</span></p>", "<p>\"Excellent quality. Very professional. We observed other homes Custom Brush Co. had painted and owners recommended them. They were very meticulous while applying paint and lived up to the contract. We would highly recommend Custom Brush Co. for any interior or exterior painting.\" <span class='author'>- Ray & Elsie P.</span></p>", "<p>\"First class! Carefully done! Couldn\'t be happier! Even though openings such as doors are rounded, the lines are just perfect. I chose Custom Brush Co. to paint my home because of recommendations from my neighbors.\" <span class='author'>- Dorthy S.</span></p>", "<p>\"We were very satisfied with your high quality of work. The house looks so much better. We got many compliments on how nice it looks.\"<span class='author'>- Anonymous</span></p>", "<p>\"The attention to detail that you did while painting my house and your help in the decision making of what colors to paint were immense. I appreciated your cleanliness while painting. No paint drips, no ruined carpet. Very thoughtful. You really do know what you are doing. You are a step above your competition.\" <span class='author'>- Kathy S.</span></p>", "<p>\"Quality work. You were very careful with our shrubs and flowers. Our house is a testament to your skills. Our house continues to look like new. We chose you to paint our home because of recommendations from our neighbors, your use of quality products, and you quoted a reasonable price.\"<span class='author'>- Bob & Meredith L.</span></p>", "<p>\"Your work is meticulous. You take great pride in doing the very best job! People compliment the job you did and ask me about you. I have recommended you to several of my neighbors and they are pleased with your work too.\" <span class='author'>- Kate W.</span></p>");

var d = document.getElementById("testimonials");
var randNum=Math.floor(Math.random()*8);
d.innerHTML=textArray[randNum] + "<hr style=\"margin:10px 0px 0px 7px;\" />";
}

function sethnav()
{
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf('msie') != -1 || ua.indexOf('firefox') != -1){
document.getElementById("hnav").style.marginTop="228px";
}
if (ua.indexOf('msie 6') != -1){
document.getElementById("wrap").style.marginTop="-3px";
}
}requiredfields = new Array('first_name','First Name','last_name','Last Name','email','Email Address','phone','Phone','country','Country','00N30000000wQso','Fleet Size','company','Company Name');
var country;
var state;
var first_name;
var last_name;
var phone_number;
function formrules(frm)
{


    var thisform = frm;
    var elements = document.forms['aspnetForm'].elements;
    var ret = listAllRequiredFields(elements);
    if (ret == false) {return false;}
    
        for (var x = 0;x<elements.length;x++)
        {
            if (elements[x].FieldName != undefined)
            {
                
                if (elements[x].FieldName == 'country')
                {
                    country = elements[x].value;
                }
                else if (elements[x].FieldName == 'state')
                {
                    state = elements[x].value;
                }
                else if (elements[x].FieldName == 'first_name')
                {
                    ret = badFormValue(elements[x].value);
                    if (ret == true) {alert('Invalid first name');return false;}
			first_name = elements[x].value;
                }
		else if (elements[x].FieldName == 'last_name')
		{
			last_name = elements[x].value;
		}
		else if (elements[x].FieldName == 'phone')
		{
			if (phonenumber(elements[x].value).length <= 7)
			{alert('Invalid Phone Number');return false;}

		}
		else if (elements[x].FieldName == '00N30000001DYuT')
		{
			ret = badFormValue(elements[x].value);
                    if (ret == true) {alert('Invalid content in comments box');return false;}
		}

            }
        }
        if (country == 'US' && state == '')
        {
            alert('You must select a state.')
            return false;
        }
        else if (country != 'US' && state != '')
        {
            alert('Please delete your state selection.')
            return false;
        }
if (first_name == last_name)
{
alert('invalid name');
return false;
}

if (CheckBoxSelection() == false)
{
alert('Please select an interest');
return false;
}
            
    return true;
}

function badFormValue(frmvalue)
{
    var badwords = new Array('http://*');
    for (var b = 0;b<badwords.length;b++)
    {
    var re = new RegExp(badwords[b]);
          if (frmvalue.match(re)) 
          {
            return true;
          } 
    }
return false;
}

function phonenumber(phonevalue)
{
	var p = new RegExp(/\d/g);
    var s = '';
    var match = phonevalue.match(p);
    //alert(match.length);
    for (var m=0;m<match.length;m++)
    {
    s += match[m];
    }
    //alert(s);
	return s;
}

function listAllRequiredFields(elements)
{
                for (var x = 0;x<elements.length;x++)
                {
                    for (r=0;r<requiredfields.length;r++)
                    {
                        if (requiredfields[r] == elements[x].FieldName && elements[x].value == '')
                        {
                            alert(requiredfields[r+1] + ' is required');
                            r++
                            elements[x].focus()
                            return false;
                        }
                    }
                }
return true;
}

function validateEmail(elementValue)
{ 
var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
return emailPattern.test(elementValue);
 }

function CheckBoxSelection()
{
	var c = document.getElementById('00N60000001YFpD');
	if (c == null) {return true;}
	if (document.getElementById('00N60000001YFpD').checked == true) {return true;}
	else if (document.getElementById('00N60000001YFpI').checked == true) {return true;}
	else if (document.getElementById('00N60000001YFpN').checked == true) {return true;}
	else if (document.getElementById('00N60000001YFpS').checked == true) {return true;}
	else if (document.getElementById('00N60000001YFpX').checked == true) {return true;}
	else if (document.getElementById('00N60000001YFpc').checked == true) {return true;}
	else if (document.getElementById('00N60000001YFph').checked == true) {return true;}
	else if (document.getElementById('00N60000001YFpr').checked == true) {return true;}
	else if (document.getElementById('00N60000001YFqE').checked == true) {return true;}
	return false;
}
