// Cybermuse - VERONESE Home functions script
// Developer: Dan Copeland - BV02, Ottawa ON


jQuery.preloadImages = function(){
	for(var i = 0; i<arguments.length; i++){
		jQuery("<img>").attr("src", arguments[i]);
	}
};
function greyInitial() {
	var searchBox = $('#search #keyword');
	var ph;

	if($('body').hasClass('fr')){
		searchBox.val('Recherche Cybermuse');
		ph = 'Recherche Cybermuse';
	} else {
		searchBox.val('Search Cybermuse');
		ph = 'Search Cybermuse';
	}

	$('#search .overlabel').css('display','none');
	searchBox.css('fontSize','10px');

	searchBox.bind('focus', function(){
		if ($(this).val() == ph){
			$(this).val('');
		} else {
			$(this).val(ph);
		}
	});
	searchBox.bind('blur', function(){
		if ($(this).val() === ph || $(this).val() === ''){
			$(this).val(ph);
		}
	});
}
function resizeElement(heightValue) {
	var newHeight = heightValue + "px";
	$("#preparatory").css("height",newHeight);
}

function backToTop(anchor){
		$(window).scrollTo($(anchor), 800);
}


$(document).ready(function(){
	$('.itemContent').hide();
	$('a.tooltipBtn').css('display','none');
	
	$('a.hitTitle').bind('click', function(){
		$(this).parent().prev('.itemContent').slideToggle("slow");
	
		if($('body').hasClass('fr')){
			if(this.innerHTML == 'Voir texte complet'){
				$(this).empty();
				$(this).append('Cacher texte complet');
			}else{
				$(this).empty();
				$(this).append('Voir texte complet');
			}
		} else {
			if(this.innerHTML == 'View full text'){
				$(this).empty();
				$(this).append('Hide full text');
			}else{
				$(this).empty();
				$(this).append('View full text');
			}
		} 
	});
	
	$('a.backToTop').bind('click', function(){
		backToTop('top',1200);
		return false;
	});
	greyInitial();
});