/*
20/11/2008
Ferrino application JS file
author: Alessandro Chinazzo
*/

$(document).ready(function(){
	
	$('#header ul li').hover(function(){
		$(this).addClass('hover');
	}, function() {
		$(this).removeClass('hover');
	});
	
	$('#main-nav>li').hover(function() {
		$(this).addClass('hover');
		if ( !$(this).find("ul").is(":visible") ) {
			$(this).siblings().removeClass('active');
			$(this).addClass('active');
		}
		
	}, function() {
		$(this).removeClass('hover');
		if ( $(this).find("ul>li.active").length == 0 ) {
			$(this).removeClass('active');
			$(this).siblings().find("ul>li.active").parent().parent().addClass('active');
		}
	});
	
	if ($('#products-nav')) {
		$('#products-nav ul li').hover(function(){
			$(this).addClass('hover');
		}, function() {
			$(this).removeClass('hover');
		});
		$('#products-nav ul li a').wrap("<span class=\"top-right\"></span>");
		$('#products-nav ul li a').wrap("<span class=\"bottom-right\"></span>");
		$('#products-nav ul li a').wrap("<span class=\"bottom-left\"></span>");
	}
	
	$('fieldset input').focus(function() {
		if ($(this).attr("value") == 'e-mail') {
			$(this).attr("value", "")
		}
	});
	
	$('fieldset input').blur(function() {
		if ($(this).attr("value") == '') {
			$(this).attr("value", "e-mail")
		}
	});
	
	$('#search input').focus(function() {
		if ($(this).attr("value") == 'HLEDEJ') {
			$(this).attr("value", "")
		}
	});
	
	$('#search input').blur(function() {
		if ($(this).attr("value") == '') {
			$(this).attr("value", "HLEDEJ")
		}
	});
	
});
