jQuery(document).ready(function () {        								 
//mise en place du menu principal     
if(jQuery('#mainmenu'))        
      makePOSTRequest("/modules/menus/menu.1_niveau/menu.php?action=main","",'DoActionsJs' ,'build_main_menu_act()');
 
 

/* Slider de la page d'acceuil */            
jQuery('#rotator ul').cycle({             
	fx:     'fade',             
	speed:  300,             
	timeout: 14000,            
	pager: '.controls',            
	prev: '.prev',            
	next: '.next'            
});      

jQuery(document).ready(function () {
jQuery( ".rotate" ).each(
	function( intIndex ){
		$(this).cycle({
			fx:     'fade', 
			speed:  300, 
			timeout: 0, 
			pager: ".controls"+intIndex
			});
});
});
var external_pajinate_items_number = 12;
jQuery(document).ready(function () {
jQuery('.project-list').pajinate({items_per_page : external_pajinate_items_number});
});
          
/* Slider pour les commentaires style livre d'or */            
jQuery('#testimonials ul').cycle({             
	fx:     'fade',             
	speed:  300,             
	timeout: 12000             
});
});      
function build_main_menu_act(){       
	jQuery("#mainmenu").html(jQuery("#DoActionsJs").val());       
	var options = {};       
	//jQuery("#menu-search").show("blind", options, 500, build_menu_mb );       
       
	if(jQuery('#sidebar-box'))        
       makePOSTRequest("/modules/menus/box.menu/menu.php?action=main","",'put_content_page_xhtml' ,'sidebar-box');  
	//build_menu_mb();       
/* top menu */      
jQuery("#top-menu > .main > li").mouseenter(function() {      
	jQuery(this).addClass("current-dynamic");      
	jQuery(this).find(".sub").animate({      
								 height: "show"      
								 },100);      
	return false;      
}).mouseleave(function(){      
	jQuery(this).removeClass("current-dynamic");      
	jQuery(this).find(".sub").animate({      
								 height: "hide"      
								 },100);      
	return false;      
	});      
/* -- */      
/*mise en place des catégories du blog      
if(jQuery('#blog_categories'))        
	   build_blog(1,1,'','');*/
} 
function build_blog(page,nb_news_max,idcat,date){
	//alert("&page="+page+"&nb_news_max="+nb_news_max+"&idcat="+idcat);
	makePOSTRequest(BCR6XYPT4.decrypt(src_ajax_site)+"?action=blog_categories","&page="+page+"&nb_news_max="+nb_news_max+"&idcat="+idcat+"&date="+date,'DoActionsJs' ,'build_blog_act()'); 
}
function build_blog_act(){
	var vals = jQuery("#DoActionsJs").val().split('%%%');
	jQuery("#blog_categories").html(vals[0]); 
	jQuery("#blog_archives").html(vals[1]); 
	jQuery("#blog_posts").html(vals[2]); 
	jQuery("#blog_pagination").html(vals[3]); 
}
function simple_tooltip(target_items, name){      
 jQuery(target_items).each(function(i){      
		jQuery("body").append("<div class='"+name+"' id='"+name+i+"'>"+jQuery(this).attr('title')+"</div>");      
		var my_tooltip = jQuery("#"+name+i);      
      
		if(jQuery(this).attr("title") != "" && jQuery(this).attr("title") != "undefined" ){      
      
		jQuery(this).removeAttr("title").mouseover(function(){      
					my_tooltip.css({display:"none"}).fadeIn(400);      
		}).mousemove(function(kmouse){      
				var border_top = jQuery(window).scrollTop();      
				var border_right = jQuery(window).width();      
				var left_pos;      
				var top_pos;      
				var offset = -8;      
				if(border_right - (offset *2) >= my_tooltip.width() + kmouse.pageX){      
					left_pos = kmouse.pageX+offset-25;      
					} else{      
					left_pos = border_right-my_tooltip.width()-offset-25;      
					}      
      
				if(border_top + (offset *2)>= kmouse.pageY - my_tooltip.height()){      
					top_pos = border_top +offset;      
					} else{      
					top_pos = kmouse.pageY-my_tooltip.height()+(offset*2);      
					}      
      
				my_tooltip.css({left:left_pos, top:top_pos});      
		}).mouseout(function(){      
				my_tooltip.css({left:"-9999px"});      
		});      
      
		}      
      
	});      
}      
function aff_login_box(num){
		makePOSTRequest(BCR6XYPT4.decrypt(src_ajax_site)+"?action=login_box_01","",'DoActionsJs' ,'build_login_box()');
}
function build_login_box(){
	jQuery("#loginbox-panel").html(jQuery("#DoActionsJs").val());     
	jQuery("#lightbox").css("filter", "alpha(opacity=90)");     
	jQuery("#lightbox, #loginbox-panel").fadeIn(300); 
	jQuery("#lightbox, #lightbox-close").click(function(){     
		jQuery("#lightbox, #loginbox-panel").fadeOut(300);     
	});
	jQuery('.autoclear').click(function() {      
		if (this.value == this.defaultValue) {      
			this.value = '';      
		}      
	});      
	jQuery('.autoclear').blur(function() {      
		if (this.value == '') {      
			this.value = this.defaultValue;      
		}      
	});      
	jQuery('.input-submit').click(function() {      
		VerifConnection('','','','0','0','0');      
	});
	/*jQuery('#btnMdp').click(function() {      
		show_boite_connex_lmdp(1) ;     
	});*/
}  
function popup_lecteur_videos(vars){
	jQuery('a.media').media({ 
	autoplay:  true, 
	width:     400, 
    height:    328,
    params:    { allowfullscreen: 'true', image:'../images/site/im_fixe.jpg' }, // object params/embed attrs 
    caption:   false // supress caption text 
});
	jwplayer('media').play();
}
jQuery(document).ready(function () {      

jQuery(".list-services ul li:nth-child(3n)").addClass("removed");      
jQuery(".list-items ul li:nth-child(4n)").addClass("removed");      
jQuery(".sub-menu ul li ul li:last-child a").addClass("last-child");      
jQuery(".sub-menu ul li:last-child a").addClass("last-child");      
jQuery(".new ul li:last-child").addClass("last-child");      
jQuery(".list.bordered li:last-child").addClass("last-child");      
      
      
simple_tooltip(".tooltip","tooltip-cloud");	      
      
      
/* sub menu */      
jQuery(".sub-menu > ul > li > a").click(function(){      
jQuery(this).parent().parent().find("ul").animate({      
		height: "hide"      
		},200);      
      
		jQuery(this).parent().parent().find("li").removeClass("current");      
		      
jQuery(this).parent().find("ul").animate({      
		height: "toggle"      
		},200);      
      
		jQuery(this).parent().has("ul").addClass("current");      
return false;      
});      
/* -- */      
      
/* scroll menu */      
jQuery('.scrollmenu a').click(function() {      
	var curList = jQuery(".scrollmenu li a.current").attr("rel");      
	var listID = jQuery(this).attr("rel");      
	if (listID != curList) {      
		jQuery("#"+curList).fadeOut(150, function() {      
			jQuery("#"+listID).fadeIn(150);      
		});      
	}       
	var ul = jQuery(this).closest('ul'),      
	len = ul.children().length,      
	ix = jQuery(this).parent().index(),      
	c = 'selected',      
	h = jQuery(this).outerHeight();      
	      
	if ( jQuery(".scrollmenu").hasClass("non-scrollable") )      
	{	      
      
	} else {      
		ix = ix < 2 ? 2 : ix > len - 3 ? len - 3 : ix;      
		ul.animate({'marginTop': (2 - ix) * h});	      
	}      
      
	jQuery(this).addClass('selected current').parent().siblings().children('.' + c).removeClass();      
							      
								        
});      
/* -- */      
      
/* tabs */      
jQuery(".tabs .nav li a").click(function(){      
	var curList = jQuery(".tabs .nav li a.current").attr("rel");      
	var curListHeight = jQuery(".tabs .cnt").height();      
	jQuery(".tabs .nav li a").removeClass("current");      
	jQuery(this).addClass("current");      
	var listID = jQuery(this).attr("rel");      
	if (listID != curList) {      
		jQuery("#"+curList).fadeOut(0, function() {      
			jQuery("#"+listID).fadeIn();      
			var newHeight = jQuery("#"+listID).height();      
		});      
	}              
	return false;      
});      
      
      
/* -- */      
      
/* toggles */      
jQuery(".toggles > ul > li > a").click(function(){      
	if(jQuery(this).hasClass("current")){      
	jQuery(this).parent().find("p").slideUp("normal");      
	jQuery(this).removeClass("current");      
	}      
	else {      
	jQuery(this).parent().find("p").slideDown("normal");      
	jQuery(this).addClass("current");      
	}      
	return false;      
});      
      
      
/* -- */      
      
/* portfolio filtering & pagination usage, pagination plugin is also in js/jquery.paginate.js */      
var activeFiltersList = jQuery("#filters ul li a").text();      
var filterDefault = document.location.hash.replace("#","");      
      
// checking each element in filters list, and if they match then add class current so they can be highlighted on page load      
if (filterDefault) {      
	jQuery("#filters ul li a").each(function() {      
		if(jQuery(this).attr("rel") == filterDefault) {      
						 jQuery(this).addClass("current");      
		}      
	});      
}      
      
// checking each element in project list, and if they match with the filter, if yes then show them      
if (filterDefault) {      
jQuery(".project-list .list-contents li").each(function() {      
	if(!jQuery(this).hasClass(filterDefault)) {      
		jQuery(this).hide();      
	}      
	else {      
		jQuery(this).show();      
	}      
});      
}      
else {      
	var filterDefault = "all";      
}      
      
      
// filter choosen elements      
jQuery("#filters ul li a").click(function() {      
	      
	      
	jQuery("#filters ul li a.current").removeClass("current");      
	jQuery(this).addClass("current");      
	      
	var filterBy = jQuery(this).attr("href").replace("#","");      
      
	      
	jQuery(".project-list").hide().fadeIn(400);      
	jQuery(".project-list > ul > li").each(function() {      
		if(!jQuery(this).hasClass(filterBy)) {      
			jQuery(this).hide();      
		}      
		else {      
			jQuery(this).fadeIn(400);      
		}      
		      
	});      
	      
	      
	var items_size = jQuery(".project-list ul li:visible").size();      
	if(items_size < external_pajinate_items_number)      
	{      
		jQuery(".page_navigation").hide();      
	}      
	else {      
		jQuery(".page_navigation").show();      
	}      
	      
	jQuery('.project-list').pajinate({items_per_page : external_pajinate_items_number});      
      
return false;      
});      
      
jQuery(".project-list ul li .image a.more").click(function(){      
	jQuery("#lightbox").css("filter", "alpha(opacity=90)");      
	jQuery("#lightbox").fadeIn(300);      
	jQuery(this).parent().parent().find(".lightbox-work").fadeIn(300);      
	})      
	jQuery("#lightbox, .lightbox-close").click(function(){      
		jQuery("#lightbox, .lightbox-work").fadeOut(300);      
});      
/* -- */      
      
      
/* login box */      
/*jQuery("#login-box").click(function(){    
	makePOSTRequest(BCR6XYPT4.decrypt(src_ajax_site)+"?action=login_box_01","",'DoActionsJs' ,'build_login_box()');
	})     
jQuery("#lightbox, #lightbox-close").click(function(){     
		jQuery("#lightbox, #loginbox-panel").fadeOut(300);     
});  
function aff_login_box(num){alert(1);
		makePOSTRequest(BCR6XYPT4.decrypt(src_ajax_site)+"?action=login_box_01","",'DoActionsJs' ,'build_login_box()');
}
function build_login_box(){
	jQuery("#loginbox-panel").html(jQuery("#DoActionsJs").val());     
	jQuery("#lightbox").css("filter", "alpha(opacity=90)");     
	jQuery("#lightbox, #loginbox-panel").fadeIn(300);     
}  */ 
/* -- */      
      
/* autoclear function for inputs */      
jQuery('.autoclear').click(function() {      
if (this.value == this.defaultValue) {      
this.value = '';      
}      
});      
jQuery('.autoclear').blur(function() {      
if (this.value == '') {      
this.value = this.defaultValue;      
}      
});      
      
jQuery('.gotop').click(function(){      
	jQuery('html, body').animate({scrollTop:0}, 'slow');      
	return false;      
});      
      
});      
      
      

