function podClass(largeur, hauteur, bordure, menu_largeur, menu_transparence, menu_style) {
	this.pages = Array();
	this.menu = '';
	this.interval = null;
	for (i=1; i < 5; i++)
		if ( ! document.getElementById('pods_' + i) ) {
			this.nom = 'pods_' + i;
			break;
		}
	
	try {
		this.largeur = largeur;
		this.hauteur = hauteur;
		this.bordure = bordure;
		this.menu_largeur = menu_largeur;
		this.menu_transparence = menu_transparence;
		this.menu_style = menu_style;
	} catch(e) { alert('Il manque des paramītres.') }
}
podClass.prototype.ajouter_page = function (titre, photo, lien, texte) {
	var i = this.pages.length;
	var _pod = new Object();
	_pod.titre = titre;
	_pod.data = '<div style="position:absolute; width:'+ this.largeur +'px; height:'+ this.hauteur +'px; background-image:url('+ photo +'); text-align:left; top:0px; left:'+ (i * this.largeur) +'px;">';
	_pod.data += '<div style="position:absolute; width:'+ (this.largeur - this.menu_largeur) +'px; height:'+ this.largeur +'px; top: 0px; left:0px; cursor:pointer;" onclick="document.location=\''+ lien +'\'">' + texte + '</div>';
	_pod.data += '</div>';
	this.pages[i] = _pod;
}
podClass.prototype.faire_menu = function () {
	tr1 = this.menu_transparence;
	tr2 = this.menu_transparence / 100;
	if (document.all) ie_filter = 'filter:alpha(opacity='+ tr1 +');';	else ie_filter = '';
	this.menu = '<div style="position:absolute; vertical-align:middle; padding-top:7px; line-height:18px; width:'+ this.menu_largeur +'px; height:'+ (this.hauteur - 7) +'px; top:0px; left:'+ (this.largeur - this.menu_largeur) +'px; background-color:#333333; ' + ie_filter + ' opacity: '+ tr2 +'; -moz-opacity:'+ tr2 +';">';
	for (_i=0; _i < this.pages.length; _i++)
		this.menu += '<div id="pod_titre_'+ _i +'" class="'+ this.menu_style +'" style="padding:5px; cursor:pointer;" onclick="scrollPod(\''+ this.nom +'\', '+ (_i * this.largeur) +', '+ _i +',1);">'+ this.pages[_i].titre +'</div>';
	this.menu += '</div>';
}
podClass.prototype.generer = function () {
	document.write( '<div style="position:relative; text-align:left; width:'+ this.largeur +'px; height:'+ (this.hauteur) +'px; overflow:hidden; border:'+ this.bordure +'">' );
		document.write( '<div id="'+ this.nom +'" style="position:absolute; width:'+ this.largeur +'px; height:'+ this.hauteur +'px; overflow:hidden;">' );
		for (_i=0; _i < this.pages.length; _i++)
			document.write( this.pages[_i].data );
		document.write( '</div>' );
		document.write( this.menu );
	document.write( '</div' );
	document.getElementById('pod_titre_0').style.color = '#D43333';
//	this.interval = setInterval( "pod.auto();", 6000 );
}
podClass.prototype.auto = function () {
	if ( pod_actif >= this.pages.length-1 ) p_a = 0;
	else p_a = pod_actif + 1;
	scrollPod( this.nom , (p_a * this.largeur), p_a, 0 );
}
podClass.prototype.auto_stop = function () {
	clearInterval(this.interval);
}

var drapeau_pod = false;
var pod_actif = 0;
function scrollPod(obj, pos, pod, auto) {
	if ( document.getElementById(obj) ) {
		if (auto == 1) window.pod.auto_stop();
		drapeau_pod = true;
		scroll_pod2(obj, pos);
		
		document.getElementById('pod_titre_' + pod_actif).style.color = '';
		document.getElementById('pod_titre_' + pod).style.color = '#D43333';
		pod_actif = pod;
	}
}
function scroll_pod2(obj, pos) {
	if ( drapeau_pod == true ) {
		d = document.getElementById(obj);
		if ( pos < d.scrollLeft ) {
			if (d.scrollLeft - 40 < pos) d.scrollLeft = pos;
			else d.scrollLeft = d.scrollLeft - 30;
		}
		if ( pos > d.scrollLeft ) {
			if (d.scrollLeft + 40 > pos) d.scrollLeft = pos;
			else d.scrollLeft = d.scrollLeft + 30;
		}
		if ( d.scrollLeft < pos - 20 || d.scrollLeft > pos + 20 )
			setTimeout("scroll_pod2('" + obj + "', " + pos + ");", 20);
	}
}
