$(document).ready(function(){

	$("a.one").click(function() { $(".main-img:visible").hide(); $("div.one:hidden").show(); });
	$("a.two").click(function() { $(".main-img:visible").hide(); $("div.two:hidden").show(); });
	$("a.three").click(function() { $(".main-img:visible").hide(); $("div.three:hidden").show(); });
	$("a.four").click(function() { $(".main-img:visible").hide(); $("div.four:hidden").show(); });
	$("a.five").click(function() { $(".main-img:visible").hide(); $("div.five:hidden").show(); });
	$("a.six").click(function() { $(".main-img:visible").hide(); $("div.six:hidden").show(); });				

	$("form button").mouseover(function() { $(this).css("background-position", "0 -20px"); });	
	$("form button").mouseout(function() { $(this).css("background-position", "0 0"); });

	$("div.box").mouseover(function() { $(this).css("background-position", "0 -110px"); });	
	$("div.box").mouseout(function() { $(this).css("background-position", "0 0"); });

		$(".esf button[@type='submit']").click(function(){
			ok = true;
			$("h2.error").remove();

			$(".esf .required").each(function(){
			if(this.value=='') { 
				ok = false;
				$(this).css("background", "#fff");
				$(this).css("border", "1px solid #b73722");
			} else {
				$(this).css("background", "#e5e5e1");
				$(this).css("border", "1px solid #ccc");
			};                    
		});
		if(ok==false) {
			$(".esf form").prepend("<h2 class='error'>Error: Please fill in all the fields.</h2>");  
			return false;                  
		};
	});	
	
	var signup = document.getElementById("email").value;
	
	if (signup =="Subscribe to our newsletter") {
		$("#email").focus(function() { $(this).css("background", "#fff"); $(this).val(""); });	
	 }
		

	if(document.getElementsByTagName) {
		var a = document.getElementsByTagName("a");
		for(var i = 0; i < a.length; i++) {
			a[i].onfocus = function(){this.blur()};
			}

			var b = document.getElementsByTagName("button");
			for(var i = 0; i < b.length; i++) {
				b[i].onfocus = function(){this.blur()};
				}
		}

		externalLinks();
		
	});





function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
		for (var i=0; i<anchors.length; i++) {
			var anchor = anchors[i];
			if (anchor.getAttribute("href") && anchor.getAttribute("rel") == 'external')
			anchor.target = '_blank';
			}
		}

function nospam(user,domain) {
	locationstring = 'mailto:' + user + '@' + domain;
	window.location = locationstring;
	}

