function AdminDeleteAlert(url,str) {
	if(confirm(str)) 
		OpenURL(url);
}

function DeleteAlert(str,url) {
	if(confirm(str)) 
		OpenURL(url);
}

function ConfirmAlert(str,url) {
	if(confirm(str)) 
		OpenURL(url);
}

function OpenProject(url) {
	document.location.href=url;
}

function OpenURL(url) {
	document.location.href=url;
}

function ChangeProfile(url,theForm) {
	url=url+'?userId='+theForm.userId[theForm.userId.selectedIndex].value;
	document.location.href=url;
}

function OpenURLNewDoc(url) {
	window.open(url,'doc');
}

function ConfirmAlert(str,url) {
	if(confirm(str)) 
		OpenURL(url);
}

function ViewRec(url,theForm) {
//	url=url+'?viewRec='+theForm.recId[theForm.recId.selectedIndex].value;
	url=url+'&layoutId='+theForm.layoutId[theForm.layoutId.selectedIndex].value;
	document.location.href=url;
}

function MenuViewRec(url,theForm) {
	url=url+'?viewRec='+theForm.recId[theForm.recId.selectedIndex].value;
	document.location.href=url;
}

function EditRec(url,theForm) {
//	url=url+'?editRec='+theForm.recId[theForm.recId.selectedIndex].value;
	url=url+'&layoutId='+theForm.layoutId[theForm.layoutId.selectedIndex].value;
	document.location.href=url;
}

function OpenURL(url) {
	document.location.href=url;
}

function ResizeImage(url,form) {
//	alert(form.imageSize.selectedIndex);
//	alert(form.imageSize[1].value);
//	alert(url+'&size='+form.imageSize[form.imageSize.selectedIndex].value);
	document.location.href=url+'&size='+form.imageSize[1].value;
}

function SelectImage(image,field) {
	form=MM_findObj('myForm');
	if(form)
		form.elements[field].value=image;
//	window.opener.document.myForm.elements[field].value=image;
//	window.close();
}

function SelectImage2(image,field) {
//	if(opener)
//		if(opener.document) {
//			if(opener.document.SelectImage) {
//				alert('ya');
//				opener.document.SelectImage(image,field);
//			}
			/*
			form=MM_findObj('myForm',opener.document);
			if(form)
				form.elements[field].value=image;
				*/
//		}
//	window.opener.document.forms["myForm"].elements[field].value=image;
	window.opener.document.myForm.elements[field].value=image;
//	window.close();
}

function changePrice(form,qt,price,field) {
	var i;
	var d;
	d=0;
	for(i=0 ; i<10 ; i++)
		if(qt>=quantity[i]) {
			d=discount[i];
			break;
		}
	newprice=Math.round((qt*price)-(qt*price*d/100));
	form.elements['price_'+field].value=newprice+',00';
	form.elements['disc_'+field].value=d;
}

function DatePrompt(date) {
	if(date=='')
		date='jj-mm-aa';
	date=prompt('Entrez une date',date);
	if(date=='jj-mm-aa')
		date='';
	return date;
}

function ViewRecId(url,theForm) {
	url=url+theForm.recId[theForm.recId.selectedIndex].value;
	document.location.href=url;
}

function incValue(field) {
	field.value++;
}

function decValue(field) {
	if(field.value>1)
		field.value--;
}

function srvc_containerChange(thisForm,id,selectStr) {
/*
	if(id==-1) {
		thisForm.id__mylib_projects__name.selectedIndex=1;
		alert('yop');
	}
*/
	thisForm.id__mylib_stylesheet__name.length=1;
	thisForm.elements['id__mylib_stylesheet__name'].options[0].text=selectStr;
	thisForm.elements['id__mylib_stylesheet__name'].options[0].value='*';
	for(i=0,id=1 ; i<stylesId.length ; i++)
		if(stylesProjectId[i]==thisForm.elements['id__mylib_projects__name'].options[thisForm.id__mylib_projects__name.selectedIndex].value) {
			thisForm.id__mylib_stylesheet__name.length=id+1;
			thisForm.elements['id__mylib_stylesheet__name'].options[id].text=stylesName[i];
			thisForm.elements['id__mylib_stylesheet__name'].options[id].value=stylesId[i];
			id++;
		}
}