function clearQueue(s){tmp=$("#"+s).queue().length;for(var i=0;i<tmp;i++){$("#"+s).queue().pop();}}
function fermer(){clearQueue("wrapper");$("#wrapper").hide("normal");close_Jplayer();}
function ouvrir(){clearQueue("wrapper");$("#wrapper").show("normal",function(){resizeMe();});}
function setTitle(name){$("#titre").empty();$("#titre").append(name);}
function updateJScroll(){$('#main').jScrollPane({showArrows:true,scrollbarWidth:10,arrowSize:12});}
function toggleLogin(){
	if($("#login_content").css("height")=="0px"){$("#login_content").animate({height:"160px"},600);$("#login_panel").animate({height:"200px"},600);}
	else{$("#login_content").animate({height:"0px"},600);$("#login_panel").animate({height:"45px"},600);}
}
function sendDrapeau(t){$('#'+t).submit();}


window.onresize=function(){resizeMe();}
function resizeMe(){
	var m='#main';var w='#wrapper';var mf='#main_footer';var i='width';var h='height';var mh='min-height';
	$(m).jScrollPaneRemove();
	if($(window).width()<800){var d=parseInt(($(window).width()-50));$(w).css(i,d+"px");$(m).css(i,d+"px");}
	else{$(w).css(i,"800px");$(m).css(i,"800px");}
	if($(window).height()<650){var ch=parseInt($(window).height()-50);$(w).css(mh,ch+"px");$(m).css(mh,ch+"px");$(w).css(h,ch+"px");$(m).css(h,ch+"px");}
	else{var nh="650px";$(w).css(mh,nh);$(m).css(mh,nh);$(w).css(h,nh);$(m).css(h,nh);}
	if($(window).height()<800){$(mf).css("display","none");}
	else{$(mf).css("display","block");}
	$(w).css("margin-left","-"+parseInt(($(w).width()/2)+24)+"px");
	$(w).css("margin-top","-"+parseInt(($(w).height()/2)+24)+"px");
	updateJScroll();
}

function change_menu_search(id){$("#news_search").css("display","none");$("#mix_search").css("display","none");$("#mp3_search").css("display","none");$("#"+id).css("display","block");}

$(document).ready(function(){
	resizeMe();
	$(".main_btn").mouseover(function(){
		clearQueue(this.id);
		$("#"+this.id).fadeTo(500, 1);
	});
	$(".main_btn").mouseout(function(){
		clearQueue(this.id);
		$("#"+this.id).fadeTo(500, 0.2);
	});
	$(".flag").mouseover(function(){
		clearQueue(this.id);
		$("#"+this.id).fadeTo(500, 1);
	});
	$(".flag").mouseout(function(){
		clearQueue(this.id);
		$("#"+this.id).fadeTo(500, 0.5);
	});
	$("#login_panel").mouseover(function(){
		clearQueue(this.id);
		$("#"+this.id).fadeTo(500, 1);
	});
	$("#login_panel").mouseout(function(){
		clearQueue(this.id);
		$("#"+this.id).fadeTo(500, 0.5);
	});

	var prefix_img = "./content/img/jplayer/";
	var preload = new Array("bg_loadbar.gif", "bg_progressbar.png", "bg_slider_volume.gif", "bg_volume.png", "pause.png", "pause_hover.png", "play.png", "play_hover.png", "stop.png", "stop_hover.png");
	for(var i=0; i<preload.length; i++){
		var tmp = new Image();
		tmp.src = prefix_img+preload[i];
	}

	if($.browser.msie){
		$(".main_btn").unbind();
		document.getElementById("news_btn").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=content/img/menu/news.png,sizingMethod='scale')";
		document.getElementById("mix_btn").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=content/img/menu/mix.png,sizingMethod='scale')";
		document.getElementById("bio_btn").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=content/img/menu/bio.png,sizingMethod='scale')";
		document.getElementById("search_btn").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=content/img/menu/search.png,sizingMethod='scale')";
		document.getElementById("junzzi_btn").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=content/img/menu/junzzi.png,sizingMethod='scale')";
	}
});
