function cherche (loc, data) {
	var content = document.getElementById(loc); 
	
	obj.open("POST", 'http://ec.geodis.com/espace/client/webservices/suivi/expeditionsSecurise.do'); 

	obj.onreadystatechange = function() { 
		if (obj.readyState == 4 && obj.status == 200) 
			content.innerHTML = obj.responseText; 
	}
	obj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
	obj.send(data); 
}

function display(element){
	document.getElementById(element).style.display = 'block';
}

function hide(element)
{
	document.getElementById(element).style.display = 'none';
}

function isNumeric(champ)
{
	if(isNaN(champ.value))
	{
		champ.value = champ.value.substring(0, champ.value.length-1);
	}
}

function swap(i){
	if (i == 'video'){
		document.getElementById('photo_produit').style.display = 'none';
		document.getElementById('video_produit').style.display = 'block';
	}
	else{
		document.getElementById('video_produit').style.display = 'none';
		document.getElementById('photo_produit').style.display = 'block';
		
		//on met à jour le numéro de la photo
		document.getElementById('photo_produit').src = document.getElementById('photo_produit').src.substring(0, document.getElementById('photo_produit').src.lastIndexOf('-') + 1)+i+document.getElementById('photo_produit').src.substring(document.getElementById('photo_produit').src.indexOf('_'));
	}
}

var sOnLoad = '';

function callSwf(location, swf, width, height, flashparam, param, bTransparent,href,title){
	code = '';
	
	if(href) code += '<a href="'+href+'" title="'+title+'">';
	
	code += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+width+'" height="'+height+'" '+param+'>'+
		'<param name="allowScriptAccess" value="sameDomain" />'+'<param name="movie" value="'+swf+'" />'+'<param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />';
	if(bTransparent==true)
		{
			code+= '<param name="wmode" value="transparent">';
		}
	if(flashparam)
		{
			code+= '<param name="flashvars" value="categorie='+flashparam+'">';
			code+='<embed src="'+swf+'?categorie='+flashparam+'"';
		} else 
			{
				code+='<embed src="'+swf+'"';
			}
	
	if(bTransparent==true)
		{
			code+= ' wmode="transparent"';
		}
	if(flashparam)
		{
			code+= ' flashvars="categorie='+flashparam+'"';
		}
	code+=' quality="high" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="compte_a_rebour" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" '+param+'></embed>'+'</object>';
	
	if(href) code += '</a>';
	
	sOnLoad = sOnLoad + "document.getElementById('"+location+"').innerHTML = '"+code+"'; ";
	
	window.onload = function(){eval(sOnLoad);};
}
/**
 * 
 * @param sBalise Type de champs [input,...]
 * @param sType type de l'element
 * @param sName nom de l'element
 * @param sId Identifiant de l element
 * @param sValue valeur de l'element
 * @return l'élément créé
 */
function addElementForm(sBalise,sType,sName,sId,sValue){
	
	var element = document.createElement(sBalise);
	element.setAttribute("type", sType);
	element.setAttribute("id", sId);
	element.setAttribute("name", sName);
	element.setAttribute('value', sValue);
	
	return element;
}
/**
 * Supprime une div en javascript
 * @param parentDiv Id parent
 * @param childDiv Id enfant
 * @return Supprime une div 
 */
function removeElement(parentDiv, childDiv){
    if (childDiv == parentDiv) {
        // alert("The parent div cannot be removed.");
    }
    else if (document.getElementById(childDiv)) {     
         var child = document.getElementById(childDiv);
         var parent = document.getElementById(parentDiv);
         parent.removeChild(child);
    }
    else {
       //  alert("Child div has already been removed or does not exist.");
         return false;
    }
}

