/**
 * @author onepixel
 */
$(document).ready(function(){
	
    etat_billetterie_calendrier(".sp-complet .message");
	
    //$('#cartDate .list-date').tinyscrollbar({ size: 100 });
	$('#dateslist').tinyscrollbar({ });
	
	$("a.trigger").tooltip({
		position: "top center",
		relative : 1
	});
	$("#galeriephoto").cycle();
	
/*
	$("#shop_tarifs tr:odd").css("background-color", "#EEEEEE");

*/	$(".a_motdepasse").click(function() {
					$("#fCustomerLostpwd").toggle();
					$("#fCustomerLogin").toggle();
					return false;
		 		});
    $('ul.sf-menu').superfish({
        delay: 1000, // one second delay on mouseout 
        animation: {
            opacity: 'show',
            height: 'show'
        }, // fade-in and slide-down animation 
        speed: 'fast', // faster animation speed 
        autoArrows: true, // disable generation of arrow mark-up 
        dropShadows: true // disable drop shadows 
    });
    
    
    
    //$('.proimg').cycle({
    //    fx: 'fade'
    //});
	
	$('#lieux10,#lieux10col2,.faq,#team').accordion({
			autoheight: false,
			header: "dt",
			collapsible : true,
			active : 0,
            selectedClass: "myAccordionActive"
		});
		$('#ontour').accordion({
			autoheight: false,
			header: "dt",
			active : false,
			collapsible : true,
            selectedClass: "myAccordionActive"
		});
		// toggle sidebox content
//$(".sidebox h3,.shop_head").click(function(){ 	// element clicable
	//    $(this).next().toggle('fast'); 				// affiche/masque element DOM suivant
	  //  $(this).children('.plus').toggle(); 
		//$(this).children('.moins').toggle(); 
		//$(this).toggleClass("active");		// change la classe
	    //return false;
//	});
	
	
// ============  NEW 2011     ================================== //
	

	$('#bb_dopay').css({ opacity: 0.5 });
	$("a.printMe").click(function(){
	     $('#contenu').printElement();
		 return false;
	});
	
	// form - SelectBox
	//$("SELECT").selectBox({
	//    menuTransition: 'slide',
	//    menuSpeed: 'fast'
	//});
	// form - checkbox
    $('input[type="checkbox"]').ezMark({
        checkboxCls: 'ez-checkbox',
        checkedCls: 'ez-checked'
    });
    
    // dates - slide
	//$("h4.date-title").click(function(){
	//    $(this).next().slideToggle("fast");
	//});
	
	// info tarif
	$(".info a").hover(function(){
	    $(".tarifs-details").slideToggle("fast");
	});
	$(".info a").click(function(){
	    return false;
	});
	
	$(".moretext").next().hide();
	$(".moretext").click(function(){
	    $(this).next().slideToggle("fast").queue(function(){
			$.scrollTo( '.wrap', 800 ).dequeue();
		})
		
	});
	
	// grise et desactive les moyens de paiements
	$("#bb_dopay").show();
	$("#bb_dopay").animate({opacity:"0.2"});
	$("#bb_dopay").attr("disabled", "disabled"); // To disable
	$(".conditions").click(function(){
		if ($("#iConfirmCondition").is(":checked")){
			 $("#bb_dopay").animate({opacity:"1"});
			 $("#bb_dopay").removeAttr("disabled");
		}  else {
			$("#bb_dopay").animate({opacity:"0.2"});
			$("#bb_dopay").attr("disabled", "disabled");
		}
	});
 // ============  end NEW 2011 ================================== //    

});// end doc.ready




function hideHeader(){
    document.getElementById('theHead').style.display = 'none';
}

/*menu de la page video*/
function highlightVdoMenu(idOn){
    /*
     alert (vdoArray.length);
     */
    for (var j = 0; j < vdoArray.length; j++) {
        /*alert(j);*/
        document.getElementById(vdoArray[j]).style.color = "#45A12B";
    }
    document.getElementById(idOn).style.color = "#000000";
}

/*menu de la page audio*/
function highlightMp3Menu(idOn){
    /*alert (vdoArray.length);*/
    for (var j = 0; j < mp3Array.length; j++) {
        /*alert(j);*/
        document.getElementById(mp3Array[j]).style.color = "#000000";
    }
    document.getElementById(idOn).style.color = "#ED687E";
}

function actif(idOn){
    document.getElementById(idOn).style.color = "#000000";
    
}


// Jw player For Mp3 on programme page 




function deletePlayer(theWrapper, thePlaceholder, thePlayerId) { 
        swfobject.removeSWF(thePlayerId);
        var tmp=document.getElementById(theWrapper);
        if (tmp) { tmp.innerHTML = "<div id=" + thePlaceholder + "></div>"; }
}


function createPlayer(thePlaceholder, thePlayerId, theFile, theStart) {
        var flashvars = {
               // skin:'assets/flash/mediaplayer-5.2/glow.zip',
                file:theFile, 
                autostart:theStart
        }
        var params = {
                allowfullscreen:"true", 
                allowscriptaccess:"always"
        }
        var attributes = {
                id:thePlayerId,  
                name:thePlayerId
        }
        swfobject.embedSWF("assets/flash/mediaplayer-5.2/player.swf", thePlaceholder, "320", "24", "9.0.115", false, flashvars, params, attributes);
}


function initPlayer(theFile,theStart) { 
        deletePlayer('musicwrapper', 'jw52', 'player1'); 
        createPlayer('jw52', 'player1', theFile, theStart);
}
function etat_billetterie_calendrier(target_items){
                $(target_items).each(function(i){
					$myMessage1= "Ce spectacle est complet";
					$myMessage2= "Ce spectacle est clot";
					if ($(this).text() === "Complet") {
//						$(this).parent().attr("title",$myMessage1 );
					
					};
					if ($(this).text() === "Clot") {
//						$(this).parent().attr("title",$myMessage2 );
					}; 
                });
            }
// \Jw player 


