function writeFlash(chemin,width,height) {
	document.write("<object type=\"application/x-shockwave-flash\" data=\""+chemin+"\" width=\""+width+"\" height=\""+height+"\"><param name=\"movie\" value=\""+chemin+"\" /></object>");
}

function slide(speed) {
	if (parseInt($('#innerBande').css('width')) > 494) {
		$('#innerBande').css('left', parseInt($('#innerBande').css('left')) + speed + 'px');	
		if (parseInt($('#innerBande').css('left')) > 0) $('#innerBande').css('left','0px');
		if (parseInt($('#innerBande').css('left')) + parseInt($('#innerBande').css('width')) < 494) $('#innerBande').css('left',494 - parseInt($('#innerBande').css('width')) + 'px');
	}	
}

function attachEvent(){	
	$('#navBande').mouseover(function(e) {
		if(!document.all) {
			speed = - Math.round((e.pageX - 185 - 247)/50);
		} else {
			speed = - Math.round((event.x - 247)/50);
		}
		clearInterval(slideTimer);
		slideTimer = setInterval('slide('+ speed +')',20);
		return true;
	});	
	$('#navBande').mouseout(function(e) {
		clearInterval(slideTimer);
		return true;
	});	
	$('#innerBande > a > img').mouseover(function () {
		$(this).css('opacity','1');
		$(this).css('filter','alpha(opacity=100)');
	});	
	$('#innerBande > a > img').mouseout(function () {
		$(this).css('opacity','0.7');
		$(this).css('filter','alpha(opacity=70)');
	});
}

function applyGalery() {
	//$(function (){
		slideTimer = null;
		$('#innerBande > a > img').css('opacity','0.7');
		$('#innerBande > a > img').css('filter','alpha(opacity=70)');
		i = 0;
		$('#innerBande > a').each(function() {i++;});
		$('#innerBande').css('width',i*63+'px');
		$('#innerBande').css('left','0px');		
		attachEvent();
	//});
}

$(function (){
	
	$('#addToFav').click(function () {
		if ( navigator.appName != 'Microsoft Internet Explorer' ) {
			window.sidebar.addPanel("http://www.adobuzz.com/","Adobuzz.com - l'actu des ados qui buzz","");
		}	else {
			window.external.AddFavorite("http://www.adobuzz.com/","Adobuzz.com - l'actu des ados qui buzz");
		}
		return false;
	});
	
	$('#startPage').click(function () {
		 this.style.behavior='url(#default#homepage)';
		 this.setHomePage('http://www.adobuzz.com/');		 
		return false;
	});
	
});