jQuery.noConflict();


/************************************************************************************
*									MEnu de droite
************************************************************************************/

function initLeftMenu(selected_id, selected_sub_id, selected_id2, selected_sub_id2){

	var $ = jQuery;

	var divs = $("menu").hasClass("sub_elements");
	for ( var i = 0 ; i< divs.length ; i++) {
		divs[i].hide();
	}

	if ($('sub_elements_'+selected_sub_id) )$('sub_elements_'+selected_sub_id).show();

	jQuery(function() {
		jQuery("#menu").accordion({
			event: "click", 
			collapsible: false,
			autoHeight: false,
			active: selected_id,
			navigation: true
		});
	});
	
	jQuery(function() {
		jQuery("#second_menu").accordion({
			event: "click", 
			collapsible: false,
			autoHeight: false,
			active: selected_id2,
			navigation: true
		});
	});

}

/*
function showSubMenu(menu){
	jQuery('#'+menu).toggle("fast");
}
*/

//initForm = function() {}
//initColorMenu = initForm;

function initSubMenu(selected_id){

    var $ = jQuery;

    jQuery(function() {
		jQuery(".third_menu_accordion").accordion({
			event: "click",
			collapsible: false,
			autoHeight: false,
			active: selected_id,
			navigation: true
		});
	});
}

/************************************************************************************
*                                                                       Formulaire
************************************************************************************/
function initForm(open){

        jQuery(function() {
                jQuery("div.quiz table.sub_quiz").accordion({
                        event: "click",
                        collapsible: true,
                        autoHeight: false,
                        active:(open === true)?0:1,
                        navigation: true
                });

                /*jQuery("div.quiz table.select_id").accordion({
                        active:0
                });*/

        });
/*
        if(open==true){
            jQuery("div.quiz table.sub_quiz").each(
                function(index, item){
                    jQuery(item).active();
                }
            )
        }
*/

}

/************************************************************************************
*                                                                       Couleur menu & produit
************************************************************************************/
function initColorMenu(numColor)
{
        var colors = [];
        colors[2] = '8CBB1B';
        colors[1] = '328EC6';
        colors[0] = '';
        colors[3] = 'CF6A3C';
        colors[4] = '9E8A89';
		colors[5] = '3E974F';
		colors[6] = '424141';
        colors[12] = '328EC6';
        colors[13] = '3E974F';
        colors[14] = '9E8A89';
       
        //window.onload = function() {
                var css = document.createElement('style');
                css.setAttribute('type', 'text/css');

                var cssText='#summary p,#summary h3, #content h3.no_arrow, #content ul li a, #header_wave h1, #content_right>a, #menu li li.current_page a, #page_path li.current_page a { color:#'+colors[numColor]+'; }';
                if(css.styleSheet){
                        css.styleSheet.cssText = cssText;
                }else{
                        css.appendChild(document.createTextNode(cssText));
                }

                document.body.appendChild(css);
        //}

}


/************************************************************************************
*									En plus
************************************************************************************/

function px(x){
	return ''.concat(Math.round(x), 'px');
}



(function($) {
	$(document).ready(function() {
		var td_form_choix_max = $('#choix_max');
		if(td_form_choix_max) {
			td_form_choix_max.find('input').bind('click', function() {
				var c = 0;
				$.each(td_form_choix_max.find('input'), function(index, value) {
					if($(value).attr('checked')) {
						c++;
					}
				});
					
                                  				if(c > 3) {
					$('#choix_max_erreur').fadeIn();
				} else {
					$('#choix_max_erreur').fadeOut();
				}
			});
		}
	});
})(jQuery);

