function setAlpha(){/*///BT BANDO FOOTER////////////////*/
	$("#btHide div").css("opacity", "0.0");
	$("#top").hover(function(){ $("#btHide div").stopAll().fadeTo("speed", 1); },function(){ $("#btHide div").stopAll().fadeTo("speed", 0.0); });
	
	
}
function downMenu1(){
	$(".m1").animate({marginTop:-25},"slow","backout");
}
function downMenu2(){
	$(".m2").animate({marginTop:-25},"slow","backout");
}
function downMenu3(){
	$(".m3").animate({marginTop:-25},"slow","backout",function(){manageMenu()});
}

function manageMenu(){/*///ANIM ONGLET ROLLOVER///////////*/
		//$.cookie('openMenu', '1',{ path: '/'});
		$(".m1").hover(function(){ $(".m1").stopAll().animate({ marginTop: 0 }, "speed", "expoout");}
		,function(){ $(".m1").stopAll().animate({ marginTop: -25 }, "speed", "expoout");});
		$(".m2").hover(function(){ $(".m2").stopAll().animate({ marginTop: 0 }, "speed", "expoout");}
		,function(){ $(".m2").stopAll().animate({ marginTop: -25 }, "speed", "expoout");});
		$(".m3").hover(function(){ $(".m3").stopAll().animate({ marginTop: 0 }, "speed", "expoout");}
		,function(){ $(".m3").stopAll().animate({ marginTop: -25 }, "speed", "expoout");});
}
function checkMenu(){
	var Menu = $.cookie('openMenu');
	if(Menu=='0'){
	}
	if(Menu=='1'){
		manageMenu();
	}
	else if(Menu==null){
		$(".m1").css("marginTop",-75);
		$(".m2").css("marginTop",-75);
		$(".m3").css("marginTop",-75);
		$.cookie('openMenu', '1',{ path: '/'});
		setTiming();
	}
}
function setTiming(){/*///DESCENTE ONGLET AU CHARGEMENT//////////////*/
	timer = setTimeout('downMenu1();',3000);
	timer = setTimeout('downMenu2();',3200);
	timer = setTimeout('downMenu3();',3400);
	timer = setTimeout('manageBando();',6000);
}
function manageBando(){
	var CheckBando = $("#top").css("height");
	if(CheckBando=="135px"){
		$("#top").animate({ height: 17 }, 800, "backout");
		$.cookie('openBando', '0',{ path: '/'});
	}
	if(CheckBando=="17px"){
		$("#top").animate({ height: 135 }, "slow", "easeout");
		$.cookie('openBando', '1',{ path: '/'});
	}

}


function checkBando(){
	var Bando = $.cookie('openBando');
	if(Bando=='0'){
		$("#top").removeClass("show");
		$("#top").addClass("hide");
	}
	if(Bando=='1'){
		$("#top").removeClass("hide");
		$("#top").addClass("show");
	}
	else if(Bando==null){
		$.cookie('openBando', '1',{ path: '/'});
		$("#top").addClass("show");
	}
}

function manageImg(){
		//var imgs = document.getElementsByClass("post-content").getElementsByTagName('img');
		var imgs = $(".post-content img");
		// loop through all anchor tags
		for (var i=0; i<imgs.length; i++){
			var image = imgs[i];
			
			var src = image.src;
			
			// use the string.match() method to catch 'lightbox' references in the rel attribute
			//if (anchor.getAttribute('href') && (relAttribute.toLowerCase().match('lightbox'))){
			if (src.indexOf('/.') != -1){
				
					
					var newSrc = src.split('_');
					var newSrc2 = newSrc[newSrc.length-1].split('.');					
					if (newSrc.length>2){
						newSrc.pop();
						newSrc = new Array(newSrc.join('_'));
					} 

					var newSrc3 = newSrc[0].split('/');			
					newSrc3[newSrc3.length-1] = newSrc3[newSrc3.length-1].substr(1);
					
					var a=document.createElement("A");
					a.href=newSrc3.join('/')+"."+newSrc2[1];
					a.style.cssFloat  = image.style.cssFloat;
					a.style.styleFloat  = image.style.styleFloat;
					a.style.align  = image.style.align;
					a.style.margin  = image.style.margin;
					a.rel="imagebox-bw";
					//a.className="lb";
					a.title = image.alt;
					//a.onclick = function () {myLightbox.start(this); return false;}
					
					var pix=document.createElement("IMG");
					pix.src=src;
					pix.alt=image.alt;

					a.appendChild(pix);
					
					image.parentNode.replaceChild(a, image);
			
			}
		}
		$.ImageBox.init(
			{
				loaderSRC: '/themes/pixnlov/gfx/imagebox/loading.gif',
				closeHTML: '<img src="http://www.pixnlov.com/themes/pixnlov/gfx/imagebox/bt-close.gif" />'
			}
		);
}


function manageTab(){
	var myUrl = window.location.href;
	var tabLnk = $("#mainMenu li a");
	for (var i=0; i<tabLnk.length; i++){
		var lnk = tabLnk[i];
		if (myUrl.indexOf(lnk.href) != -1){
			$(lnk).addClass("selected");
			return true;
		}
	}
	
}
function customLnk(){
$(".topnav-arch a").empty();
$("#contact a").empty();
}
function checkIE(){
	var IE6 = false, IE7 = false,
	FIREFOX2 = false, FIREFOX = false,
	NETSCAPE7 = false, NETSCAPE = false,
	OPERA9 = false, OPERA = false,
	AUTRE = false;
	var strChUserAgent = navigator.userAgent;
	var intSplitStart = strChUserAgent.indexOf("(",0);
	var intSplitEnd = strChUserAgent.indexOf(")",0);
	var strChStart = strChUserAgent.substring(0,intSplitStart);
	var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd);
	var strChEnd = strChUserAgent.substring(strChEnd);
	
	if(strChMid.indexOf("MSIE 7") != -1)
	IE7 = true;
	//alert("fuck");
	else if(strChMid.indexOf("MSIE 6") != -1)
	IE6 = true;
	else if(strChEnd.indexOf("Firefox/2") != -1)
	FIREFOX2 = true;
	else if(strChEnd.indexOf("Firefox") != -1)
	FIREFOX = true;
	else if(strChEnd.indexOf("Netscape/7") != -1)
	NETSCAPE7 = true;
	else if(strChEnd.indexOf("Netscape") != -1)
	NETSCAPE = true;
	else if(strChStart.indexOf("Opera/9") != -1)
	OPERA9 = true;
	else if(strChStart.indexOf("Opera") != -1)
	OPERA = true;
	else
	AUTRE = true;
}



$(document).ready(function(){
//checkBando();
checkMenu();
manageImg();
manageTab();
setAlpha();
open_ext_link();
customLnk();
checkIE();
//if($.browser.msie) { $( function() { alert("fuck"); } ); }
});