/***************************/
//@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 = $("#log_login");
	var searchBox2 = $("#log_haslo");
	var searchBox3 = $("#szukaj");
	var searchBox4 = $("#subskrybcja");
	var searchBox22 = $("#lh");
	var searchBox2Default = "hasło";
	var searchBox1Default = "login";
	var searchBox3Default = "szukaj...";
	var searchBox4Default = "wpisz adres e-mail";
	
	
	//Effects for both searchbox
	searchBoxes.focus(function(e){
		$(this).addClass("active");
	});
	searchBoxes.blur(function(e){
		$(this).removeClass("active");
	});
	
	//Searchbox2 show/hide default text if needed
	searchBox1.focus(function(){
		if($(this).attr("value") == searchBox1Default) $(this).attr("value", "");
	});
	searchBox1.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBox1Default);
	});
	
	searchBox3.focus(function(){
		if($(this).attr("value") == searchBox3Default) $(this).attr("value", "");
	});
	searchBox3.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBox3Default);
	});
	
	//Searchbox2 show/hide default text if needed
	searchBox22.focus(function(){
		if($(this).attr("value") == searchBox2Default){ $(this).css('display', 'none'); searchBox2.css('display', ''); searchBox2.focus() };
	});
	searchBox2.blur(function(){
		if($(this).attr("value") == ""){ $(this).css('display', 'none'); searchBox22.css('display', ''); };
	});
	
	searchBox4.focus(function(){
		if($(this).attr("value") == searchBox4Default) $(this).attr("value", "");
	});
	searchBox4.blur(function(){
		if($(this).attr("value") == "") $(this).attr("value", searchBox4Default);
	});
});
