﻿// search
function test(leq,val,sens){
	if(sens==0){
		if(leq.value==val)
			leq.value="";
	}else{
		if(leq.value.length==0)
			leq.value=val;
	}
}
function oksearch(){
	if($("#s").attr("value")=="" || $("#s").attr("value")=="Recherche") return false;
	else return true;
}



jQuery.fn.extend({
	findPos : function() {
		var obj = jQuery(this).get(0);
		var curleft = obj.offsetLeft || 0;
		var curtop = obj.offsetTop || 0;
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
		return {x:curleft,y:curtop};
	}
});


var clicked = false;
var scr = 0;

function doItHome() {
	// var timer = setInterval('flickrRotate()',5000);
	$('a.vignette').removeAttr("title");
	$('a.vignette').find('img').removeAttr("alt");
	$('a.contenu').removeAttr("title");
	$('div.detailitem').hover(function(){
		$(this).find('a.vignette img.thumb').stop().animate({top:'-150px'},300);
		$(this).find('a.vignette div.play').stop().animate({top:'0px'},300);
	},function(){
		$(this).find('a.vignette img.thumb').stop().animate({top:'0px'},300);
		$(this).find('a.vignette div.play').stop().animate({top:'150px'},300);
	});
}

function doItSingle() {
	$('p').each(function(){
		if($(this).is(':empty')) $(this).hide();
	});
	$('#contenu p a img, #picoftheday p a img').each(function(){
		$(this).parent().addClass("noback");
	});
	$('.vvqbox').css({marginTop:'0px', paddingTop:'0px'});
}

function flickrRotate() {	
	var current = ($('div.flickrimages > img.show')?  $('div.flickrimages > img.show') : $('div.flickrimages > img:first'));
	var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div.flickrimages > img:first') :current.next()) : $('div.flickrimages > img:first'));	
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
};

