// JavaScript Document
function change_url(url){
        document.location.href=url;
}

function open_message_alerte(){
	window.open('message_alerte.php','Alerte','toolbar=no,status=no,resizable=no,width=300,height=300');
}

function cacher_montrer() {
	if(document.getElementById('warning').style.visibility = 'hidden'){
	setTimeout("document.getElementById('warning').style.visibility = 'visible';",750);
	}else{
	setTimeout("document.getElementById('warning').style.visibility = 'hidden';",750);
	}
}

function DisplayPages( nb ){
	if( nb != "" )	{
		document.F_DISPLAY.job.value = "changeNbItems";
		document.F_DISPLAY.submit();
	}
}

function DisplayPagesBottom( nb ){
	if( nb != "" )	{
		document.F_DISPLAY_BOTTOM.job.value = "changeNbItems";
		document.F_DISPLAY_BOTTOM.submit();
	}
}

function afficher(elem){
	document.getElementById(elem).style.display = "block";
}

function masquer(elem){
	document.getElementById(elem).style.display = "none";
}

function setFraisdePort(transporteur, frais_de_port){
	document.F_GOTO_COMMANDE.nom_transporteur.value   	= transporteur;
	document.F_GOTO_COMMANDE.frais_de_port.value 		= frais_de_port;	
}

function FormatPrice(price){

	if(price == "" || price == "undefined"){
		price = "00,00";
	}
	if(price.indexOf('.') != -1){
		price = price.replace('.',',');
	}
	if(price.indexOf('.') == -1 && price.indexOf(',') == -1){
		price += ",00";
	}
	if(price.indexOf(',') == ((price.length)-2) && price.indexOf('.') == -1){
		price += "0";
	}
	return price;
}
