function home_page(obj)
	{
	if((navigator.appName.substring(0,3) == "Mic") && (parseInt(navigator.appVersion) >= 4))
		{
		obj.style.behavior='url(#default#homepage)';
		obj.setHomePage('http://www.asj13.asso.fr');}
	else
		{
		alert("Votre navigateur ne prend pas en charge cette fonction! Vous devez l'ajouter vous-même dans votre navigateur");}
	}

function favoris()
	{
	if(navigator.appName != 'Microsoft Internet Explorer')
		{
		window.sidebar.addPanel("Association de Shuaï-Jaio du XIIIeme","http://www.asj13.asso.fr","");
		}
	else
		{
		window.external.AddFavorite('http://www.asj13.asso.fr','Association de Shuaï-Jaio du XIIIeme');
		}
	}

function valid_search(frm)
	{
	if((frm.elements['q'].value == "Chercher sur le site")||(frm.elements['q'].value == "")) return false;
	return true;
	}


var win=null;
function openfenetre(mypage,myname,w,h,scroll,pos)
	{
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);
	}

function as()
	{
	function disableselect(e)
		{
		return false;
		}
	function reEnable()
		{
		return true;
		}
	document.onselectstart=new Function ("return false");
	if(window.sidebar)
		{
		document.onmousedown=disableselect;
		document.onclick=reEnable;
		}
	}

function click_droit()
	{
	var message="";
	function clickIE(){if (document.all) {(message);return false;}}
	function clickNS(e){if(document.layers||(document.getElementById&&!document.all)) {if (e.which==2||e.which==3) {(message);return false;}}}
	if(document.layers)
		{
		document.captureEvents(Event.MOUSEDOWN);
		document.onmousedown=clickNS;
		}
	else
		{
		document.onmouseup=clickNS;
		document.oncontextmenu=clickIE;
		}
	document.oncontextmenu=new Function("return false")
	}

/* Fonctions de slide */
function onload_slider(style_top)
	{
	window.clearInterval(mTimer1);
	mDiv = document.getElementById("list_img");
	mDiv.style.top = "-"+style_top+"px";
	window.clearInterval(mTimer1);
	}

function start_slide(force)
	{
	window.clearInterval(mTimer1);
	if(force)
		{
		mTimer1 = setInterval("slide('bas')", 20);
		}
	else
		{
		if(parseInt(tempX) < 390)
			{
			mTimer1 = setInterval("slide('haut')", 20);
			}
		else
			{
			mTimer1 = setInterval("slide('bas')", 20);
			}
		}
	}

function start_slide2(sens)
	{
	window.clearInterval(mTimer1);
	if(sens == "bas")
		{
		mTimer1 = setInterval("slide('bas')", 200);
		}
	else
		{
		mTimer1 = setInterval("slide('haut')", 200);
		}
	}

function stop_slide()
	{
	window.clearInterval(mTimer1);
	}

function slide(sens)
	{
	if (sens == "bas")
		{
		if(mDiv.id == "list_gal") mPosMinimum = mPosMinGal;
		if(mDiv.id == "list_img") mPosMinimum = mPosMinImg;
		if(parseInt(mDiv.style.top) < mPosMinimum)
			{
			window.clearInterval(mTimer1);
			}
		else
			{
			mDiv.style.top = parseInt(mDiv.style.top)-102+"px";
			}
		}
	else
		{
		if(parseInt(mDiv.style.top) > mPosMaximum)
			{
			window.clearInterval(mTimer1);
			}
		else
			{
			mDiv.style.top = parseInt(mDiv.style.top)+102+"px";
			}
		}
	}
	
//Checking du navigateur
var uAgent=navigator.userAgent;
var ns4 = (document.layers)? true:false;   //NS 4
var ie4 = (document.all)? true:false;   //IE 4
var dom = (document.getElementById)? true:false;   //DOM
var ope = uAgent.indexOf("Opera")>-1 && dom? true:false; // + OP5
var ie5 = (dom && ie4 && !ope)?true:false; // IE5
var ns6 = (dom && uAgent.indexOf("Netscape")>-1)? true:false; // + NS 6
var khtml = uAgent.indexOf("khtml")>-1? true:false; // + Konqueror
//alert("UserAgent: "+uAgent+"\nns4 :"+ns4+"\nie4 :"+ie4+"\ndom :"+dom+"\nie5 :"+ie5+"\nns6 :"+ns6+"\nope :"+ope+"\nkhtml :"+khtml);

//gestion des objets selon les navigateurs
function ob(id)
	{
	if (dom) obj = document.getElementById(id);
	else if (ie4) obj = document.all[id];
	else if (ns4) obj = document.anchors[id];
	else obj=false;
	return obj;
	}

Array.prototype.inArray=function(str){//on modifie l'objet Array
for(i=0; i< this.length; i++)if(this[i].toString()==str)return i;
return -1;
}
//On modifie l'objet String
String.prototype.exist=function(){return (this=="undefined"?false:true);};
//Opacité
function setOpacity(id,alpha,isObj)
	{
	if(!dom)return;
	var object = isObj?id:ob(id);
	if(String(typeof object.filters).exist())object.filters.alpha.opacity = alpha;
	else if(String(typeof object.style.opacity).exist()) object.style.opacity = (alpha/100);
	else if(String(typeof object.style.KhtmlOpacity).exist()) object.style.KhtmlOpacity = (alpha/100);
	else if(String(typeof object.style.MozOpacity).exist()) object.style.MozOpacity = (alpha/100);
	}
function getOpacity(id,isObj)
	{
	if(!dom)return;
	var object = isObj?id:ob(id), alpha=null;
	if(String(typeof object.filters).exist()) alpha = object.filters.alpha.opacity;
	else if(String(typeof object.style.opacity).exist()) alpha = object.style.opacity*100;//css3 propertie
	else if(String(typeof object.style.KhtmlOpacity).exist()) alpha = object.style.KhtmlOpacity*100;
	else if(String(typeof object.style.MozOpacity).exist()) alpha = object.style.MozOpacity*100;
	return alpha;
	}
// Fading
vit=5; //temps entre chaque addition d'opacité(+ petit -> + de qualité -> + dur pour le navigateur)
add=4; //valeur à additionner (idem)
nObj=0;

fadeObjects=new Object();
fadeTimers=new Object();
fadeIds=new Array();

function fade2(object, destOp)
	{
	if (!dom) return;
	if (object.toString().indexOf("[object")==-1)
		{
		setTimeout("fade2("+object+","+destOp+")",0);
		return;
		}
	alpha=getOpacity(object,true);
	index=fadeIds.inArray(object.id);
	if(index>-1)clearTimeout(fadeTimers[index]);
	else
		{
		index=nObj++;
		fadeIds[index]=object.id;
		}
	diff = destOp-alpha;
	direction=1;
	if (alpha > destOp)direction=-1;//de - en - opaque
	alpha+=direction * Math.min(direction*diff,add);//ajoute le + petit entre la diférence et add
	setOpacity(object,alpha,true);
	alpha=getOpacity(object,true);
	if (Math.round(alpha) != destOp)
		{
		fadeObjects[index]=object;
		fadeTimers[index]=setTimeout("fade2(fadeObjects["+index+"],"+destOp+")",vit);
		}
	return;
	}
