/*
Script posted and featured on JavaScript Kit
http://javascriptkit.com
*/

function display_image1(form) {
PreView = window.open("", "_blank", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=840,height=640");
PreView.document.open();
PreView.document.write("<HTML><HEAD>");
PreView.document.write("<TITLE>Preview</TITLE>");
PreView.document.write("</HEAD><BODY BGCOLOR=FFFFFF TEXT=000000>");
PreView.document.write("<FORM><CENTER><B><FONT SIZE=+1>" + form + "</FONT><HR></B>");
PreView.document.write("<IMG HSPACE=0 VSPACE=0 " + "SRC='img/" + form + "'>");
PreView.document.write("<FORM><HR><INPUT TYPE='button' VALUE='Close' " +
"onClick='window.close()'></FORM>");
PreView.document.write("</CENTER>");
PreView.document.write("</BODY></HTML>");
PreView.document.close();
    }

function changeimg(vtype, vval) {
	if (vtype=="BIG")
	  {document.images.show.src = "img/" + vval;}
	else
	  {document.images.show.src = "img/null.gif";};
}

function checkCategorySet() {
  if (document.insgep.tskcat.value==-1)
    {alert ('Categoria no definida...');
	 return false;
	}
  else
     return true;
}

function doPrint(){
    window.open('eprint.php?tskcat=' + personal.cat[personal.cat.selectedIndex].value, "print","width=720,height=500,scrollbars=YES")
} 

function setMessage(mid, mnom, mini) {
  dit1=document.getElementById('infotask1');
  dit2=document.getElementById('infotask2');
  dit3=document.getElementById('infotask3');
  dit1.innerHTML="id="+mid+"   <input type=hidden name=tskid value="+mid+"><input id=n1 type=text name=tsknom value=\""+mnom+"\" size=80%>";
  dit2.innerHTML="Data alta="+mini+"    <input type=submit value=Actualitza>";
  /* dit3.innerHTML=; */
  /* onclick=\"location.href='index.php?action=U&tskid=280&tsknom=\""+document.+"\"'\">"; */
}

function validaFormContribucio(valor) {
	el_1=document.getElementById('usrname_id');
	el_2=document.getElementById('usrlstname_id');
	el_3=document.getElementById('usremail_id');
	/*alert('el valor de LL9 es #' + el_1.value + '#');*/
	if (document.getElementById("condicions_id").checked != true) {
		alert('Heu d\'acceptar les condicions d\'us i privadesa');
		return false;
	}
	if ( (el_1.value == "") || (el_2.value == "") || (el_3.value == "") ) {
		alert('Falten dades');
		return false;
	}
	if ( valor != '50' ) {
		if ( document.getElementById('usrtel_id') == '' ) {
			alert ('Un telèfon és obligatori');
			return false;
		}
	}
	alert('Gracies '+el_1.value+', rebras un correu amb la confirmacio a la teva peticio');
	return true
}
