﻿
ddsmoothmenu.init({
    mainmenuid: "smoothmenu1", //menu DIV id
    orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
    classname: 'ddsmoothmenu', //class added to menu's outer DIV
    contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
});

// Contains for insensitive case !
jQuery.expr[':'].Contains = function(a, i, m) {
    var firstPart = jQuery(a).text().toUpperCase();
    firstPart = firstPart.replace(new RegExp("(\\s+)|(\r\n)|(\n\r)|(\n)", "gim"), " ");
    var secondPart = m[3].toUpperCase();

   /* if (typeof (console) != "undefined") //
    {
        console.log("START:" + firstPart);
        console.log("COMPARED TO:" + secondPart);
    }*/
    return firstPart.indexOf(secondPart) >= 0;
};


jQuery(document).ready(function() {
    setTimeout(function() {
        var vTextCategorie = jQuery(".breadcrumb SPAN[typeof='v:Breadcrumb']:eq(1)").text();
        
        if (vTextCategorie != null && vTextCategorie.length > 0) //
        {
            var $subMenuSelected = jQuery(".ddsmoothmenu > UL > LI").filter(":Contains("+vTextCategorie+")");
            $subMenuSelected.children("A").addClass("selected3");
        }
        else //no breadcrumb = HOMEPAGE
            jQuery(".ddsmoothmenu > UL > LI > A:eq(0)").addClass("selected3");
        

    }, 0);


    //    $("#formID").validationEngine();
});

$(document).ready(function() {
	/*
	$("#searchbar").attr("value", "Recherche");
	
	var text = "Recherche";
	
	$("#searchbar").focus(function() {
		$(this).addClass("active");
		if($(this).attr("value") == text) $(this).attr("value", "");
	});
	
	$("#searchbar").blur(function() {
		$(this).removeClass("active");
		if($(this).attr("value") == "") $(this).attr("value", text);
});
	*/
});
