$().ready(function(){

	$("#side-tabs li").click(function() {

		$("#side-tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab-page").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});

	function c(d) {
		if (d==true && $(this).val() == $(this).attr("title")) {
			$(this).val("").removeClass("i-empty");
		} else {
			if (d==false && $.trim($(this).val())=="") {
				$(this).addClass("i-empty").val($(this).attr("title"));
			}
		}
	}
	function a() {c.call(this, true); }
	function b() {c.call(this, false);}
	
	$("#text").each(function(){
		if ($.trim($(this).val()) == "" && (!this.focused || this.focused==false)) {
			$(this).val($(this).attr("title"));
		}
		if ($(this).val() == $(this).attr("title")) {
			$(this).addClass("i-empty");
		} else {
			$(this).removeClass("i-empty").focus();
		}
	}).focus(a).blur(b);
	
	$('.sisea-search-form').submit(function(){
		var i = $("#text");
		if (i.val() == i.attr("title")) {
			i.val("");
		}
		return true; 
	});

});
