// JavaScript Document

var tabs = 4;
function show_tab(id){
	for(i=1;i<=tabs;i++){
		obj = document.getElementById("tab"+i);
		menu_tab = document.getElementById("menu_tab"+i);
		if(i == id){
			obj.style.display = "block";
			menu_tab.className = "hover";
		}
		else{
			obj.style.display = "none";
			menu_tab.className = "";
		}
	}
}

function big_image(src, id){
	//alert(src + id + type)
	/*obj_big = document.getElementById('p_img1');
	html_big = obj_big.innerHTML;
	class_big = obj_big.className;
	
	obj_small = document.getElementById(id);
	html_small = obj_small.innerHTML;
	class_small = obj_small.className;
	
	//alert(class_big);
	
	obj_big.innerHTML = html_small;
	obj_small.innerHTML = html_big;
	if(class_big == 'swf') obj_small.innerHTML = html_big;
	else obj_small.innerHTML = html_big;*/
	
	
	arr = document.getElementById('p_img1').src.split("/");
	filename_big = arr[(arr.length-1)];
	url_big = "";
	for(i=0;i<(arr.length-1);i++){
		url_big += arr[i]+"/";
	}
	
	arr = src.split("/");
	filename_small = arr[(arr.length-1)];
	filename_small = filename_small.substring(6);
	url_small = "";
	for(i=0;i<(arr.length-1);i++){
		url_small += arr[i]+"/";
	}

	document.getElementById(id).src = url_big+"thumb_"+filename_big;
	document.getElementById('p_img1').src = url_small+filename_small;
}

/*function create_image(src, class, id){
	return '<img src="'+src+'" class="'+class+'" id="'+id+'" />';
}

function create_swf(src){
	return '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="570" height="240" title="swf"><param name="swf" value="'+src+'"><param name="quality" value="high"><embed src="'+src+'" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="570" height="240"></embed></object>';
}*/

function faq_answer(id){
	if( document.getElementById(id).style.display == "block") document.getElementById(id).style.display = "none";
	else document.getElementById(id).style.display = "block";
}

function table_lines(id, c_impair, c_pair, t_impair, t_pair){
	var myTable = $$('#' + id + ' table');
	
	myTable.setStyle('width','100%');
	var odd = $$('#' + id + ' table tr').filter(function(item, index) {
        return index % 2 == 0;
});
	var even = $$('#' + id + ' table tr').filter(function(item, index) {
			return index % 2 == 1;
	});
	//$$('#' + id + ' table tr td').setStyle('background-color','transparent');
	$(odd).getElements('td').setStyles({
		backgroundColor : c_pair,
		color : t_pair
	});
	$(even).getElements('td').setStyles({
		backgroundColor : c_impair,
		color : t_impair
	});
}
function table_lines_old(id, c_impair, c_pair, t_impair, t_pair){
	childs = document.getElementById(id).childNodes;
	
	for(i=0;i<childs.length;i++){
		if(childs[i].nodeName == 'TABLE'){
			childs[i].style.width = '100%';
			tbodys = childs[i].childNodes;
			
			for(j=0;j<tbodys.length;j++){
				if(tbodys[j].nodeName == 'TBODY'){
					lines = tbodys[j].childNodes;
					// LIGNES
					pair = true;
					for(k=0;k<lines.length;k++){
						if(lines[k].nodeName == 'TR'){
							lines[k].style.verticalAlign = "top";
							//application de la couleur sur la ligne
							if(!pair) lines[k].style.backgroundColor = c_impair;
							else lines[k].style.backgroundColor = c_pair;
							
							if(!pair) lines[k].style.color = t_impair;
							else lines[k].style.color = t_pair;
							
							if(pair) pair = false;
							else pair = true;
							
							// COLONNES
							colones = lines[k].childNodes;
							for(l=0;l<colones.length;l++){
								//alert(colones[l].nodeName);
								if(colones[l].nodeName == 'TD'){
									colones[l].style.width = '50%';
								}
							}
						}
					}
				}
			}
		}
	}
}
