// JavaScript Document

	function ajouterFavoris() {
		if ( navigator.appName != 'Microsoft Internet Explorer' )
		{ window.sidebar.addPanel("Mairie de Montauban","http://www.montauban.com",""); }
		else { window.external.AddFavorite("http://www.montauban.com/","Mairie de Montauban"); }
		}
		
		function recommander()
		{
		mail_str = "mailto:?subject=%C0 voir sur le site www.montauban.com"
		mail_str += "&body=Bonjour, le site internet de la Mairie de Montauban pourrait t'int%E9resser.Voici le lien pour le visiter  "+window.location;
		
		location.href = mail_str;
	}
		function confirmer(texte){
		return confirm(texte);
	}
	


	function message(html, fermetureAuto, delai){
	Shadowbox.open({
        player:     'html',
        content:    '<div class="shadowbox_message">'+html+'</div>',
        height:     125,
        width:      250
    });
	if(fermetureAuto == undefined){
		fermetureAuto = false;
	}
	if(delai == undefined){
		delai = 5000;
	}
	if(fermetureAuto == true){
		setTimeout(fermerShadowBox, delai);
	}
}

	function ouvrirVideo(url){
		Shadowbox.open({
			player:     'iframe',
			content:    '/videoEdito.php?video='+url,
			height:     380,
			width:      480
		});
		if(fermetureAuto == undefined){
			fermetureAuto = false;
		}
		if(delai == undefined){
			delai = 5000;
		}
		if(fermetureAuto == true){
			setTimeout(fermerShadowBox, delai);
		}
	}


function fermerShadowBox(){
	Shadowbox.close();
}


	
function ajaxWaiting(){
	$('ajaxContent').html('<div id="ajaxWainting"> </div>');
}

function inputFocus(input, text){
	if(input.value == text){
		input.value = "";
	}
}

function inputBlur(input, text){
	if(input.value == ""){
		input.value = text;
	}	
}

function afficheImg(src, leDiv){
	
	if(leDiv == "undefined"){
		leDiv = $("#imgReference");
	}else{
		leDiv = $(leDiv);	
	}
	//alert(leDiv.html());
	leDiv.html('');
	leDiv.addClass('waitAjax');
	$.ajax({
	  url: "ajax/image.php?img="+src,
	  async:true,
	  cache: false,
	  dataType:'script',
	  success: function(html){
		//leDiv.removeClass('waitAjax');
		leDiv.fadeOut(0).html(html).fadeIn(200);
		
	  }
	});
	
	return false;
}

	function afficheDiv(id){
		jQuery('#bloc'+id).fadeIn('slow');
	}

function changeCouleur(ligne){
	this.color = ligne.css('background-color');
	ligne.css('background-color', "#EEEEEE");
}

function remetCouleur(ligne){
	//ligne.style.backgroundColor = this.color;
	ligne.css('background-color', this.color);
}


function validFormLogin(){
	Shadowbox.open({
        content:    '<div class="bientot">Bientôt disponible...</div>',
        player:     "html"}
		);
	return false;
}

/*-------------------------------------------------------------------------    Document ready    -------------------------------------------------------------------------*/
$(function(){
	$('#login').bind('focus',function(){
		
		inputFocus(this, 'Login');								 
	});
	$('#login').bind('blur',function(){
		inputBlur(this, 'Login');								 
	});	
	
	$('#pass').bind('focus',function(){
		inputFocus(this, 'Mot de passe');								 
	});
	$('#pass').bind('blur',function(){
		inputBlur(this, 'Mot de passe');								 
	});
	
	$('img[src$=.png]').ifixpng();
	
	
	$('#menuBandeau li').mouseenter(function(){
	
		//$("#sound").sound( {swf: "/flash/soundPlayer.swf", file: "/flash/691.mp3"} );
		
		$(this).animate({marginTop : '-10px'}, 200,"swing");
		//$(this).animate({marginTop : '0px'}, 200);
	});
	$('#menuBandeau li').mouseleave(function(){
		$(this).animate({marginTop : '0px'}, 200,"swing");
		//$(this).animate({marginTop : '10px'}, 200);
	});
	
	
	
	$('.overflow').jScrollPane({showArrows:true});

	if($('#actus').length){
		var dataSource = new ctRotatorBridgeLi($('#actus')).getDataSource();  
		//you can put the ctRotator somewhere else, but I decide to overwrite the original UL
		$('#actus').ctRotator(dataSource, { 
		  speed:6000 ,
		  showCount:3
		});
	}
	

	
	
	var options = {
		overlayColor: "#d5d5d5"
	};
	Shadowbox.init(options);
	//$("#actus").rotator({n:2, autoHeight:false, ms:5000});
	
	
	
	
});
/*-------------------------------------------------------------------------    fin Document ready    -------------------------------------------------------------------------*/
