// JavaScript Document



function rollpic(img_name,img_src) {
document[img_name].src=img_src;
}




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 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 openWindow(url, winWidth, winHeight) {
	top.NavWin = window.open(url, 'popup','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' + winWidth + ', height=' + winHeight ); 
	top.NavWin.focus();
}

var quote1 = "\"The security of my family and my business is a #1 priority. That’s why when choosing a security company I picked All-American Alarm. Their professionalism, focus on customer service, and second-to-none expertise made them an easy choice for all my security needs.\"";

var name1 = "Joe Shurtz-IT2 Inc";

var quote2 = "\"I trust Bob Branstetter of All-American Alarm. He is very professional, experienced, and knowledgeable about security systems. He was very helpful in getting my business set up with just what we needed, including a temperature monitor for the freezer and cool-room.\"";

var name2 = "Marilyn Keener-Alaska Family Salmon";


function changeQuote(qVal) {
   var quote = eval("quote" + qVal);
   var name = eval("name" + qVal);
   
   var qBox = document.getElementById("quoteBox");
   var qName = document.getElementById("quoteName");
   
   qBox.firstChild.nodeValue = quote;
   qName.firstChild.nodeValue = name;
   
}

<!-- Disable right click -->

 function noRightClick() {
if (event.button==2) {
alert('The "Right Click" function has been disabled')
}
}
document.onmousedown=noRightClick
// end no right click -->

<!-- Script for Date -->

    month = new Array(12);
      month[0]="January"
      month[1]="February"
      month[2]="March"
      month[3]="April"
      month[4]="May"
      month[5]="June"
      month[6]="July"
      month[7]="August"
      month[8]="September"
      month[9]="October"
      month[10]="November"
      month[11]="December"

    day = new Array(7);
      day[0]="Sunday"
      day[1]="Monday"
      day[2]="Tuesday"
      day[3]="Wednesday"
      day[4]="Thursday"
      day[5]="Friday"
      day[6]="Saturday"

today=new Date();
dy=today.getDay();
date=today.getDate();
mo=today.getMonth();
yr=today.getFullYear();

  // end date --->
  

function checkcontact ( contact )
{
    // ** START **
	
//Validates fname Textbox for an entry
if (contact.fname.value == "") {
        alert( "Please enter your First Name" );
        contact.fname.focus();
        return false ;
    }
if (contact.fname.value == "") {
        alert( "Please enter your First Name" );
        contact.fname.focus();
        return false ;
    }


//Validates lname Textbox for an entry
if (contact.lname.value == "") {
        alert( "Please enter your Last Name" );
        contact.lname.focus();
        return false ;
    }

//Validates address Textbox for an entry
if (contact.address.value == "") {
        alert( "Please enter your Mailing Address" );
        contact.address.focus();
        return false ;
    }

//Validates city Textbox for an entry
if (contact.city.value == "") {
        alert( "Please enter your City" );
        contact.city.focus();
        return false ;
    }

//Validates state Textbox for an entry
if (contact.state.value == "--") {
        alert( "Please enter your State" );
        contact.state.focus();
        return false ;
    }

//Validates zip Textbox for an entry
if (contact.zip.value == "") {
        alert( "Please enter your State and Zip Code\nDon\'t forget Your State!" );
        contact.zip.focus();
        return false ;
    }

//Validates an Email Address Textbox
	if (contact.email.value == "")
	{
	    alert("Please enter your email address.");
		contact.email.focus();
		return (false);
	}			
 			
	var teststr = (contact.email.value);
  	var iserr=false;
	if (!teststr=='')
	{ 
	  // there must be >= 1 character before @, so we
	  // start looking at character position 1 
	  // (i.e. second character)
	var i = 1;
	var sLength = teststr.length;
	  // look for @
	while ((i < sLength) && (teststr.charAt(i) != "@"))
	{ 
	i++;
	}
	if ((i >= sLength) || (teststr.charAt(i) != "@")) 
	{
	iserr=true;
	}
		else 
		{
		 i += 2;
		 // look for "."
		 while ((i < sLength) && (teststr.charAt(i) != "."))
			 { 
				i++;
			 }
		 // there must be at least one character after the "."
		 if ((i >= sLength - 1) || (teststr.charAt(i) != ".")) 
		 	{
			iserr = true;
			}
		}
   }
	   if (iserr)
		 {
		  alert('Please enter a Valid Email Address.');
		  contact.email.focus();
   	      return (false);				  
	     }
	

//Validates phone Textbox for an entry
if (contact.phone.value == "(area code first)") {
        alert( "Please enter your Phone Number" );
        contact.phone.focus();
        return false ;
    }
//Validates phone Textbox for an blank
if (contact.phone.value == "") {
        alert( "Please enter your Phone Number" );
        contact.phone.focus();
        return false ;
    }

//Validates interested Textbox for an entry
if (contact.interested.value == "select one") {
        alert( "Please Make Your Selection" );
        contact.interested.focus();
        return false ;
    }
//Validates phone Textbox for an blank
//if (contact.phone.value == "") {
//        alert( "Please enter your Phone Number" );
//        contact.phone.focus();
//        return false ;
//    }


//Validates comment Textbox for an entry
    if (contact.comment.value == "") {
        alert( "Please enter your Comments" );
        contact.comment.focus();
        return false ;
    }

    // ** END **
	return true ;
}

function checklogin ( login )
{
    // ** START **
	
//Validates username Textbox for an entry
if (login.username.value == "") {
        alert( "Please enter your UserName" );
        login.username.focus();
        return false ;
    }
	
//Validates username Textbox for valid entry
if (login.username.value != "LetMeIn") {
        alert( "Please enter Valid UserName" );
        login.username.focus();
        return false ;
    }

//Validates password Textbox for an entry
if (login.password.value == "") {
        alert( "Please enter your Password" );
        login.password.focus();
        return false ;
    }
//Validates password Textbox for valid entry
if (login.password.value != "deiied") {
        alert( "Please enter Valid Password" );
        login.password.focus();
        return false ;
    }


    // ** END **
	return true ;
}



// takes (area code first) out of the phone field on-Focus
function MM_setTextOfTextfield(objName,x,newText) { //v3.0
  var obj = MM_findObj(objName); if (obj) obj.value = newText;
}


function rollpic(img_name,img_src) {
document[img_name].src=img_src;
}


function switchpic(imagename,objectsrc){
if (document.images)
document.images[imagename].src=eval(objectsrc+".src")
}

<!-- Preload Images -->


homeoff=new Image(15,16)
homeoff.src="images/home.gif"
homeon=new Image(15,16)
homeon.src="images/homeon.gif"

favoriteoff=new Image(20,17)
favoriteoff.src="images/favoriteoff.gif"
favoriteon=new Image(20,17)
favoriteon.src="images/favoriteon.gif"


function checkform ( tell )
{
    // ** START **
    if (tell.fname.value == "") {
        alert( "Please enter your Name" );
        tell.fname.focus();
        return false ;
    }
    if (tell.email.value == "") {
        alert( "Please enter your Email Address" );
        tell.email.focus();
        return false ;
    }
    if (tell.ffname.value == "") {
        alert( "Please enter your Friend\'s Name" );
        tell.ffname.focus();
        return false ;
    }
    if (tell.femail.value == "") {
        alert( "Please enter your Friend\'s Email" );
        tell.femail.focus();
        return false ;
    }

    if (tell.comments.value == "") {
        alert( "Please enter your Comments" );
        tell.comments.focus();
        return false ;
    }

    // ** END **
	return true ;
}




function checkapply ( apply )
{
    // ** START **
	
//Validates fname Textbox for an entry
if (apply.fname.value == "") {
        alert( "Please enter your First Name" );
        apply.fname.focus();
        return false ;
    }

//Validates lname Textbox for an entry
if (apply.lname.value == "") {
        alert( "Please enter your Last Name" );
        apply.lname.focus();
        return false ;
    }

//Validates address Textbox for an entry
if (apply.address.value == "") {
        alert( "Please enter your Mailing Address" );
        apply.address.focus();
        return false ;
    }

//Validates city Textbox for an entry
if (apply.city.value == "") {
        alert( "Please enter your City" );
        apply.city.focus();
        return false ;
    }

//Validates state Textbox for an entry
if (apply.state.value == "--") {
        alert( "Please enter your State" );
        apply.state.focus();
        return false ;
    }

//Validates zip Textbox for an entry
if (apply.zip.value == "") {
        alert( "Please enter your State and Zip Code\nDon\'t forget Your State!" );
        apply.zip.focus();
        return false ;
    }

//Validates an Email Address Textbox
	if (apply.email.value == "")
	{
	    alert("Please enter your email address.");
		apply.email.focus();
		return (false);
	}			
 			
	var teststr = (apply.email.value);
  	var iserr=false;
	if (!teststr=='')
	{ 
	  // there must be >= 1 character before @, so we
	  // start looking at character position 1 
	  // (i.e. second character)
	var i = 1;
	var sLength = teststr.length;
	  // look for @
	while ((i < sLength) && (teststr.charAt(i) != "@"))
	{ 
	i++;
	}
	if ((i >= sLength) || (teststr.charAt(i) != "@")) 
	{
	iserr=true;
	}
		else 
		{
		 i += 2;
		 // look for "."
		 while ((i < sLength) && (teststr.charAt(i) != "."))
			 { 
				i++;
			 }
		 // there must be at least one character after the "."
		 if ((i >= sLength - 1) || (teststr.charAt(i) != ".")) 
		 	{
			iserr = true;
			}
		}
   }
	   if (iserr)
		 {
		  alert('Please enter a Valid Email Address.');
		  apply.email.focus();
   	      return (false);				  
	     }
	

//Validates phone Textbox for an entry
if (apply.phone.value == "(area code first)") {
        alert( "Please enter your Phone Number" );
        apply.phone.focus();
        return false ;
    }
//Validates phone Textbox for an blank
if (apply.phone.value == "") {
        alert( "Please enter your Phone Number" );
        apply.phone.focus();
        return false ;
    }

//Validates comment Textbox for an entry
    if (apply.comment.value == "") {
        alert( "Please enter your Comments" );
        apply.comment.focus();
        return false ;
    }

    // ** END **
	return true ;
}





