 function body_onload(){	
	goPPage = new PPage(this.document);

		oPForm= new PForm('Boletin');
		/*oPForm.createTitle("title");
		oPForm.setTitle('Registro Boletin');*/
		oPForm.setDataSource('Usuarios/Boletin.php');
		oPForm.stateEvent=StateEvent;
			
	//Zona del formulario
	
        var texto=document.createElement("div");
        texto.setAttribute("id","informacion");
        texto.innerHTML="Subscribete y recibirás en tu correo los conciertos que se celebrarán en tu provincia.";
        document.getElementById("Zona_Login_Cab").appendChild(texto);
        
        oTextBox=new PTextBox('Email');
		oTextBox.setMask('');
		oTextBox.setIsRequired(true);
		oTextBox.setLabel('Email');
		oTextBox.setDataMember('Email');
		oPForm.addFieldDOM(oTextBox);
        
		oComboBox=new PComboBox('Provincia');
		oComboBox.setLabel('Provincia');
		oComboBox.setIsRequired(true);
		oComboBox.setDataSource('Musica/AddProvincias.php');
		oComboBox.setDataMember('Provincia');
		oPForm.addFieldDOM(oComboBox);
		oComboBox.dataLoad();
	

		oComboBox=new PComboBox('Periodo');
		oComboBox.setLabel('Periodo');
		oComboBox.setIsRequired(true);
		oComboBox.setDataMember('Periodicidad');
		oPForm.addFieldDOM(oComboBox);
		oComboBox.Items.add("S","Semanal");
		oComboBox.Items.add("Q","Quincenal");
		oComboBox.Items.add("M","Mensual");		
		

	    /*var oHr=document.createElement('hr');
		document.getElementById('Cen_Cuerpob').appendChild(oHr);*/
		var oPAction=new PAction("Insertar");
		oPAction.setValue("Registrarme");
		oPAction.setMethod("Insertar");
		oPAction.setWidth("120px");
		oPAction.setHeight("25px");
		oPAction.method=AltaBoletin;
		oPForm.addActionDOM(oPAction);
		
		/*var texto=document.createElement("div");
   		texto.setAttribute("id","informacion");
    	texto.innerHTML="Para cualquier problema contacte con el Equipo de Izonia <a href='mailto:"+mailInfo+"'>("+mailInfo+")</a>";
	    document.getElementById("Cen_Cuerpob").appendChild(texto);
	*/
	
        //document.getElementById("Cen_Cuerpob_Insertar_Button").onclick=Registrame;
}
 
 
function AltaBoletin(){
	
	var ok=goPPage.getForm("Boletinb").insert();
	if (ok==1){
		alert("Tu suscripción al Boletín de Conciertos de Izonia ha sido realizada, comprueba tu email.");
		document.location="index.php";
	}else{
		alert("Ha ocurrido un error, intentelo de nuevo. Si el error persiste comuniquenoslo a info@izonia.com");
	}
	
} 
 
function StateEvent(Sender,Args){
		 switch(Args.stateNumber){
		 		case 1:
					 Args.stateMessage="Has sido registrado";
					 break;
				default:
					 Args.stateMessage="Se producio algún error.";
					 break;
		}
}
 
 
 
 
 
 
 
 
 
 
 
 /*function Subscripicion_Boletin(accion){
   	
	 Email = document.frmlogin.Email.value;
	 Provincia=document.frmlogin.DirProvinciasId.value;
 	 Periodicidad = document.frmlogin.Periodicidad.value;
	 sEnv="accion="+accion+"&Email="+Email+"&Provincia="+Provincia+"&Periodicidad="+Periodicidad;
	 
//	 alert sEnv;
     
     var oResponse=null;
     ajax=PAjax();
   
     ajax.open("POST", "Usuarios/Boletin.php",false);   
          
     ajax.onreadystatechange=function() {  
	     if (ajax.readyState==4) {    
           	 oResponse = ajax.responseText;	              	
       	}
   
	}
                    	
    ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");     
    //enviando los valores     
    ajax.send(sEnv);  
    
    return oResponse;
} */
