
$(document).ready(function(){
						   
	//MAIN MENU 			   
	//$("#menu_primary li.cat-item a").wrapInner("<span>" + "</span>");
	//$("ul.children").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)
	$("ul.tml-action-links li a").wrapInner("<span>" + "</span>");
	
	$("#menu_primary li.cat-item a").wrapInner('<span>'+'</span>'); 
	
	 $("#tickerClose").click(function() {
		 $(this).parent().fadeOut('slow');
	 });

	// Hover for homepage client-banner project list
var hoverAnim = {
	init: function() {
		var project = $('#gallery_wrap .gallery-thumbnail');
		var projectTxt = project.children('.hover');
		var projectInfo = project.children('.entry-info');
		var originalBG = "#E6E6E6"; 
		var fadeColor = "#3F3F3F";
		
		project.children().children('.hover').css({left: '0px'})
 		project.children().children().children('.hover-bg').css({backgroundColor:fadeColor}).fadeTo(1, 0.0)
		project.children().children().children('.hover-meta').css({left: "-250px"})
 			
		project.hover(
			function () {
				$(this).children().children().children('.hover-meta').css({left: "-500px"});
				$(this).children().children().children('.hover-bg').stop().fadeTo(600, 0.70);
				$(this).children().children().children('.hover-meta').stop().animate({left: "20px"} , {duration: 450});
				$(this).children().children('.entry-info').stop().animate({backgroundColor:fadeColor}, 750);
			}, 
			function () {
				$(this).children().children().children('.hover-bg').stop().fadeTo(800 , 0.0);
				$(this).children().children().children('.hover-meta').stop().animate({left: "500px"} , {duration: 200});
				$(this).children().children('.entry-info').stop().animate({backgroundColor:originalBG},850);
			}
		);
		
	}
};
hoverAnim.init();


//$(".scroll").scrollable({ vertical: true, mousewheel: true, next:".n", prev:".p"  });
$(".last_content").scrollable({ mousewheel: true });	
$(".fav-posts-container #images").scrollable({ mousewheel: true });
$(".tabs").tabs(".slide li", {event:'mouseover'});

$("ul.tabs_profile").tabs("div.panes_profile > div", { history: true });

//SCROLL TO TOP SCRIPT
	jQuery(window).scroll(function () {
		jQuery("#back-top").slideDown("slow");
	})
	jQuery('#back-top').click(function() {
		jQuery('html,body').animate({scrollTop: 0}, 1000);
	});
//$(function() {
//
//	
//	$(".scrollable").scrollable({	
//  	mousewheel: true,
//  	circular:true,
// 	}).autoscroll({ autoplay: true });
// 
//  	var scrollableElements = $(".scrollable li");
// 
// 	scrollableElements.click(function() {
//  	$("#panes .active").removeClass("active");
//  	$("#panes ." + $(this).attr("class").split(' ').slice(0, 1)).addClass("active");
// 	}).filter(":lt(2)").click();
// 
//
//
//}); 
//$(".slidetabs2").tabs("#panes > div",{effect: 'fade',rotate: true}).slideshow({autoplay: true,interval:6000});

//$(".slidetabs").tabs(".images > div", {
//
//	// enable "cross-fading" effect
//	effect: 'fade',
//	
//
//	// start from the beginning after the last tab
//	rotate: true
//
//// use the slideshow plugin. It accepts its own configuration
//}).slideshow({clickable: false});


$("#validate_form").validator();

// Wrap span tags around the anchor text in the primary menu.
	
$(".info h2 ").each(function(){
	var str = $(this).text().split(" ");
	str[str.length-1] = '<span>'+str[str.length-1]+'</span>';
	str = str.join(" ");
    $(this).html(str);
 
 Cufon.refresh();
});

$('ul.dropdown').superfish({
		autoArrows: false, 
		delay:       800,                            // one second delay on mouseout 
       animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
       speed:       'normal'
	}).find('ul').bgIframe({opacity:true}); 

//$("#validate_form").validate({
//        rules: {
//          cxv_contact_name: "obligatoire",//name field validate
//          cxv_contact_email: {// compound rule
//          	required: true,
//          	email: true
//          },
//        cxv_contact_message: {
//          required: true
//        }
//        },
//        messages: {
//			cxv_contact_message: "Please enter a comment.",
//			cxv_contact_name:"Please enter your name.",
//			required: "This field is required.",
//			remote: "Please fix this field.",
//			cxv_contact_email: "Please enter a valid email address."
//		 }
//      });


});

