$(document).ready(function(){
	
	$('#homeBanner ul').cycle({ 
	    fx:      'scrollLeft', 
	    timeout: 3000,
	    speed:   1000
	});
	
	/*jcarousel*/
	$('.carousel').jcarousel({
		scroll: 3
	});
	
	$('#searchPlant-carousel ul').jcarousel({
		scroll: 2
	});
		
	/*TabsForm HP*/
	$('#all-tabs ul.tabs').idTabs({
		selected:".selected",
		change:true,
	});
	
	/*FancyBox + gallerytof*/
	$('.fancybox').fancybox({
		frameWidth : 507,
		frameHeight: 510,
		hideOnContentClick: false,
		centerOnScroll: false,
		padding:0
	});
	
	var curUrl = window.location.href;
	var item = curUrl.split('.');
	$('ul.tabs li').each(function() {
	
		var cur = $(this), // current  LI
		i = $("a", cur), // anchor in LI
		href = i.attr("href"); // href of anchor
		if (href != "/") { //if the href isn't for the home page
		
			$("ul > li > a", cur).each(function() { // loop to check for child nodes for
				if (CheckURL($(this))) { //if we have a match...
					i.trigger('click');
					$('.jcarousel-item-' + item[item.length-1], href).children().trigger('click');
					return false; // exit the each statement
				}
			});
		if (CheckURL(i)) { //if we still haven't got a match check the normal non child nodes
			i.trigger('click');
			$('.jcarousel-item-' + item[item.length-1], href).children().trigger('click');
			return false;
		}
	}
	});
    function CheckURL(a) {
        if (curUrl.indexOf(a.attr("href")) > 0) {
            return true;
        }
        return false;
    }
    function AddClass(a) {
        a.addClass("selected");
    }
});

function write_text(login,domain,ext,subject,classe) {
emailE=(login+'@'+domain+'.'+ext)
if (classe)
document.write('<A href="mailto:' + emailE + '?subject='+subject+'" class="'+classe+'">' + emailE + '</a>')
else
document.write('<A href="mailto:' + emailE + '?subject='+subject+'">' + emailE + '</a>')
}
//à mettre a la place des liens mailto pour chaque personne evidemment
//<script type="text/javascript">write_text('info','vereal','lu','Contact Vereal','');</script>

