
function checkEmail(){
  var email = document.getElementById("email");
  var email2 = document.getElementById("email2");
  
  if(email.value.indexOf("@") != "-1" && email.value.indexOf(".") != "-1")
  {
	   if(email.value != email2.value)
	   {
		alert("Your email address does not match: "+ email.value);
		return false;
	   }
	   else
	   {
	   return true;
	   }
   }
   else
   {
   	alert("Please be sure to enter in a proper email address.");
	return false;
   }	 
 
}

// Used only on http://www.killersites.com/webDesigner_hire.php
function checkEmailwd(){	
	
	var Phone=document.getElementById("phone");	
	if ((Phone.value==null)||(Phone.value=="")){
		alert("Please Enter your Phone Number")
		Phone.focus()
		return false
	}
	if (checkInternationalPhone(Phone.value)==false){
		alert("Please Enter a Valid Phone Number")
		Phone.value=""
		Phone.focus()
		return false
	}
	//return true
	
  var email = document.getElementById("wdemail");
  var email2 = document.getElementById("wdemail2");
  
  if(email.value.indexOf("@") != "-1" && email.value.indexOf(".") != "-1")
  {
	   if(email.value != email2.value)
	   {
		alert("Your email address does not match: "+ email.value);
		return false;
	   }
	   else
	   {
	   return true;
	   }
   }
   else
   {
   	alert("Please be sure to enter in a proper email address.");
	return false;
   }	 
    
}

function  isSelected() {
  var buildsite = document.getElementById("buildsite");
  var makesite = document.getElementById("makesite");
  var none = document.getElementById("none");

	if(buildsite.checked == true || makesite.checked == true || none.checked == true) {
		return true
	} else {
	alert("Please make a selection.");
	return false;		
	}
} 



function doThing() {	
	waitTime = 30000;	
	setTimeout('noAd()', waitTime);
	}



function noAd() {

	var theElementStyle = document.getElementById('partners');
	
            {
            theElementStyle.style.display = "none";
            }	
	}


function showDiv(objectID) {
	var theElementStyle = document.getElementById(objectID);
	
            if(theElementStyle.style.display == "none")
            {
                theElementStyle.style.display = "block";
            }
            else
            {
                theElementStyle.style.display = "none";
            }
}

// USED IN WEB DESIGNERS HANDBOOK
function jumpToArticle()
{
	killersitesBox = document.navForm.navigation;
	destination = killersitesBox.options[killersitesBox.selectedIndex].value;
	if (destination) location.href = destination;
}


// Not used yet - is an alternative to 'matchHeight=function()'
function mozillaHeight() {
var windowHeight = window.innerHeight+window.scrollMaxY;
var navBar = document.getElementById("navigation");
navBar.style.height = windowHeight;
}



/* 
Evens out <div>'. Affected <div> tags have to be assigned the class: 'container'
ref: http://www.devarticles.com/c/a/Web-Design-Standards/Matching-div-heights-with-CSS-and-JavaScript/
*/
matchHeight=function(){ 

     var divs,contDivs,maxHeight,divHeight,d; 
	
     // get all <div> elements in the document 

     divs=document.getElementsByTagName('div'); 

     contDivs=[]; 

     // initialize maximum height value 

     maxHeight=0; 

     // iterate over all <div> elements in the document 

     for(var i=0;i<divs.length;i++){ 

          // make collection with <div> elements with class attribute 'container' 

          if(/\bcontainer\b/.test(divs[i].className)){ 

                d=divs[i]; 

                contDivs[contDivs.length]=d; 

                // determine height for <div> element 

                if(d.offsetHeight){ 

                     divHeight=d.offsetHeight; 					

                } 

                else if(d.style.pixelHeight){ 

                     divHeight=d.style.pixelHeight;					 

                } 

                // calculate maximum height 

                maxHeight=Math.max(maxHeight,divHeight); 

          } 

     } 

     // assign maximum height value to all of container <div> elements 

     for(var i=0;i<contDivs.length;i++){ 

          contDivs[i].style.height=maxHeight + "px"; 

     } 

} 

// execute function when page loads 

window.onload=function(){ 

     if(document.getElementsByTagName){ 

          matchHeight();			 

     } 

} 




/**
 * DHTML phone number validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}

function ValidateForm(){
	var Phone=document.getElementById("phone");	
	if ((Phone.value==null)||(Phone.value=="")){
		alert("Please Enter your Phone Number")
		Phone.focus()
		return false
	}
	if (checkInternationalPhone(Phone.value)==false){
		alert("Please Enter a Valid Phone Number")
		Phone.value=""
		Phone.focus()
		return false
	}
	return true
 }

