/***********************************************
* Scrollable Menu Links- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/
/***************************************************************************
 *   Copyright (C) 2008 by oscim   Project lossim                          *
 *   a@oscim.fr                                                            *
 *       [created : 11.07.2008, 23:42:14] @oscim                           *
Modifié pour comhedon sur projet lossim par @oscim
 ***************************************************************************/

 function montre(id) {
	if( id != null ) {
		if (document.getElementById) {
			document.getElementById(id).style.display="block";
		} else if (document.all) {
			document.all[id].style.display="block";
		} else if (document.layers) {
			document.layers[id].display="block";
		}
	}
}

function cache(id) {
	if (document.getElementById(id)) {
		document.getElementById(id).style.display="none";
	} else if (document.all && document.all[id] !=null && id !=null) {
		document.all[id].style.display="none";
	} else if (document.layers) {
		document.layers[id].display="none";
	}
}

function upload_ajax(id,funct,act,param,sortie) {
//  		var url = 'appel2.php';
		sortie= true;
		var pars = 'funct=' + funct +'&act=' + act + '&sortie=' + sortie + '&vars= ' + param  ;
        	var myAjax = new Ajax.Updater(id, url, {method:'post', postBody:pars,
				Success: function(){
				var element = getElementById(id);
				element.innerHTML = r.reponseText;
				setTimeout ("liens_ajax ()",300);
				},
				Failure:  function(){
				var ter = getElementById(id);
				ter.innerHTML = "Un problèmes à eu lieux lors du chargement de la gallerie . \n Merci de reouveller l'operation";
				setTimeout ("liens_ajax ()",300);
				},
				Complete:  function(){
				var ter = getElementById(id);
				ter.innerHTML = "En cours";
				setTimeout ("liens_ajax ()",300);
					}
				});
				setTimeout ("liens_ajax ()",300);
};


/* recup des image dans id*/
	var divglobal= document.getElementById('listing_img_rub');
	var liens_site = divglobal.getElementsByTagName('a') ;
	var image_site = divglobal.getElementsByTagName('img') ;

	var scroll_decal=((menuwidth+(marg_inter_img*2)) * nbr_img);
	var iedom=document.all||document.getElementById;
	var leftdircode='onclick="moveleft();"';
	var rightdircode='onclick="moveright()"';
	var actualwidth='';
	var cross_scroll, ns_scroll;
	var loadedyes=0;
	var mag='';
	var img='';
	lalarg=liens_site.length * (menuwidth+20);
	var menucontents='<nobr>';
		for (var i = 0 ; i < liens_site.length ; ++i) {
				var l = liens_site[i];
				img = image_site[i];

			menucontents += '<div style="float:left;height:'+menuwidth+'px; width:'+menuwidth+'px;  margin:0 '+marg_inter_img+'px; " ><a href="'+l.href+'" title="'+l.title+'" class="ajax" style="height:'+menuheight+'px" ><img  src="'+img.src+'" style="float:left;margin:2px;position:relative"/></a></div>';
		} /*max-height:'+(menuwidth-10)+'px;max-width:'+(menuwidth)+'px;*/
		menucontents += '</nobr>';


	divglobal.style.display = 'none';
	var objBody = document.getElementById('gallery');
	var obj_scroll = document.createElement("div");
	obj_scroll.setAttribute('id','scoll_menu');
	obj_scroll.style.display = 'block';
	obj_scroll.style.position = 'relative';
	obj_scroll.style.left = '0';
	obj_scroll.style.width = ( ((menuwidth+(marg_inter_img*2)) * nbr_img)+ (menuwidth_box_fleche*2) )+'px';
	obj_scroll.style.margin = '0 auto';
	obj_scroll.style.height = menuheight+'px';
// 	obj_scroll.style.top = '25px';
	obj_scroll.style.zIndex = '50';


	if (scrolldir=="reverse"){
		var tempswap=leftdircode;
		leftdircode=rightdircode;
		rightdircode=tempswap;
	}

obj_scroll.innerHTML ='<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:0;">'+menucontents+'</span>' ;

function fillup(){
		cross_scroll= document.getElementById? document.getElementById("test2") : document.all['test2'];
		cross_scroll.innerHTML= menucontents ;
		actualwidth=document.all? cross_scroll.offsetWidth : document.getElementById("temp").offsetWidth;
	loadedyes=1;
	setTimeout ("liens_ajax ()",300);
}




if (iedom||document.layers){

	var pos_flech_d=(( nbr_img* (menuwidth+(marg_inter_img*2)) )+menuwidth_box_fleche);
	var taille_view= ( nbr_img* (menuwidth+(marg_inter_img*2)) );
	with (document){
		obj_scroll.innerHTML +='<div  style="">' + '<div  style="position:absolute;top:0; left:0px; width:'+menuwidth_box_fleche+'px; height:'+menuheight+'px; " '+rightdircode+' ><a href="#" '+rightdircode+'><div class="gradualfader" style="height:'+menuheight+'px; padding-top:'+padd_top_fleche+'px"><img src="'+goleftimage+'.jpg" onmouseover="this.src=\''+goleftimage+'_s.jpg\'" onmouseout="this.src=\''+goleftimage+'.jpg\'" border=0></div></a> </div>' +'';
		obj_scroll.innerHTML +='<div style="position:absolute;width:'+taille_view+'px; height:'+menuheight+'px; overflow:hidden; top:0; left:20px;">'+'<div id="test2" style="position:absolute;left:-0px;top:0; width:'+lalarg+'px; height:'+menuheight+'px;">'+'</div></div>';
		obj_scroll.innerHTML +=''+'<div  style="position:absolute;top:0; left:'+pos_flech_d+'px; width:'+menuwidth_box_fleche+'px; height:'+menuheight+'px;" '+leftdircode+'> <a href="#" '+leftdircode+' >'+'<div class="gradualfader" style="height:'+menuheight+'px; padding-top:'+padd_top_fleche+'px"><img class="gradualfader" src="'+gorightimage+'.jpg" border=0></div></a>'+'</div></div>';

		objBody.insertBefore(obj_scroll, objBody.firstChild);
	}
}



function moveleft(){
	if (loadedyes){
	if (iedom&&parseInt(cross_scroll.style.left)>(0-(lalarg-(scroll_decal))))
		var dec=(parseInt(cross_scroll.style.left)+(0-scroll_decal))+"px";
		if (dec>=lalarg) dec=lalarg-20;
		cross_scroll.style.left=dec;
	}
}

function moveright(){
	if (loadedyes){
		if (iedom&&parseInt(cross_scroll.style.left)<0)
			cross_scroll.style.left=parseInt(cross_scroll.style.left)+scroll_decal+"px";
	}
}

