// functions.js
// www.deathwish-studio.fr

function display(id, idd) {
   if (document.getElementById(id).className == "boxbodyhidden") {
        	 document.getElementById(id).className = "boxbody";
			 document.getElementById(idd).className = "boxbottom";
      } else {
	document.getElementById(id).className = "boxbodyhidden";
	document.getElementById(idd).className = "boxbottomhidden";
 }
}

function displaybtn(id) {
   if (document.getElementById(id).name == 'max') {
	   		 document.getElementById(id).name = 'min';
			 document.getElementById(id).src = 'gfx/box-min.png';
			 document.getElementById(id).title = 'Reduire';
      } else {
			 document.getElementById(id).name = 'max';
		 	 document.getElementById(id).src = 'gfx/box-max.png';
			 document.getElementById(id).title = 'Agrandir';
   }
}

function checkform() {
	if (!checkfield('fieldlogin')) { document.getElementsByName('fieldlogin')[0].className = "login loginerror"; return false; }
	if (!checkfield('fieldpass')) { document.getElementsByName('fieldpass')[0].className = "pass passerror"; return false; }
	else { document.getElementsByName('loginform')[0].submit(); }
}

function checkpress(id, good, bad) {
	if (!checkfield(id)) { document.getElementsByName(id)[0].className = bad; }
	else { document.getElementsByName(id)[0].className = good;
	}
}

function checkfield(id) {
	if (document.getElementsByName(id)[0].value == '') {
		return false;
} else
	return true;
}

function deletepic(id) {
	if (confirm('Voulez-vous vraiment effacer cette image ?')) {
		document.location.href='./?delpic=' + id;
	}
}

function modifpic(id) {
		var caption = document.getElementsByName('fieldinfos')[id-1].value;
		document.location.href='./?modifpic=' + id + '&value=' + caption;
}

function popup(fname) {

		myPopup = window.open('./imgs/'+fname,'','toolbar=0,location=0,menubar=0,scrollbars=0,resizable=0');

}

