var ScrollLinks = {
	currentHash: false,
	start: function(){
		this.scroll = new fx.Scroll({duration: 1500, transition: fx.sineOut, onComplete: function(){this.end();}.bind(this)});
		this.allinks = $c(document.getElementsByTagName('a'));
		this.allinks.each(function(lnk){
			if ((lnk.href && lnk.href.indexOf('#') != -1) && ( (lnk.pathname == location.pathname) 
				|| ('../default.htm'+lnk.pathname == location.pathname) ) && (lnk.search == location.search)) {
				lnk.onclick = function(){
					ScrollLinks.scroll.clearTimer();
					this.initialHref = this.href;
					this.initialHash = this.hash;
					this.href = "javascript:void(0)";
					setTimeout(function(){this.href = this.initialHref;}.bind(this), 200);
					ScrollLinks.go(this);
				}
			}
		});
	},

	go: function(link){
		this.currentHash = link.initialHash.slice(1);
		if (this.currentHash) {
			this.allinks.each(function(lnk){
				if (lnk.id == ScrollLinks.currentHash){
					if (window.opera) lnk =  [lnk].find('parentNode');
					ScrollLinks.scroll.scrollTo(lnk);
					return;
				}
			});
		}
	},

	end: function(){
		if (!/Konqueror|Safari|KHTML/.test(navigator.userAgent)) window.location.hash = "#"+this.currentHash;
		this.currentHash = false;
	}
}
function ejs_nodroit()
{
	return(false);
}

//document.oncontextmenu = ejs_nodroit;

var isFlash = false;
// Pour tous navigateurs sauf IE
if (navigator.plugins && navigator.plugins.length > 0) 
{
	var pluginsArrayLength = navigator.plugins.length;
	// Pour chaque plugin du navigateur...
	for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) 
	{
		if(navigator.plugins[pluginsArrayCounter].name.indexOf("Shockwave Flash") >= 0)
		{ 
			// Si 1 des plugins contient Shockwave Flash
			isFlash = true; // Alors flash player OK 
			break;
		}
	}
}
function createRequestObject() 
{
	var ro;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){ro = new ActiveXObject("Microsoft.XMLHTTP");}
	else{ro = new XMLHttpRequest();}
	return ro;
}				
var http = createRequestObject();
	
function sndReq(code_promo) 
{
	document.getElementById('div_promo').innerHTML=' Chargement en cours ...';
	varDate = new Date();
	varDate=varDate.getSeconds();
	http.open('get','ajax/div_promo.php?code_promo='+code_promo+'&t='+varDate);
	http.onreadystatechange = handleResponse ;
	http.send(null);
}

function handleResponse() 
{
	if(http.readyState == 4)
	{
		var response = http.responseText;
		var update = new Array();
		
		if (response=='dommage')
		{
			alert('Erreur !');
			window.location='index.php';
			return false;
		}
		else
		{			
			document.getElementById('div_promo').innerHTML=response;
		}
	}
}