﻿/***************************/
//@Author: Adrian "yEnS" Mato Gondelle & Ivan Guardado Castro
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/

$(document).ready(function(){
	//global vars
	var searchBoxes = $(".text");
	var searchBox1 = $("#email2");
	var searchBox2 = $("#name2");
	var searchBox3 = $("#phone2");
	var searchBox4 = $("#company3");
	var searchBox5 = $("#message2");
	var searchBox6 = $("#email3");
	var searchBox7 = $("#name3");
	var searchBox8 = $("#phone3");
	var searchBox9 = $("#message3");
	var searchBox10 = $("#emailC");
	var searchBox11 = $("#nameC");
	var searchBox12 = $("#phoneC");
	var searchBox13 = $("#messageC");
	var searchBox1Default = "E-mail...";
	var searchBox2Default = "Name...";
	var searchBox3Default = "Phone...";
	var searchBox4Default = "Company...";
	var searchBox5Default = "Message...";
	var searchBox6Default = "E-mail...";
	var searchBox7Default = "Name...";
	var searchBox8Default = "Phone...";
	var searchBox9Default = "Message...";
	var searchBox10Default = "E-mail...";
	var searchBox11Default = "Name...";
	var searchBox12Default = "Phone...";
	var searchBox13Default = "Message...";
	
	//Effects for both searchbox
	searchBoxes.focus(function(e){
		$(this).addClass("active");
	});
	searchBoxes.blur(function(e){
		$(this).removeClass("active");
	});
	
	searchBox1.focus(function(){
		if($(this).attr("value") == searchBox1Default) $(this).attr("value", "");
	});
	searchBox1.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBox1Default);
	});
	
	
	//Searchbox2 show/hide default text if needed
	searchBox2.focus(function(){
		if($(this).attr("value") == searchBox2Default) $(this).attr("value", "");
	});
	searchBox2.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBox2Default);
	});
	
	
	searchBox3.focus(function(){
		if($(this).attr("value") == searchBox3Default) $(this).attr("value", "");
	});
	searchBox3.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBox3Default);
	});
	
	searchBox4.focus(function(){
		if($(this).attr("value") == searchBox4Default) $(this).attr("value", "");
	});
	searchBox4.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBox4Default);
	});
	
	searchBox5.focus(function(){
		if($(this).attr("value") == searchBox5Default) $(this).attr("value", "");
	});
	searchBox5.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBox5Default);
	});
	
	searchBox6.focus(function(){
		if($(this).attr("value") == searchBox6Default) $(this).attr("value", "");
	});
	searchBox6.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBox6Default);
	});
	
	searchBox7.focus(function(){
		if($(this).attr("value") == searchBox7Default) $(this).attr("value", "");
	});
	searchBox7.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBox7Default);
	});
	
	searchBox8.focus(function(){
		if($(this).attr("value") == searchBox8Default) $(this).attr("value", "");
	});
	searchBox8.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBox8Default);
	});
	
	searchBox9.focus(function(){
		if($(this).attr("value") == searchBox9Default) $(this).attr("value", "");
	});
	searchBox9.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBox9Default);
	});
	
	searchBox10.focus(function(){
		if($(this).attr("value") == searchBox10Default) $(this).attr("value", "");
	});
	searchBox10.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBox10Default);
	});
	
	searchBox11.focus(function(){
		if($(this).attr("value") == searchBox11Default) $(this).attr("value", "");
	});
	searchBox11.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBox11Default);
	});
	
	searchBox12.focus(function(){
		if($(this).attr("value") == searchBox12Default) $(this).attr("value", "");
	});
	searchBox12.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBox12Default);
	});
	
	searchBox13.focus(function(){
		if($(this).attr("value") == searchBox13Default) $(this).attr("value", "");
	});
	searchBox13.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBox13Default);
	});
	
});
