function email(name,domain,tld)
{
 			var at = "@";
			var addy = domain;
			var dot = "."
			var com = tld
			location.href='mailto:'+name+at+addy+dot+com;
}

function getObj(name) {
	if (document.getElementById) {
		return document.getElementById(name);
	} else if (document.all) {
		return document.all[name];
	} else {
	return document.layers[name];
	}
}

function closeAll(number) {
		var div;
 		for (var i=1; i<number; i++)
    {
				div=getObj('q' + i);
				div.style.display = "none";
    }
}

function toggle(that) {
closeAll(12);
	if (that.style.display == "none") {
		that.style.display = "inline";
	} else {
		that.style.display = "none";
	}
}

function toggle2(that) {
closeAll(61);
	if (that.style.display == "none") {
		that.style.display = "inline";
	} else {
		that.style.display = "none";
	}
}

function toggle3(that) {
	if (that.style.display == "none") {
		that.style.display = "inline";
	} else {
		that.style.display = "none";
	}
}

function toggle4(that) {
closeAll(42);
	if (that.style.display == "none") {
		that.style.display = "inline";
	} else {
		that.style.display = "none";
	}
}

function switchSpots(i) {
closeAll(42);
div=getObj('q' + i);
div.style.display = "inline";
}

function popIt(index) {
  window.open(index, 'script', 'height=300,width=300,scrollbars=0,resizable=0,menubar=0,left=0,top=0');
}

function closeIt() {
	window.close();
}

//configure the two variables below to match yoursite's own info
var bookmarkurl=location.href
var bookmarktitle=document.title

function addbookmark(){
if (navigator.appName=="Netscape") {
 alert(
   'To bookmark this site, click '
  +'Bookmarks | Add bookmark '
  +'or press Ctrl+D.'
 )
}
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

function findState(){
location.hash = document.states.state.value;
}

//variables for javascript email to a friend script:
var sSubject = 'Pagina Interesante Del Web';
var sBody    = 'Hi,\n\nEsto pudo interesarle:\n' + location.href;
var s2Display = 'envie esta página';

function validateForm(theForm) {
     if ( theForm["name"].value == "") {
        alert ('Please enter a name ');
              theForm["name"].focus();
              return false;
    }
		
		if ( theForm["phone"].value == "") {
        alert ('Please enter a phone number ');
              theForm["name"].focus();
              return false;
    }
		
		if ( theForm["email"].value == "") {
        alert ('Please enter an email address ');
              theForm["name"].focus();
              return false;
    }
    return true;
}

function validateForm2(theForm) {

		theForm["name"].value = trim(theForm["name"].value);
		theForm["lname"].value = trim(theForm["lname"].value);
		theForm["email"].value = trim(theForm["email"].value);
		theForm["address1"].value = trim(theForm["address1"].value);
		theForm["city"].value = trim(theForm["city"].value);
		theForm["state"].value = trim(theForm["state"].value);
		theForm["zip"].value = trim(theForm["zip"].value);
		theForm["phone"].value = trim(theForm["phone"].value);
		
     if ( theForm["name"].value == "") {
        alert ('Please enter a first name');
              theForm["name"].focus();
              return false;
    }
		
		if ( theForm["lname"].value == "") {
			  alert ('Please enter a last name');
							theForm["lname"].focus();
							return false;
		}
		
		if ( theForm["email"].value == "") {
			  alert ('Please enter an email address');
							theForm["email"].focus();
							return false;
		}
		
		if ( theForm["address1"].value == "") {
        alert ('Please enter an address');
              theForm["address1"].focus();
              return false;
    }
		
		if ( theForm["city"].value == "") {
        alert ('Please enter a city');
              theForm["city"].focus();
              return false;
    }
		
		if ( theForm["state"].value == "") {
        alert ('Please enter a state');
              theForm["state"].focus();
              return false;
    }
		
		if ( theForm["zip"].value == "") {
        alert ('Please enter a zip');
              theForm["zip"].focus();
              return false;
    }
		
		if ( theForm["phone"].value == "") {
        alert ('Please enter a phone number');
              theForm["phone"].focus();
              return false;
    }		
		
    return true;
}

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
} // Ends the "trim" function