
function change_page(formulaire,input_no_page,no_page_demandee)
{
	if (formulaire.flag_search)
		{formulaire.flag_search.value = "1";}
	input_no_page.value          = no_page_demandee;
	formulaire.submit();		
}

function setPointer(theRow, thePointerColor) 
{
  if (typeof(theRow.style) == 'undefined' || typeof(theRow.cells) == 'undefined') 
  {
    return false;
  }

  var row_cells_cnt = theRow.cells.length;
  for (var c = 0; c < row_cells_cnt; c++) 
  {
   theRow.cells[c].bgColor = thePointerColor;
  }

  return true;
} 

function checkEmail(adresse)
{
	var place = adresse.indexOf("@",1);
	var point = adresse.indexOf(".",place+1);

	if ((place > -1)&&(adresse.length >2)&&(point > 1))
		{return(true);}
	else
		{return(false);}
}

function limitTextarea(Target, max)
{
	StrLen = Target.value.length
	
	if (StrLen > max )
	{
		Target.value = Target.value.substring(0,max);
	}
}

function createRequestObject() {
	// find the correct xmlHTTP, works with IE, FF and Opera
	var xmlhttp;
	try {
  	xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch(e) {
    try {
    	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch(e) {
    	xmlhttp=null;
    }
  }
  if(!xmlhttp&&typeof XMLHttpRequest!="undefined") {
  	xmlhttp=new XMLHttpRequest();
  }
 	return  xmlhttp;
}

function sendRequestUpdatePhoto(id_article,id_photo) {
		
	try{
		http.open("GET", "./ajax/ajaxUpdatePhotoArticle.php?id_article="+id_article+'&id_photo='+id_photo, false);
	    http.setRequestHeader('Content-Type',  "text/xml");
		http.send(null);
		
		responseAjaxXml = http.responseXML.documentElement;	 
				
	  	var libelle     = responseAjaxXml.getElementsByTagName('libelle')[0].firstChild.nodeValue;
    	var photoSmall  = responseAjaxXml.getElementsByTagName('photoSmall')[0].firstChild.nodeValue;
    	var photoBig    = responseAjaxXml.getElementsByTagName('photoBig')[0].firstChild.nodeValue;
    	//var erreur      = responseAjaxXml.getElementsByTagName('erreur')[0].firstChild.nodeValue;
    
    	document.getElementById('div_legende_photo_'+id_article).innerHTML = libelle;
    	document.getElementById('photo_article_'+id_article).src = photoSmall;
    	//document.getElementById('link_photo_'+id_article).href = photoBig;		
    	document.getElementById('link_photo_'+id_article).href = 'show_photo.php?photo='+photoBig+'&legende='+libelle;		
    	document.getElementById('link_photo_'+id_article).target = '_blank';
	}
	catch(e){
		// caught an error
		alert('Problème lors de la récupération de la photo ('+e.message+').');
	}
	finally{}
}

function testAjax()	{
	alert(http.readyState);
	
}

function preloaderImagesCatalogue() 
{
	heavyImage = new Image(); 
	heavyImage.src = "./images/icone_ajouter_panier_wait.jpg";
	
	heavyImage = new Image(); 
	heavyImage.src = "./images/icone_ajouter_panier_on.jpg";	
}