//AJAX

function modif_recap_prod(id_prod_,tab_ids)
	{

	//reini
	document.getElementById('visuel_recap_prod').src='';
	document.getElementById('text_recap_prod').innerHTML='';
	document.getElementById('lien_recap_prod').innerHTML='';
	document.getElementById('lien_recap_prod').href='';


	modif_effet(id_prod_,'visuel',tab_ids);
	modif_effet(id_prod_,'texte',tab_ids);
	modif_effet(id_prod_,'intitule_btn',tab_ids);
	modif_effet(id_prod_,'lien_btn',tab_ids);

	}

function modif_effet(id_prod_,koi_,tab_a_splitter_ids_)
	{
	
	
	var chemin     = './upload/visuels';
	//chemin=	'../../upload/documents';

	var data     = null;	
	data = 'id_prod='+id_prod_+'&koi='+koi_;
	
	var xhr_object = null;
	if(window.XMLHttpRequest)
		{ // Firefox
			xhr_object = new XMLHttpRequest();
		}
	else if(window.ActiveXObject)
		{ // Internet Explorer
			xhr_object = new ActiveXObject('Microsoft.XMLHTTP');
		}
	var method = 'POST';
	//var filename = 'http://ns203699.ovh.net/~unico/alting.php';
	var filename = 'ajax_recap_prod.php';

	xhr_object.open(method, filename, true);
	xhr_object.onreadystatechange = function()
		{
			if(xhr_object.readyState == 4)
			{
				var tmp = xhr_object.responseText;

				/*
				for(var i = 0, l = document.getElementsByTagName('img').length; i < l; i++) 
					{
						if(document.getElementsByTagName('img').item(i).getAttribute('alt')=='') 
							{
							document.getElementsByTagName('img').item(i).setAttribute('alt', tmp);
							};
					};
				*/

				
				if(koi_=='visuel')
					{
					document.getElementById('visuel_recap_prod').src=chemin+'/'+tmp;
					}
				if(koi_=='texte')
					{
					document.getElementById('text_recap_prod').innerHTML=tmp;
					}
				if(koi_=='intitule_btn')
					{
					document.getElementById('lien_recap_prod').innerHTML=tmp;					
					}
				if(koi_=='lien_btn')
					{
					document.getElementById('lien_recap_prod').href=tmp;
					}
				
			}
		}
	xhr_object.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); 
	xhr_object.send(data);

	var ids=tab_a_splitter_ids_.split('*');
	if(koi_=='lien_btn')
		{
		//onglets off/on
		for (var i=0; i<ids.length; i++)
			{
			var id_onglet_='onglet_recap_prod'+ids[i];
			
			if(ids[i]!='')
				{			
				if(id_prod_==ids[i])
					{document.getElementById(id_onglet_).setAttribute((document.all ? 'className' : 'class'), 'menu_on');
					document.getElementById(id_onglet_).style.width='116px';
					}				
				else{document.getElementById(id_onglet_).setAttribute((document.all ? 'className' : 'class'), 'menu_off');
					document.getElementById(id_onglet_).style.width='101px';		
					}
				}
			}
		}		
	
	}


function show_detail(id,max_) 
		{		
		var d = document.getElementById(id);
		
		for(j=1;j<=max_;j++)
			{if (document.getElementById('detail'+j+'_prod')) 
				{document.getElementById('detail'+j+'_prod').style.display='none';
				if (document.getElementById('detail'+j)) 
					{
					document.getElementById('detail'+j).setAttribute('className', 'onglet_off bold');
					document.getElementById('detail'+j).setAttribute('class', 'onglet_off bold');				
					}
				}
			}
		
		var actu=id.substr(0, 7);

		if (d) {d.style.display='block';
			document.getElementById(actu).setAttribute('className', 'onglet_on bold');
			document.getElementById(actu).setAttribute('class', 'onglet_on bold');
			}
			
		}

function show_detail2(id,max_) 
		{		
		var d = document.getElementById(id);
		
		for(j=1;j<=max_;j++)
			{if (document.getElementById('detail'+j+'_prod')) 
				{document.getElementById('detail'+j+'_prod').style.display='none';
				document.getElementById('detail'+j).setAttribute('className', 'onglet_off2 bold');
				document.getElementById('detail'+j).setAttribute('class', 'onglet_off2 bold');
				}
			}
		
		var actu=id.substr(0, 7);

		if (d) {d.style.display='block';
			document.getElementById(actu).setAttribute('className', 'onglet_on2 bold');
			document.getElementById(actu).setAttribute('class', 'onglet_on2 bold');
			}
			
		}

function show_detail3(id,max_) 
		{		
		var d = document.getElementById(id);
		
		for(j=1;j<=max_;j++)
			{if (document.getElementById('detail_prod'+j)) 
				{document.getElementById('detail_prod'+j).style.display='none';
				document.getElementById('detail'+j).setAttribute('className', 'menu_off');
				document.getElementById('detail'+j).setAttribute('class', 'menu_off');
				}
			}
		
		var actu=id.substr(11, 12);

		if (d) {d.style.display='block';
			document.getElementById('detail'+actu).setAttribute('className', 'menu_on');
			document.getElementById('detail'+actu).setAttribute('class', 'menu_on');
			}
			
		}

function show2(id,max_) 
		{		
		var d = document.getElementById(id);
		
		for(j=1;j<=max_;j++)
			{if (document.getElementById('cadre'+j+'_encart')) 
				{document.getElementById('cadre'+j+'_encart').style.display='none';
				document.getElementById('cadre'+j).setAttribute('className', 'onglet_off bold');
				document.getElementById('cadre'+j).setAttribute('class', 'onglet_off bold');
				
				}
			}
		
		var actu=id.substr(0, 6);
//alert(actu);
		if (d) {d.style.display='block';
			document.getElementById(actu).setAttribute('className', 'onglet_on bold');
			document.getElementById(actu).setAttribute('class', 'onglet_on bold');

			}
			
		}


function show3(id,max_, more_param) 
{
	max_ = 5;
	for(j=1;j<=max_;j++)
	{
		$("detail"+j).className = "onglet_off";
	}
	
	$("detail"+id).className = "onglet_on";
	
	var p = {rating: id};
	if(more_param != undefined)
	{
		for(var i in more_param)
		{
			p[i] = more_param[i];
		}
	}
	//close_dialog();
	
	
	
	//if($("rating-action")) $("rating-action").innerHTML = "";
	
	//setChargement()
	
/*	new Ajax.Request( base_url + '/rating_.php',{
		method:'post',
		parameters: p,
		onComplete: function(requester){
			
			ajax = false;
			continue_attentente = false;
			$("rating-msg").setStyle({display: "block"});
			$("rating-action").replace("<div id='rating-action'>"+requester.responseText+"</div>");
			update_search_forms(base_url + '/rating_.php', id);
			setDebug(base_url + '/rating_.php', id);
			
	}});*/

	var chemin     = './upload/visuels';
	//chemin=	'../../upload/documents';

	var data     = null;	
	data = 'id_onglet=9';
	
	var xhr_object = null;
	if(window.XMLHttpRequest)
		{ // Firefox
			xhr_object = new XMLHttpRequest();
		}
	else if(window.ActiveXObject)
		{ // Internet Explorer
			xhr_object = new ActiveXObject('Microsoft.XMLHTTP');
		}
	var method = 'POST';
	var filename = 'http://ns203699.ovh.net/~europerf/contenu_rating45.php';
	//var filename = 'contenu_rating45.php';

	xhr_object.open(method, filename, true);
	xhr_object.onreadystatechange = function()
		{
			if(xhr_object.readyState == 4)
			{
				var tmp = xhr_object.responseText;
				//document.getElementById('rating-action').innerHTML=tmp;
				//$("rating-msg").setStyle({display: "block"});
				$("rating-action").setStyle({display: "block"});	
				$("rating-action").replace("<div id='rating-action'>"+tmp+"</div>");						
			}
		}
	xhr_object.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); 
	xhr_object.send(data);

}

function valid_supp(tab_a_splitter_ids_)
	{
	//alert('supp');
/*
	var ids=tab_a_splitter_ids_.split('*');

	for (var i=0; i<ids.length; i++)
			{

			}
	alert(ids[1]);
*/
 document.panier.submit();
	}

function reload()
	{
location.reload();
	}



function paiement_go()
	{
document.PaymentRequest.submit();
	}

function post_chq_vir() 
	{
	document.location='index.php?supp_panier';
	}
