/*
#########################################################################################################################
#########################################################################################################################
######## Back office Art du Papier :: http://www.artdupapier.fr :: 2006 by Nicolas Lauzel http://www.lauzel.com #########
#########################################################################################################################
#########################################################################################################################
#### Javascripts
#########################################################################################################################
*/
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function valid(ask, url)
{
	if (window.confirm(''+ask+''))
	{
		location.href=''+url+'';return true;
	} else {
		return false;
	}	
}
function adprw()
{
	var str = document.getElementById('nom').value;
	var str=str.replace(/[éèêë]/g,"e");
	var str=str.replace(/[àâä]/g,"a");
	var str=str.replace(/[ ]/g,"-");
	var str=str.replace(/[ç]/g,"c");
	var str=str.replace(/[()!€$.,'":=_;]/g,"-");
	var str=str.replace("undefined","-");
	while (str.match("--"))
	{
		var str=str.replace("--","-");
	} 
		document.getElementById('rw').value=str.toLowerCase();
	
}
function pdtrw()
{
	if (document.getElementById('marque').value != "") { var str= document.getElementById('marque').value; }
	if (document.getElementById('typeformat').value != "") { var str=""+str+"-"+document.getElementById('typeformat').value+""; }
	if (document.getElementById('forme').value != "") { var str=""+str+"-"+document.getElementById('forme').value+""; }
	if (document.getElementById('formatx').value != "") { var str=""+str+"-"+document.getElementById('formatx').value+""; }
	if (document.getElementById('formaty').value != "") { var str=""+str+"x"+document.getElementById('formaty').value+""; }
	if (document.getElementById('couleur').value != "") { var str=""+str+"-"+document.getElementById('couleur').value+""; }
	if (document.getElementById('typepapier').value != "") { var str=""+str+"-"+document.getElementById('typepapier').value+""; }
	if (document.getElementById('grammage').value != "") { var str=""+str+"-"+document.getElementById('grammage').value+"g"; }
	if (str == null)
	{
		alert('Marque, Type de format, Forme, Format X, Format Y, couleur, Type de Papier et Grammage son vides.');	
	} else {
		
		var str=str.replace(/[éèêë]/g,"e");
		var str=str.replace(/[àâä]/g,"a");
		var str=str.replace(/[ ]/g,"-");
		var str=str.replace(/[ç]/g,"c");
		var str=str.replace(/[()!€$.,'":=_;]/g,"-");
		var str=str.replace("undefined","-");
		while (str.match("--"))
		{
			var str=str.replace("--","-");
		}
		document.getElementById('rw').value=str.toLowerCase();
	}
}


// fonction d'affichage de l'aide
function aide(txt,div) 
{
	if (txt != '')
	{
			document.getElementById(div).style.visibility="hidden";
			document.getElementById(div).style.height="0px";
			document.getElementById(div).style.width="0px";
			document.getElementById(div).height="0px";
	
			document.getElementById(div).style.visibility="visible";
			document.getElementById(div).style.height="250px";
			document.getElementById(div).style.width="250px";
			document.getElementById(div).height="250px";
			document.getElementById(div).innerHTML='<table width="250px" height="250px" style="padding:5px; background-image:url(str/adp_postitbg.gif);"><tr><td align="left" valign="top"><table width="100%"><tr><td align="left"><h1> Post-it</h1></td><td align="right"><a href="javascript:closediv(\'aide\');"><h1>fermer</h1></a></td></tr></table><a class="pi">'+txt+'</a></td></tr></table>';
	}
}
function closediv(div)
{
			document.getElementById(div).style.visibility="hidden";
			document.getElementById(div).style.height="0px";
			document.getElementById(div).style.width="0px";
			document.getElementById(div).height="0px";
}

function switchdiv(div) 
{
	var status = document.getElementById(div).style.visibility;
	if (status == "hidden")
	{ 
	
		document.getElementById(div).style.visibility="visible";
		document.getElementById(div).style.height="100%";
		document.getElementById(div).style.width="100%";
		document.getElementById(div).height="100%";
	}
	if (status == "visible")
	{ 
		document.getElementById(div).style.visibility="hidden";
		document.getElementById(div).style.height="0px";
		document.getElementById(div).style.width="0px";
		document.getElementById(div).height="0px";
	}
}
function addpdt()
{
	document.getElementById("addpdt").value="add";
}
function popup(link)
{
	 window.open("bo.popup.php"+ link +"", "popup", "width=500,height=650,scrollbars");
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function Envoie(Url) 
{ 
document.form1.method='post'; 
document.form1.target='_self'; 
document.form1.action=Url; 
document.form1.submit(); 
} 