function getCookieVal(offset)
{

var endstr=document.cookie.indexOf (";", offset);
if (endstr==-1) endstr=document.cookie.length;
return unescape(document.cookie.substring(offset, endstr)); 
}
function LireCookie(nom)
{

var arg=nom+"=";
var alen=arg.length;
var clen=document.cookie.length;
var i=0;
while (i<clen)
{

var j=i+alen;
if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
i=document.cookie.indexOf(" ",i)+1;
if (i==0) break;


}
return null; 
}

function EcrireCookie(nom, valeur)
{

var argv=EcrireCookie.arguments;
var argc=EcrireCookie.arguments.length;
var expires=(argc > 2) ? argv[2] : null;
var path=(argc > 3) ? argv[3] : null;
var domain=(argc > 4) ? argv[4] : null;
var secure=(argc > 5) ? argv[5] : false;
document.cookie=nom+"="+escape(valeur)+
((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
((path==null) ? "" : ("; path="+path))+
((domain==null) ? "" : ("; domain="+domain))+
((secure==true) ? "; secure" : "");

}


function PlaySound(url) {
/*
EcrireCookie("Son",Son.checked);
var ie4 = ((navigator.appVersion.indexOf("MSIE")>0) && (parseInt(navigator.appVersion) >= 4));
if(ie4 && Son.checked){
var w;
if(url == "beep"){
nbmusic = 4;
day = new Date();
z = day.getTime();
y = (z - (parseInt(z/1000,10) * 1000))/10;
x = parseInt(y/100*nbmusic,10) + 1;
if (x == (1));
w = "attentn.wav";
if (x == (2))
w = "beep.wav";
if (x == (3))
w = "bepbeep.wav";
if (x == (4))
w = "bouteille.wav";
}
else
{
w = url;
}
  document.all.sound.src = w;
  }
  else
  {
  Son.checked = false;
  }
  */
}


function positionne(){

var w;
var h;
	if (self.innerWidth)
	{
		w  = self.innerWidth;
		h  = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		w  =  document.documentElement.clientWidth;
		h  =  document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		w  = document.body.clientWidth;
		h  = document.body.clientHeight;
	}
	else return;
	
global.style.left = (w-840)/2;

if(global.style.left < 0){
global.style.left = 0;
}
EcrireCookie("global_left", global.style.left);

loading.style.visibility = "hidden";
global.style.visibility = "visible";

}


var ie4 = ((navigator.appVersion.indexOf("MSIE")>0) && (parseInt(navigator.appVersion) >= 4));
var count = 0, add = 10, ftimer,ftimer2,next=0,obj_old=0,objcont; 


function output(message,img) {


if(message != ""){
if(img != "noblink"){
PlaySound("beep");
}
if(img != "" && img != "noblink")
{
obj = eval(img);

img = img + "cont";
objcont = eval(img);
objcont.style.zIndex = 12;

obj.width = obj.width + 40;
obj.height = obj.height + 40;

}

if(ie4){
next = 1;
obj = eval("fader");
obj.innerHTML = "<font color=\"#0000AA\" face=\"MS Serif\" size=\"3\"><b>"+message+"</b></font>"; 



if((img == "noblink" && count == 100))
{
count = 100;
}
else
{
count = 0;
}


fader.style.filter = "Alpha(Opacity="+count+",FinishOpacity="+count+",style=1)"; 
ftimer = setTimeout("showtext()", 20);


}

else
{
obj = eval("fader");
obj.innerHTML = "<font color=\"#0000AA\" face=\"MS Serif\" size=\"3\"><b>"+message+"</b></font>"; 
}
}

else
{

if(img != "")
{
obj = eval(img);
img = img + "cont";
objcont = eval(img);
objcont.style.zIndex = 10;


obj.width = obj.width - 40;
obj.height = obj.height - 40;

}

if(ie4){
obj = eval("fader");
next = 0;
count = 100;
fader.style.filter = "Alpha(Opacity="+count+",FinishOpacity="+count+",style=1)";  

ftimer2 = setTimeout("hidetext()", 3000);
}
else
{
obj = eval("fader");
obj.innerHTML = "<font color=\"#0000AA\" face=\"MS Serif\" size=\"3\"></font>"; 
}

}
}

function showtext() {
if (ie4) {
add = 10;
count += add; 
if(count >= 100) {
count = 100; 
add = -10;
} 


if(count <= 0) {
count = 0;
add1 = 10;

}

fader.style.filter = "Alpha(Opacity="+count+",FinishOpacity="+count+",style=1)"; 
if(count != 0 && count != 100){
ftimer = setTimeout("showtext()", 30);
}
} 
}

function hidetext() {
if (ie4 && next == 0) {
add = -10;
count += add; 
if(count >= 100) {
count = 100; 
add = -10;
} 


if(count <= 0) {
count = 0;
add = 10;
obj = eval("fader");
obj.innerHTML =  "<font color=\"#0000AA\" face=\"MS Serif\" size=\"3\"></font>"; 
}

fader.style.filter = "Alpha(Opacity="+count+",FinishOpacity="+count+",style=1)"; 
if(count != 0 && count != 100 && next == 0){
ftimer2 = setTimeout("hidetext()", 60);
}
} 

}

function photo(pic)
{
var u = pic.src;
var l="no"; 

if(u.indexOf("http://127.0.0.1/www.ronde-des-fetes.asso.fr/",0) > -1){
l = u.substr(45,u.length);

}

if(u.indexOf("http://www.ronde-des-fetes.asso.fr/",0) > -1){
l = u.substr(35,u.length);

}

if(u.indexOf("http://www.ronde-des-fetes.asso.fr/php/",0) > -1){
l = u.substr(39,u.length);

}

if(l != "no"){
document.location = "photo.php?name=" + l;
}

}

function photo_small(pic)
{
var u = pic.src;
var l="no"; 

if(u.indexOf("http://127.0.0.1/www.ronde-des-fetes.asso.fr/",0) > -1){
l = u.substr(45,u.length);

}

if(u.indexOf("http://www.ronde-des-fetes.asso.fr/",0) > -1){
l = u.substr(35,u.length);

}

if(u.indexOf("http://www.ronde-des-fetes.asso.fr/php/",0) > -1){
l = u.substr(39,u.length);

}

var ext = l.substr(l.indexOf("_small")+6,10);

l= l.substr(0,l.indexOf("_small"));

l = l + ext;

if(l != "no"){
document.location = "photo.php?name=" + l;
}

}
