$(document).ready(function(){

	//FONT REPLACEMENT
	//Cufon.replace('.btn, #btn-search, .info h4, .pagenation, .rm, #tab-nav a, .sr', { fontFamily: 'Gill Sans Std' });
	Cufon.replace('h1, h2, #footer h3, .cat-item h4, .info h3, .list h4, .entry h4, h6', { fontFamily: 'ITC Officina Sans Std' });
	
	//TAB SETUP
	$('#tabbed-list').tabs({ fxFade: true, fxSpeed: 'fast' });

    //CLICKABLE BLOCKS
    $(".cat-item").click(function() {
    	window.location=$(this).find("a").attr("href");
    	return false;
	});
	
	$('.dd').hide();
	
	$('.ft a').hover(function() {
		$('.wis .dd').fadeOut()
		$(this).next('.dd').fadeIn()
	}, function() {
		//do nothing
	});
	$('.wis a').hover(function() {
		$('.ft .dd').fadeOut()
		$(this).next('.dd').fadeIn()
	}, function() {
		//do nothing
	});
	
	$('.dd').hover(function() {
		//do nothing
	}, function() {
		$(this).fadeOut()
	});
	
	$('#nav-main').hover(function() {
		//do nothing
	}, function() {
		$('.dd').fadeOut()
	});
	
	$('.nosub').hover(function() {
		$('.dd').fadeOut()
	}, function() {
		// do nothing
	});

	$("#slider").easySlider({
		auto: true, 
		continuous: true,
		speed: 		1000,
		pause:		4000
	});
	
	$('#seasonal_chart em').hide();
	$("#seasonal_chart tr").click(function(){
    	window.location=$(this).find("a").attr("href");return false;
	});

	$('#seasonal_chart tr').hover(function() {
		$(this).find('em').show();
	}, function() {
	
		$(this).find('em').hide();
	});
	
	$('#content .left br').after('<span class="spacer"></div>');
	
	// validate signup form on keyup and submit
	
	if (getLanguage() != "fr") {
	
		// validate signup form on keyup and submit
		$("#searchform").validate({
			//FIELD RULES
			rules: {
				keywords: {
					required: true
				}
			},
			//MESSAGE TEXT
			messages: {
				keywords: "This field is required"
				
			}
		});
		
	} else {
		// validate signup form on keyup and submit
		$("#searchform").validate({
			//FIELD RULES
			rules: {
				keywords: {
					required: true
				}
			},
			//MESSAGE TEXT
			messages: {
				keywords: "Ce champ est requis"
				
			}
		});
	}

});
	

function getLanguage() {
	var a = document.URL.split("//"); // split at protocol
	a = (a[1] ? a[1] : a[0]).split("/");
	// use last element of a; split at /
	// host is a[0]; path is a[1..(n-1)]; a[n] is page
	return a[(2-1)];
}

// clearing  inputs on focus
function doClear(theText) { if (theText.value == theText.defaultValue) { theText.value = ""; } }
//replace input value with default on blur
function doReset(theText) { if (theText.value == "") { theText.value = theText.defaultValue; } }



