//#
function ver_lugares2(){
		//Nota esta funcion esta funcionando en dos partes del Admin 
		cadena=document.getElementById("subscription").value;
		jsrsExecute("../../include/remoting_lugares.php",end_ver_lugares2,"confirmar",cadena);
}
function end_ver_lugares2(result){
	document.getElementById("places").value=result;	
}
function ver_lugares(){
		//Nota esta funcion esta funcionando en dos partes del Admin 
		cadena=document.getElementById("subscription").value;
		jsrsExecute("../../include/remoting_lugares.php",end_ver_lugares,"confirmar",cadena);
}
function end_ver_lugares(result){
	document.getElementById("capa5").style.display = "block";
	document.getElementById("capa6").style.display = "block";
	document.getElementById("places").value=result;
	if (result==''){
	document.getElementById("capa5").style.display = "none";
	document.getElementById("capa6").style.display = "none";
	}	
}

function litar_user(){
		//Nota esta funcion esta funcionando en dos partes del Admin 
		cadena=document.getElementById("partnerId").value;
		jsrsExecute("../../include/remoting_partner.php",end_listar_user2,"confirmar",cadena);
}
function end_listar_user2(result){
	cadena=result.split("|");
	document.getElementById("capa1").innerHTML=cadena[0]; 
	document.getElementById("capa2").innerHTML=cadena[1]; 
	document.getElementById("capa3").innerHTML=cadena[2]; 
	document.getElementById("capa4").innerHTML=cadena[3]; 
	document.getElementById("capa").style.display = "block";
	if (cadena[0]=='' && cadena[1]==''){
		document.getElementById("capa").style.display = "none";
	}
	//document.getElementById("capa4").innerHTML=cadena[4]; 
	//alert(cadena[1]);
	
}
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_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_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 Permut (flag,img) {
   if (document.images) {
        if (document.images[img].permloaded) {
            if (flag==1) document.images[img].src = document.images[img].perm.src
            else document.images[img].src = document.images[img].perm.oldsrc
        }
   }
}
function preloadPermut (img,adresse) {
   if (document.images) {
        img.onload = null;
        img.perm = new Image ();
        img.perm.oldsrc = img.src;
        img.perm.src = adresse;
        img.permloaded = true;
   }
}


function load_vars($url){	
	//location.href='inscription.php?cbomark='+document.frm_insc.cbomark.value;
	//$Alert==0;
	document.frm_insc.action=$url
	document.frm_insc.submit();
}

function color(){
if(document.frm_insc.cboColor.value != 'Autre')
{ document.frm_insc.txtprecisez.disabled=true;

}

if(document.frm_insc.cboColor.value == 'Autre')
{ document.frm_insc.txtprecisez.disabled=false;
  document.frm_insc.txtprecisez.focus();
}

}
function IsNumeric(valor) 
{ 
var log=valor.length; var sw="S"; 
for (x=0; x<log; x++) 
{ v1=valor.substr(x,1); 
v2 = parseInt(v1); 
//Compruebo si es un valor numérico 
if (isNaN(v2)) { sw= "N";} 
} 
if (sw=="S") {return true;} else {return false; } 
} 


var primerslap=false; 
var segundoslap=false; 
function formateafecha(fecha) 
{ 
var long = fecha.length; 
var dia; 
var mes; 
var ano; 

if ((long>=2) && (primerslap==false)) { dia=fecha.substr(0,2); 
if ((IsNumeric(dia)==true) && (dia<=31) && (dia!="00")) { fecha=fecha.substr(0,2)+"/"+fecha.substr(3,7); primerslap=true; } 
else { fecha=""; primerslap=false;} 
} 
else 
{ dia=fecha.substr(0,1); 
if (IsNumeric(dia)==false) 
{fecha="";} 
if ((long<=2) && (primerslap=true)) {fecha=fecha.substr(0,1); primerslap=false; } 
} 
if ((long>=5) && (segundoslap==false)) 
{ mes=fecha.substr(3,2); 
if ((IsNumeric(mes)==true) &&(mes<=12) && (mes!="00")) { fecha=fecha.substr(0,5)+"/"+fecha.substr(6,4); segundoslap=true; } 
else { fecha=fecha.substr(0,3);; segundoslap=false;} 
} 
else { if ((long<=5) && (segundoslap=true)) { fecha=fecha.substr(0,4); segundoslap=false; } } 
if (long>=7) 
{ ano=fecha.substr(6,4); 
if (IsNumeric(ano)==false) { fecha=fecha.substr(0,6); } 
else { if (long==10){ if ((ano==0) || (ano<1900) || (ano>2100)) { fecha=fecha.substr(0,6); } } } 
} 

if (long>=10) 
{ 
fecha=fecha.substr(0,10); 
dia=fecha.substr(0,2); 
mes=fecha.substr(3,2); 
ano=fecha.substr(6,4); 
// Año no viciesto y es febrero y el dia es mayor a 28 
if ( (ano%4 != 0) && (mes ==02) && (dia > 28) ) { fecha=fecha.substr(0,2)+"/"; } 
} 
return (fecha); 
} 



function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
		// otherwise, update 'characters left' counter
 	else 
	countfield.value = maxlimit - field.value.length;
}

function validaForm(ruta){

var propControl = new Array();
debecontar=0;
contar=0;
validar=0;
vacios=0;
	for(var i=0; i<ruta.elements.length; i++){
		controlAct=ruta.elements[i];
		if(ruta.elements[i].title.indexOf("*")!=-1){//si existe * entonces valida datos del control actual
			propControl = ruta.elements[i].title.split("*");
			//alert(propControl[1]);
			if(propControl[1].indexOf("r")!= -1){//si es diferente de -1 entonces es un control requerido
				if(controlAct.value=="" || controlAct.value=="0"){
					alert("Le champ \""+propControl[0]+"\" est obligatoire");
					controlAct.focus();
					return false;
					break;
				}
			}
			if(propControl[1].indexOf("m")!= -1){//si es diferente de -1 entonces se debe validar el email
				if(emailCheck(controlAct.value)==0){
					alert("Votre email n'est pas valide");
					controlAct.focus();
					return false;
					break;
				}
			}
			if(propControl[1].indexOf("c")!= -1){
				debecontar=1;
				contar=contar+1;
				if(controlAct.value==""){
					vacios=vacios+1;
					if(contar==1){
						kontrol=controlAct;
						nombreKontrol=propControl[0];
					}
				}				
			}			
			if(propControl[1].indexOf("f")!= -1){
				if(checkDecimals(controlAct)==0){
					alert("Le champ "+propControl[0]+" ne doit pas contenir de caractères alphanumériques");
					controlAct.focus();
					controlAct.select();
					return false;
					break;
				}else{
					num=roundOff(controlAct.value, 2);
					//alert(num);
				}				
			}
			if(propControl[1].indexOf("p1")!= -1){//hay un "campo password"
				password1=controlAct.value;
			}
			if(propControl[1].indexOf("p2")!= -1){//hay un campo "repetir password"
				password2=controlAct.value;
				validar=1;
				ctrlRep=controlAct;
			}
			if(propControl[1].indexOf("chk")!= -1){//si es diferente de -1 indica que se debe hacer check
				if(controlAct.checked==false){
					alert("Le champ \""+propControl[0]+"\" est obligatoire");
					controlAct.focus();
					return false;
					break;
				}
			}
		}
	}
	if(validar==1){
		if(password1!=password2){
			alert('Vous n\’avez pas retapé correctement votre mot de passe');
			ctrlRep.focus();
			ctrlRep.select();
			return false;
		}
	}
	if(debecontar==1){
		if(contar==vacios){
			alert('Les champs "'+nombreKontrol+'" ne peuvent être vides ');
			kontrol.focus();
			return false;
		}
	}
}

function roundOff(value, precision){
value = "" + value //convert value to string
precision = parseInt(precision);
var whole = "" + Math.round(value * Math.pow(10, precision));
var decPoint = whole.length - precision;

	if(decPoint != 0){
		result = whole.substring(0, decPoint);
		result += ".";
		result += whole.substring(decPoint, whole.length);
	}else{
		result = whole;
	}
	return result;
}


function checkDecimals(fieldName) {
decallowed = 2;  // cuantos decimales se desea
fieldValue=fieldName.value;
	if(fieldValue.length>=1){
		if (isNaN(fieldValue) || fieldValue == "") {
			/*alert("OJO! No has introducido un numero. Vuelve a intentarlo");
			fieldName.select();
			fieldName.focus();*/
			return 0;
		}
		else {
			if (fieldValue.indexOf('.') == -1) 
				fieldValue += ".";
			dectext = fieldValue.substring(fieldValue.indexOf('.')+1, fieldValue.length);
	
			if (dectext.length > decallowed){
				/*alert ("OJO!! Introduce un numero con " + decallowed + " decimales.  Intentalo de nuevo.");
				fieldName.select();
				fieldName.focus();*/
				return 0;
	      	}else {
			//alert ("OK!! Numero correcto.");
			return 1;
	      	}
		}
	}else{
		return 1;
	}
}


function emailCheck (emailStr) {
	if(emailStr.length>=1){
		var emailPat=/^(.+)@(.+)$/
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
		var validChars="\[^\\s" + specialChars + "\]"
		var quotedUser="(\"[^\"]*\")"
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
		var atom=validChars + '+'
		var word="(" + atom + "|" + quotedUser + ")"
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
		
		var matchArray=emailStr.match(emailPat)
		if (matchArray==null) {
			return 0;
		}
		var user=matchArray[1]
		var domain=matchArray[2]
		
		if (user.match(userPat)==null) {
			return 0;
		}
	
		var IPArray=domain.match(ipDomainPat)
		if (IPArray!=null) {
			for (var i=1;i<=4;i++) {
				if(IPArray[i]>255){
					return 0;
				}
			}
			return 1;
		}
	
		var domainArray=domain.match(domainPat)
		if (domainArray==null) {
			return 0;
		}
		var atomPat=new RegExp(atom,"g")
		var domArr=domain.match(atomPat)
		var len=domArr.length
		if (domArr[domArr.length-1].length<2 || 
			domArr[domArr.length-1].length>3) {
		   return 0;
		}
	
		if (len<2) {
		   return 0;
		}
		
	}else{
		return 1;
	}

}

function checkAbonnement(origen){
	total=document.frmAbonnement.totAbonnement.value;
	totCheck=0;
	for(i=0;i<total;i++){
		if(document.getElementById("optAbonnement"+i).checked==false){
			totCheck++;
		}else{
			abonneId=document.getElementById("optAbonnement"+i).value;	
		}
	}
	if(total==totCheck){
		alert("Merci de bien vouloir choisir un abonnement");
		return false;
	}else{
		if(origen==1){
			if(document.frmAbonnement.txtCodepartner.value!=""){
				//cadena=document.frmAbonnement.txtCodepartner.value+","+abonneId;
				cadena=document.frmAbonnement.txtCodepartner.value;
				jsrsExecute("./include/check_abonnement.php",end_checkAbonnement,"confirmar",cadena);
			}else{
				document.frmAbonnement.submit();
			}
		}else{
			document.frmAbonnement.submit();
		}
	}
}
function end_checkAbonnement(cadena){
	if(cadena=="no"){
		alert("Code partenaire incorrect!!!")
		document.frmAbonnement.txtCodepartner.select();
		return false;
	}else if(cadena=="ok"){
		document.frmAbonnement.submit();
	}/*else{
		alert(cadena);	
	}*/
}
function checkAdmin(){
	if(document.getElementById("txtName").value==""){
		alert("Le champ \"Nom\" est obligatoire");
		document.getElementById("txtName").focus();
		return false;
	}
	if(document.getElementById("txtEmail").value==""){
		alert("Le champ \"Email\" est obligatoire");
		document.getElementById("txtEmail").focus();
		return false;
	}
	if(emailCheck(document.getElementById("txtEmail").value)==0){
		alert("Votre email n'est pas valide");
		document.getElementById("txtEmail").focus();
		return false;
	}
	if(document.getElementById("txtLogin").value==""){
		alert("Le champ \"Identification\" est obligatoire");
		document.getElementById("txtLogin").focus();
		return false;
	}
	if(document.getElementById("txtPassword").value==""){
		alert("Le champ \"Mot de passe\" est obligatoire");
		document.getElementById("txtPassword").focus();
		return false;
	}
	email=document.getElementById("txtEmail").value;
	login=document.getElementById("txtLogin").value;
	adminId=document.getElementById("adminId").value;
	cadena=email+","+login+","+adminId;
	jsrsExecute("./check_admin.php",end_checkAdmin,"confirmar",cadena);
}
function end_checkAdmin(cadena){
	if(cadena==1){ //login existe
		alert("Identification existe déjà");
		document.getElementById("txtLogin").focus();
		return false;
	}else if(cadena==2){ //email existe
		alert("Email existe déjà");
		document.getElementById("txtEmail").focus();
		return false;
	}else{
		document.frmRegister.submit();
	}
}
//Finalizar pedido
function end_order(){
	form=document.frmPanier;
	total=form.totaltypePayment.value;
	totCheck=0;
	for(i=0;i<total;i++){
		if(document.getElementById("optTypepayment"+i).checked==false){
			totCheck++;
		}else{
			typepayment=document.getElementById("optTypepayment"+i).value;
		}
	}
	if(total==totCheck){
		alert("Merci de bien vouloir choisir un type de payment");
		return false;
	}else{
		if(typepayment==1){//tarjeta de credito PAYBOX
			//form.action="https://tpeweb.paybox.com/cgi/MYchoix_pagepaiement.cgi";
			form.action="buy_target.php?page=8";
		}else{//cheque
			form.action="abonnement.php?page=3";
		}
		form.submit();
	}
}

/*
funcion para la validación del formulario para los banners
Fecha: 29-DIC-2006
*/
function checkBanner(page){
	oForm=document.forms[0];

	if(document.getElementById('optDim1').checked==false && document.getElementById('optDim2').checked==false){
		alert("Le champ \"dimensions du banner\" est obligatoire");
		document.getElementById("size").focus();
		document.getElementById('size').style.background="#FFFF99";
		return false;
	}

	if(document.getElementById('rbfile1').checked==true){
		
		if((page=="1") || (page=="2" && oForm.txtfile.value=="TEXT HTML")){
			if(document.getElementById("upfile").value==""){
				alert("Le champ \"file\" est obligatoire");
				document.getElementById("upfile").focus();
				document.getElementById("upfile").style.background="#FFFF99";
				//limpiamos el color amarillo por si hubo error en al campo anterior
				document.getElementById("txtHtml").style.background="#FFFFFF";			
				return false;
			}
		}
	}
	if(oForm.rbfile[1].checked==true){
		if(document.getElementById("txtHtml").value==""){
			alert("Le champ \"HTML\" est obligatoire");
			document.getElementById("txtHtml").focus();			
			//limpiamos el color amarillo por si hubo error en al campo anterior
			document.getElementById("upfile").style.background="#FFFFFF";
			return false;
		}
	}

}

function checkFormPress(page){
	
	form=document.frmRegister;
	
	if(document.getElementById("txtName").value==""){
		alert("Le champ \"Nom du press\" est obligatoire");
		document.getElementById("txtName").focus();			
		document.getElementById("txtName").style.background="#FFFF99";
		return false;
	}else{
		form.submit();	
	}
	
/*	if(page==1){
		if(document.getElementById("image").value==""){
			alert("Le champ \"Nom du press\" est obligatoire");
			document.getElementById("image").focus();			
			document.getElementById("image").style.background="#FFFFFF";
			return false;
		}		
	}*/
}

function checkFormArticle(page){
	form=document.frmRegister;
	
	flag=1;
	
	if(document.getElementById("cbo_Media").value==0){
		alert("Le champ \"Media\" est obligatoire");
		document.getElementById("cbo_Media").focus();			
		document.getElementById("cbo_Media").style.background="#FFFF99";
		return false;
		flag=0;
	}
	if(document.getElementById("cbo_Spectacle").value==0){
		alert("Le champ \"Spectacle\" est obligatoire");
		document.getElementById("cbo_Spectacle").focus();			
		document.getElementById("cbo_Spectacle").style.background="#FFFF99";
		return false;
		flag=0;
	}
	/*if(document.getElementById("txtTitle").value==""){
		alert("Le champ \"Titre\" est obligatoire");
		document.getElementById("txtTitle").focus();			
		document.getElementById("txtTitle").style.background="#FFFF99";
		return false;
		flag=0;
	}*/
	if(document.getElementById("txtDescription").value==""){
		alert("Le champ \"Description\" est obligatoire");
		document.getElementById("txtDescription").focus();			
		document.getElementById("txtDescription").style.background="#FFFF99";
		return false;
		flag=0;
	}
	
	if(flag==1){
		form.submit();
	}
}

function checkInscription(){
	form=document.frmInscription;
	if(validaForm(form)!=false){
		//codepartner=form.txtCodepartner.value;
		codepartner='';
		//login=form.txtnickUser.value;
		login='';
		email=form.txtemailUser.value;
		idUser=form.hidsessionUser.value;
		cadena=codepartner+","+login+","+email+","+idUser;
		if(form.hidOrigen.value=="web"){ //si se invoca desde la web
			jsrsExecute("./include/check_inscription.php",end_CheckInscription,"confirmar",cadena);
		}else{ //si se invoca desde el admin
			jsrsExecute("../../include/check_inscription.php",end_CheckInscription,"confirmar",cadena);
		}
	}
}
function end_CheckInscription(param){
	form=document.frmInscription;
	if(param==4){//todo ok
		form.submit();	
	}else{
		if(param==1){//partner inexistente
			alert("Code partenaire incorrect!");
			form.txtCodepartner.select();
		}else if(param==2){//login existente
			alert("Login existe deja");
			form.txtnickUser.select();
		}else{//3.-email existente
			alert("Email existe deja");
			form.txtemailUser.select();
		}
	}
}

function setFocus(){
	document.form1.txtLog.focus();	
}

function checkInvitation(){
	form=document.frmInvitation;
	if(validaForm(form)!=false){
		cadena=form.txtEmail.value;
		jsrsExecute("./include/check_invitation.php",end_checkInvitation,"confirmar",cadena);
	}
}
function end_checkInvitation(param){
	form=document.frmInvitation;
	if(param==1){
		form.submit();	
	}else{
		alert("El email ingresado ya se encuentra registrado en nuestra BD");	
	}
}

function checkFormVenue(){
	
	if(document.getElementById("txtName").value==""){
		alert("Le champ \"Nom la salle\" est obligatoire");
		document.getElementById("txtName").focus();			
		//limpiamos el color amarillo por si hubo error en al campo anterior
		document.getElementById("txtName").style.background="#FFFF99";
		return false;
	}
	/*if(document.getElementById("cbo_typeVenue").value=="0"){
		alert("Le champ \"Type la salle\" est obligatoire");
		document.getElementById("cbo_typeVenue").focus();			
		//limpiamos el color amarillo por si hubo error en al campo anterior
		document.getElementById("cbo_typeVenue").style.background="#FFFF99";
		return false;
	}*/
	if(document.getElementById("txtAddress").value==""){
		alert("Le champ \"Adresse\" est obligatoire");
		document.getElementById("txtAddress").focus();			
		//limpiamos el color amarillo por si hubo error en al campo anterior
		document.getElementById("txtAddress").style.background="#FFFF99";
		return false;
	}
	/*if(document.getElementById("txtPostal").value==""){
		alert("Le champ \"Code postal\" est obligatoire");
		document.getElementById("txtPostal").focus();			
		//limpiamos el color amarillo por si hubo error en al campo anterior
		document.getElementById("txtPostal").style.background="#FFFF99";
		return false;
	}*/
	if(document.getElementById("txtCity").value==""){
		alert("Le champ \"City\" est obligatoire");
		document.getElementById("txtCity").focus();			
		//limpiamos el color amarillo por si hubo error en al campo anterior
		document.getElementById("txtCity").style.background="#FFFF99";
		return false;
	}
	
	/*if(document.getElementById("txtMetro").value==""){
		alert("Le champ \"Metro\" est obligatoire");
		document.getElementById("txtMetro").focus();			
		//limpiamos el color amarillo por si hubo error en al campo anterior
		document.getElementById("txtMetro").style.background="#FFFF99";
		return false;
	}*/
	
	if(document.getElementById("txtFono").value==""){
		alert("Le champ \"Téléphone 1\" est obligatoire");
		document.getElementById("txtFono").focus();			
		//limpiamos el color amarillo por si hubo error en al campo anterior
		document.getElementById("txtFono").style.background="#FFFF99";
		return false;
	}
	
/*	if(document.getElementById("txtEmail").value==""){
		alert("Le champ \"Email\" est obligatoire");
		document.getElementById("txtEmail").focus();			
		//limpiamos el color amarillo por si hubo error en al campo anterior
		document.getElementById("txtEmail").style.background="#FFFF99";
		return false;
	}*/	
	if(document.getElementById("txtEmail").value!=""){
		if(emailCheck(document.getElementById("txtEmail").value)==0){
			alert("Votre email n'est pas valide");
			document.getElementById("txtEmail").focus();
			document.getElementById("txtEmail").style.background="#FFFF99";
			return false;
		}
	}	
/*	if(document.getElementById("txtKey").value==""){
		alert("Le champ \"Key\" est obligatoire");
		document.getElementById("txtKey").focus();			
		//limpiamos el color amarillo por si hubo error en al campo anterior
		document.getElementById("txtKey").style.background="#FFFFFF";
		return false;
	}	

	if(document.getElementById("txtCapacite").value==""){
		alert("Le champ \"Capacité\" est obligatoire");
		document.getElementById("txtCapacite").focus();			
		//limpiamos el color amarillo por si hubo error en al campo anterior
		document.getElementById("txtCapacite").style.background="#FFFFFF";
		return false;
	}*/
}

function checkFormVisiomag(){
	
	if(document.getElementById("cbo_typeVisiomag").value=="0"){
		alert("Le champ \"Type de critique\" est obligatoire");
		document.getElementById("cbo_typeVisiomag").focus();					
		document.getElementById("cbo_typeVisiomag").style.background="#FFFF99";
		return false;
	}
	
	var esp = document.getElementById("cbo_Spectacle").value;
	var def = document.getElementById("cbo_Person").value
	
	if(esp==0 && def==0){
		alert("Sélectionner un \"Genre traité dans l'article\"\n et/ou un spectacle");
		return false;
	}
	
	/*if(document.getElementById("cbo_Spectacle").value=="0"){
		alert("Sélectionner un artiste et/ou un spectacle");
		document.getElementById("cbo_Spectacle").focus();							
		return false;
	}*/
	
	if(document.getElementById("txtName").value==""){
		alert("Le champ \"Titre de L’article\" est obligatoire");
		document.getElementById("txtName").focus();	
		document.getElementById("txtName").style.background="#FFFF99";
		return false;
	}
	
	if(document.getElementById("txtarticulos").value==""){
		alert("Le champ \"Sous-titre de l'article\" est obligatoire");
		document.getElementById("txtarticulos").focus();
		document.getElementById("txtarticulos").style.background="#FFFF99";
		return false;
	}
	
	/*if(document.getElementById('txtarea1').value==""){
		alert("describir caracteristicas");
		document.getElementById('txtarea1').focus();
		return false;
	}*/
	
	if(document.getElementById("txtContein").value==""){
		alert("Le champ \"Corps de l' article\" est obligatoire");
		document.getElementById("txtContein").focus();
		document.getElementById("txtContein").style.background="#FFFF99";
		return false;
	}
	
	if(document.getElementById("txtDate").value==""){
		alert("Le champ \"Date\" est obligatoire");
		document.getElementById("txtDate").focus();
		document.getElementById("txtDate").style.background="#FFFF99";
		return false;
	}	
	
	if(document.getElementById("txtDate").value!=""){
		if(!isValidDate(document.getElementById("txtDate").value)){
			alert("Format de date incorrect : JJ/MM/AAAA");
			document.getElementById("txtDate").focus();					
			document.getElementById("txtDate").style.background="#FFFF99";
			return false;
		}	
	}
	
	if(document.getElementById("txtAutor").value==""){
		alert("Le champ \"Auteur\" est obligatoire");
		document.getElementById("txtAutor").focus();
		document.getElementById("txtAutor").style.background="#FFFF99";
		return false;
	}	
	
	if(document.getElementById("txtEmailAutor").value!=""){
		if(emailCheck(document.getElementById("txtEmailAutor").value)==0){
			alert("Votre email n'est pas valide");
			document.getElementById("txtEmailAutor").focus();
			document.getElementById("txtEmailAutor").style.background="#FFFF99";
			return false;
		}
	}		
}

/*funcion para ingresar solamente 255 caracteres*/
	function limitlength(obj, length){
		var maxlength=length;
			if (obj.value.length>maxlength)
				obj.value=obj.value.substring(0, maxlength);
			}
/*fin de la funcion*/

function checkFormSpectacle(typepage){
	
	if(document.getElementById("txtName").value==""){
		alert("Le champ \"Name du spectacle\" est obligatoire");
		document.getElementById("txtName").focus();					
		document.getElementById("txtName").style.background="#FFFF99";
		return false;
	}

	/*if(document.getElementById("cbo_typeVenue").value=="" || document.getElementById("cbo_typeVenue").value==0){
		alert("Le champ \"Salle\" est obligatoire");
		document.getElementById("cbo_typeVenue").focus();					
		document.getElementById("cbo_typeVenue").style.background="#FFFF99";
		return false;
	}
	
	if(document.getElementById("txtPrix").value==""){
		alert("Le champ \"Prix\" est obligatoire");
		document.getElementById("txtPrix").focus();					
		document.getElementById("txtPrix").style.background="#FFFF99";
		return false;
	}
	if(document.getElementById("txtPrix2").value==""){
		alert("Le champ \"Prix 2\" est obligatoire");
		document.getElementById("txtPrix2").focus();					
		document.getElementById("txtPrix2").style.background="#FFFF99";
		return false;
	}*/
	if(document.getElementById("txtDescription").value==""){
		alert("Le champ \"Description\" est obligatoire");
		document.getElementById("txtDescription").focus();					
		document.getElementById("txtDescription").style.background="#FFFF99";
		return false;
	}
	
	/*	if(document.getElementById("textProductArtist").value==""){
		alert("Le champ \"Artistes\" est obligatoire");
		document.getElementById("textProductArtist").focus();					
		document.getElementById("textProductArtist").style.background="#FFFF99";
		return false;
	}
	
	if(document.getElementById("varProductDirector").value==""){
		alert("Le champ \"Mise en scène\" est obligatoire");
		document.getElementById("varProductDirector").focus();					
		document.getElementById("varProductDirector").style.background="#FFFF99";
		return false;
	}
	
	if(document.getElementById("varProductAutor").value==""){
		alert("Le champ \"Auteur\" est obligatoire");
		document.getElementById("varProductAutor").focus();					
		document.getElementById("varProductAutor").style.background="#FFFF99";
		return false;
	}*/
/*	if(document.getElementById("txtDescription2").value==""){
		alert("Le champ \"Synopsis 2\" est obligatoire");
		document.getElementById("txtDescription2").focus();					
		document.getElementById("txtDescription2").style.background="#FFFF99";
		return false;
	}*/
/*	if(document.getElementById("txtTime").value==""){
		alert("Le champ \"Durée du spectacle\" est obligatoire");
		document.getElementById("txtTime").focus();					
		document.getElementById("txtTime").style.background="#FFFF99";
		return false;
	}*/
/*	if(document.getElementById("txtDates").value==""){
		alert("Le champ \"Dates\" est obligatoire");
		document.getElementById("txtDates").focus();					
		document.getElementById("txtDates").style.background="#FFFF99";
		return false;
	}*/
	if(document.getElementById("txtDateBegin").value==""){
		alert("Le champ \"Date Première\" est obligatoire");
		document.getElementById("txtDateBegin").focus();					
		document.getElementById("txtDateBegin").style.background="#FFFF99";
		return false;
	}
	if(document.getElementById("txtDateEnd").value==""){
		alert("Le champ \"Date Dernière\" est obligatoire");
		document.getElementById("txtDateEnd").focus();					
		document.getElementById("txtDateEnd").style.background="#FFFF99";
		return false;
	}	
	
	/*
	Validando las fechas Inicial y final
	*/
	if(document.getElementById("txtDateBegin").value!=""){
		if(!isValidDate(document.getElementById("txtDateBegin").value)){
			alert("Format de date incorrect : JJ/MM/AAAA");
			document.getElementById("txtDateBegin").focus();					
			document.getElementById("txtDateBegin").style.background="#FFFF99";
			return false;
		}
		if(!isValidDate(document.getElementById("txtDateEnd").value)){
			alert("Format de date incorrect : JJ/MM/AAAA");
			document.getElementById("txtDateEnd").focus();					
			document.getElementById("txtDateEnd").style.background="#FFFF99";
			return false;
		}		
	}
	
	/*if(isValidDate(document.getElementById("txtDateBegin").value) && isValidDate(document.getElementById("txtDateEnd").value)){
		if(document.getElementById("txtDateBegin").value > document.getElementById("txtDateEnd").value){
			alert("L\'heure de fin de représentation ne peut être antérieure à l\'heure de début");
			document.getElementById("txtDateBegin").focus();
			document.getElementById("txtDateBegin").style.background="#FFFF99";
			return false;
		}
	}*/
	
	/*
	Validando los check de los dias para las horas
	*/
	if(typepage!=2){
	
		var chkc=0;
		for(i=1; i<8; i++){
			if(document.getElementById("chk"+i).checked==false){
				chkc=chkc+1;
			}
		}
		if(chkc==7){
			alert("Veuillez sélectionner les jours");
			return false;
		}
		//--------------------------------------------
	
		for(j=1; j<8; j++){
			if(document.getElementById("chk"+j).checked==true){
				
				if(document.getElementById("cbo_Hr"+j).value=='00' && document.getElementById("cbo2_Hr"+j).value=='00'){
					alert("Vous devez entrer l\'heure de début du spectacle");
					document.getElementById("cbo_Hr"+j).focus();
					return false;
				}
				
				if(document.getElementById("cbo_Hr"+j).value!='00'){
				
					if(document.getElementById("txtQuotan"+j).value=="" || document.getElementById("txtQuota"+j).value=="" || document.getElementById("txtQuotai"+j).value==""){
						alert("Vous devez spécifier le nombre de places disponibles");
						document.getElementById("txtQuotan"+j).focus();
						return false;
					}
				}
				
				if(document.getElementById("cbo2_Hr"+j).value!='00'){
				
					if(document.getElementById("txtQuotan2"+j).value=="" || document.getElementById("txtQuota2"+j).value=="" || document.getElementById("txtQuotai2"+j).value==""){
						alert("Vous devez spécifier le nombre de places disponibles");
						document.getElementById("txtQuotan2"+j).focus();
						return false;
					}
				}
				
				if((document.getElementById("cbo_Hr"+j).value==document.getElementById("cbo2_Hr"+j).value) && (document.getElementById("cbo_Hr"+j).value!='00' && document.getElementById("cbo2_Hr"+j).value!='00')){
					alert("Attention : horaires identiques");
					return false;
				}
				
			}
		}
	} // End if
	
	page=document.getElementById("asoc_spectacle").value;	
	idProduct=document.getElementById("idProduct").value;
	cadena=page+","+idProduct+","+typepage;
	//alert(idProduct);
	jsrsExecute("check_spectacle.php",end_checkSpectacle,"confirmar",cadena);		
	
/*	jsrsExecute("check_spectacle.php",end_checkAbonnement,"confirmar",cadena);
	if(document.frmAbonnement.txtCodepartner.value!=""){
		cadena=document.frmAbonnement.txtCodepartner.value;
		jsrsExecute("./include/check_abonnement.php",end_checkAbonnement,"confirmar",cadena);
	}else{
		document.frmAbonnement.submit();
	}
	*/
	
}

function end_checkSpectacle(param){

	form=document.frmRegister;
	
	data=param.split("|");
	//data=param;
	//person=data[0];
	spectacle=data[0];
	lieuVenue=data[1];
	//alert(spectacle);
	//if(person==1 && spectacle==1){
	if(spectacle==1 && lieuVenue==1){	
		form.submit();
	}else{
		if(spectacle!=1){
			alert("Vous devez choisir une ou plusieurs catégories");
			return false;
		}
		if(lieuVenue!=1){
			alert("Vous devez choisir une Salle ou Lieu");
			return false;
		}
/*/		if(person!=1){
			alert("Por favor, seleccione a los artistas que pertenecen al espectaculo");
			return false;
		}
		if(spectacle!=1){
			alert("Por favor, indique a que categoría pertenece el espectáculo mmm");
			return false;
		}*/		
		//alert("Vous devez choisir une ou plusieurs catégories");
		//return false;
	}

}

function typeabonoselect(){
	
	typeabono=document.getElementById("cboTypeAbono").value;
		
	day=document.getElementById("cboDay1").value;
	month=document.getElementById("cboMonth1").value;
	year=document.getElementById("cboYear1").value;
	cadena=typeabono+","+day+","+month+","+year;
	//alert(cadena);
	jsrsExecute("value_abonnement.php",end_typeabonoselect,"confirmar",cadena);
}

function end_typeabonoselect(param){
	
	data=param.split("|");
	day=data[1];
	month=data[2];
	year=data[3];
	
	price=data[4];
	
	// Limpiamos los combos para las fechas finales-----------------------
	for(x=0; x < 31; x++) {	
		document.getElementById("cboDayE").options[0]= null;
	}
	for(x=0; x < 13; x++) {	
		document.getElementById("cboMonthE").options[0]= null;
	}
	for(x=0; x < 6; x++) {	
		document.getElementById("cboYearE").options[0]= null;
	}
	//--------------------------------------------------------------------
	// Cargamos los dias 
	for(x=0; x <= 31; x++) {			
		if(x==0){
			val_day="Jour";
			id_day="0";
		}else{
			numday=(x<=9)?("0"+x):(x);
			val_day=numday;
			id_day=numday;
		}
		otraopcion=new Option(val_day,id_day);
		document.getElementById("cboDayE").options[x]= otraopcion;
		if(val_day==day){
			document.getElementById("cboDayE").options[x].selected=true;
		}
	}
	
	// Cargamos los meses
	for(x=0; x <= 12; x++) {
		if(x==0){
			val_month="Mois";
			id_month="0";
		}else{
			val_x=(x<=9)?("0"+x):(x);
			val_month=fun_month(String(val_x));
			id_month=val_x;			
		}
		otraopcion=new Option(val_month,id_month);
		document.getElementById("cboMonthE").options[x]= otraopcion;
		if(id_month==month){
			document.getElementById("cboMonthE").options[x].selected=true;	
		}
	}
	
	// Cargamos los anios
	otraopcion=new Option("Année","0000");
	document.getElementById("cboYearE").options[0]= otraopcion;	
	for(y=1; y<=5; y++) {
		
		val_year=parseInt(document.getElementById("anio_").value)+y-1;
		id_year=val_year;
		otraopcion=new Option(val_year,id_year);
		document.getElementById("cboYearE").options[y]= otraopcion;
		
		if(val_year==year){
			document.getElementById("cboYearE").options[y].selected=true;	
		}
	}
	
	document.getElementById("monto").innerHTML=price+" &#8364;";
	document.getElementById("numplacesMonth").value=data[0];
	document.getElementById("txtMonto").value=price;
	document.getElementById("txtDuration").value=data[0];

}

function typeabonoselect2(){
	typeabono=document.getElementById("cboTypeAbono").value;
	day=document.getElementById("cboDay1").value;
	month=document.getElementById("cboMonth1").value;
	year=document.getElementById("cboYear1").value;
	cadena=typeabono+","+day+","+month+","+year;
	//alert(cadena);
	jsrsExecute("value_abonnement.php",end_typeabonoselect2,"confirmar",cadena);
}

/*function changeDay(){
	typeabono=document.getElementById("cboTypeAbono").value;
	day=document.getElementById("cboDay1").value;
	month=document.getElementById("cboMonth1").value;
	year=document.getElementById("cboYear1").value;
	cadena=typeabono+","+day+","+month+","+year;
}*/

function end_typeabonoselect2(param){
	
	data=param.split("|");
	day=data[1];
	month=fun_month(data[2]);
	year=data[3];
	price=data[4];
		
	//alert(data[0]);	
	document.getElementById("monto").innerHTML=price+" &#8364;";
	//document.getElementById("daye").value=day;
	document.getElementById("numplaces").value=data[0];
	//document.getElementById("numMonthAbo").value=data[0];
}

function fun_month(mes){
	var m;
	switch(mes){
		case "01":
			m="Janvier";
			break;
		case "02":
			m="Février";
			break;
		case "03":
			m="Mars";
			break;
		case "04":
			m="Avril";
			break;
		case "05":
			m="Mai";
			break;
		case "06":
			m="Juin";
			break;
		case "07":
			m="Juillet";
			break;
		case "08":
			m="Août";
			break;
		case "09":
			m="Septembre";
			break;
		case "10":
			m="Octobre";
			break;
		case "11":
			m="Novembre";
			break;
		case "12":
			m="Décembre";
			break;
	}
	return m;
}

function lieu_salle(flag){
	
	idProduct=document.frm_1.idProduct.value;
		
	if(flag){
		//salle
		$idLieuSalle=document.getElementById("cbo_typeVenue").value;
		$type=1;
	}else{
		//lieu
		$idLieuSalle=document.getElementById("cbo_typeLieu").value;
		$type=0;
	}
	cadena=$idLieuSalle+","+idProduct+","+$type;
	//alert(cadena);
	jsrsExecute("check_salle_lieu.php",end_salle_lieu,"confirmar",cadena);
}

function end_salle_lieu(){
	
	// *** NO BORRAR ESTA FUNCION, ES IMPORTANTE ***

}

function checkFormEvenement(num){
	form=document.frm;
	
	ok="1";
	if(document.getElementById("cbo_Spectacle").value=="0"){
		alert("Le champ \"Spectacle\" est obligatoire");
		document.getElementById("cbo_Spectacle").focus();					
		document.getElementById("cbo_Spectacle").style.background="#FFFF99";
		return false;
		ok=0;
	}
	if(num=="0"){
		if(document.getElementById("image_file").value==""){
			alert("Le champ \"Image\" est obligatoire");
			document.getElementById("image_file").focus();					
			document.getElementById("image_file").style.background="#FFFF99";
			return false;
			ok=0;
		}
	}
	
	if(ok=="1"){
		//alert(ok);
		form.submit();
	}
}

function isValidDate(sText) {
	var reDate = /(?:0[1-9]|[12][0-9]|3[01])\/(?:0[1-9]|1[0-2])\/(?:19|20\d{2})/; 
	return reDate.test(sText);
}

function checkPrix(ctrl){
	if(ctrl.value<=0){
		alert(" Prix Incorrecte! ");
		ctrl.value="";
		ctrl.focus();
	}
	if(isNaN(ctrl.value)==true){
		alert(" Prix Incorrecte! ");
		ctrl.value="";
		ctrl.focus();
	}
}

function checkFormClose(){
	if(document.getElementById("cboDay").value=="0"){
		alert("Le champ \"jour\" est obligatoire");
		document.getElementById("cboDay").focus();					
		document.getElementById("cboDay").style.background="#FFFF99";
		return false;
	}
	if(document.getElementById("cboMonth").value=="0"){
		alert("Le champ \"mois\" est obligatoire");
		document.getElementById("cboMonth").focus();					
		document.getElementById("cboMonth").style.background="#FFFF99";
		return false;
	}

	day=document.getElementById("cboDay").value;
	month=document.getElementById("cboMonth").value;
	year=document.getElementById("cboYear").value;
	
	page=document.getElementById("page").value;
	idClose=document.getElementById("idClose").value;
	
	if(day!=0 && month!=0){
		cadena=year+","+month+","+day+","+page+","+idClose;	
		jsrsExecute("check_date.php",end_checkDate,"confirmar",cadena);
	}
	
}


function end_checkDate(param){
	form=document.frmRegister;
	
	data=param;
	
	if(data){	
		form.submit();		
	}else{
		alert("Date déjà existante");
		return false;
	}
	
}

function valida_formCart(){
	$ok=true;
	
	if(document.getElementById("cbo_Spectacle").value=="0"){
		alert("Le champ est obligatoire");
		document.getElementById("cbo_Spectacle").focus();
		document.getElementById("cbo_Spectacle").style.background="#FFFF99";
		return false;
		$ok=false;
	}
	
	if(document.getElementById("cboRepresentation").value==""){
		alert("Le champ est obligatoire");
		document.getElementById("cboRepresentation").focus();
		document.getElementById("cboRepresentation").style.background="#FFFF99";
		return false;
		$ok=false;
	}
	
	if(document.getElementById("idUser").value=="0"){
		alert("Le champ est obligatoire");
		document.getElementById("idUser").focus();
		document.getElementById("idUser").style.background="#FFFF99";
		return false;
		$ok=false;
	}
	if(document.getElementById("type_reserve").value=="0"){
		alert("Le champ \"Type de réservation\" est obligatoire");
		document.getElementById("type_reserve").focus();
		document.getElementById("type_reserve").style.background="#FFFF99";
		return false;
		$ok=false;
	}
	if(document.getElementById("txtNumReserve").value==""){
		alert("Le champ \"Nombre de places\" est obligatoire");
		document.getElementById("txtNumReserve").focus();
		document.getElementById("txtNumReserve").style.background="#FFFF99";
		return false;
		$ok=false;
	}
	
	day=document.getElementById('cboDay').value;
	month=document.getElementById('cboMonth').value;
	year=document.getElementById('cboYear').value;
			
	if(document.getElementById("chck").checked==false){
		if(document.getElementById("cboTypePay").value=="0"){
			alert("Le champ \"Moyen de paiement\" est obligatoire");
			document.getElementById("cboTypePay").style.background="#FFFF99";
			return false;
			$ok=false;
		}
	}else{
		if(day=='0' || month=='0' || year=='0000'){
			alert("Le champ \"Date de paiement\" est obligatoire");
			return false;
			$ok=false;
		}
	}
	if($ok){
		idUser=document.getElementById("idUser").value;
		idHour=document.getElementById("cboRepresentation").value;
		type_reser=document.getElementById("type_reserve").value;
		$num_reser=document.getElementById("txtNumReserve").value;
		
		if(document.getElementById('chck').checked==false){			
			date_payment=year+"-"+month+"-"+day;			
		}else{
			date_payment=0;
		}
		
		cadena=idUser+","+idHour+","+type_reser+","+$num_reser+","+date_payment;	
		jsrsExecute("check_stock.php",end_checkStock,"confirmar",cadena);
	}
}

function end_checkStock(param){
	form=document.frmCart;
	
	data=param.split("|");

	if(data[0]=="1" && data[1]=="1" && data[3]=="1"){
		form.submit();	
	}else{
		if(data[0]!="1"){
			alert("El espectaculo no cuenta con lugares disponibles");	
		}
		if(data[1]!="1"){
			alert("Usted ya hizo una reservacion en este dia");	
		}
		if(data[3]!="1"){
			alert("El abonado no cuenta con lugares disponibles");	
		}
	}	
}

function select_representation(idProd){
	var UserID
	UserID=document.getElementById('idUser').value;
	cadena=idProd+","+UserID;
	jsrsExecute("select_representation.php",llenar_combo_representation,"confirmar",cadena);
	
}
function put_num_reserva(UserID){
	var idProd
	idProd=document.getElementById('cbo_Spectacle').value;
	cadena=idProd+","+UserID;
	jsrsExecute("select_representation.php",max_num_reserver_spectacle,"confirmar",cadena);	
}

function max_num_reserver_spectacle(param){
	datos=param.split("|");

	numMaxRep=datos[2];
	// Para el combo numero maximo de reservaciones
	large=document.getElementById('txtNumReserve').length;
	for(y=0;y<large;y++){
		document.getElementById('txtNumReserve').options[0]= null;
	}
	maxi=numMaxRep;
	for(y=0;y<maxi;y++){
		newopc=new Option(y+1,y+1);
		document.getElementById('txtNumReserve').options[y]=newopc;		
		//alert(document.getElementById('txtNumReserve').options[y]);
	}	
	//document.getElementById('type_reserve').options[maxi].text=maxi
	//alert(document.getElementById('type_reserve').options[maxi].text=maxi);
}

function llenar_combo_representation(param){
	datos=param.split("|");
	
	id=datos[0].split(",");
	nb=datos[1].split(",");
	
	cid=id.length;		
	
	long=document.getElementById('cboRepresentation').length;
	
	for(x=0; x < long; x++) {	
		document.getElementById("cboRepresentation").options[0]= null;
	}
	
	for(x=0; x < cid-1; x++) {
		otraopcion=new Option(nb[x],id[x]);
		document.getElementById("cboRepresentation").options[x]= otraopcion;
	}
	
	if(document.getElementById('idUser').value!="" && document.getElementById('idUser').value!=0){
		put_num_reserva(document.getElementById('idUser').value);
	}
}

function checkFormVisiotv(page){
	if(document.getElementById("cboDay").value=="0"){
		alert("Le champ \"jour\" est obligatoire");
		document.getElementById("cboDay").focus();					
		document.getElementById("cboDay").style.background="#FFFF99";
		return false;
	}
	if(document.getElementById("cboMonth").value=="0"){
		alert("Le champ \"mois\" est obligatoire");
		document.getElementById("cboMonth").focus();					
		document.getElementById("cboMonth").style.background="#FFFF99";
		return false;
	}
	if(document.getElementById("cboYear").value=="0000"){
		alert("Le champ \"Année\" est obligatoire");
		document.getElementById("cboYear").focus();					
		document.getElementById("cboYear").style.background="#FFFF99";
		return false;
	}
	
	if(document.getElementById("txtName").value==""){
		alert("Le champ \"Titre de l\'Émission\" est obligatoire");
		document.getElementById("txtName").focus();					
		document.getElementById("txtName").style.background="#FFFF99";
		return false;
	}
	if(page==1){
		if(document.getElementById("upfileVideo").value==""){
			alert("Le champ \"Video (format flv)\" est obligatoire");
			document.getElementById("upfileVideo").focus();					
			document.getElementById("upfileVideo").style.background="#FFFF99";
			return false;
		}	
	}
}

function check_submit_mails(opc){
	
	form=document.frm_submit_emails;
	form.stSubmitSave.value=opc;
	
	//alert(form.stSubmitSave.value);
	
	flag=1;
	
	if(opc==2){
		if(document.getElementById("txtSubject").value==""){
			alert("Le champ \"Subject\" est obligatoire");
			document.getElementById("txtSubject").focus();					
			document.getElementById("txtSubject").style.background="#FFFF99";
			return false;
			flag=0;
		}
		if(document.getElementById("slcSubmit").value==0 && document.getElementById("txtMail_opcb").value==""){
			alert("Seleccione el tipo de destinatario o ingrese un nuevo email a enviar");
			document.getElementById("slcSubmit").focus();					
			document.getElementById("slcSubmit").style.background="#FFFF99";
			return false;
			flag=0;
		}
		
		if(document.getElementById("txtMail_opcb").value!=""){
			if(emailCheck(document.getElementById("txtMail_opcb").value)==0){
				alert("Votre email n'est pas valide");
				document.getElementById("txtMail_opcb").focus();
				document.getElementById("txtMail_opcb").style.background="#FFFF99";
				return false;
				flag=0;
			}
		}
		
		if(flag){
			form.submit();
		}
	}
	if(opc==1){
		form.submit();
	}
}
function submit_mails(opc){
	
	form=document.frm_submit_emails;
	form.stSubmitSave.value=opc;
	//alert(form.stSubmitSave.value);
	flag=1;
	
	if(opc==2){
		if(document.getElementById("txtSubject").value==""){
			alert("Le champ \"Subject\" est obligatoire");
			document.getElementById("txtSubject").focus();					
			document.getElementById("txtSubject").style.background="#FFFF99";
			return false;
			flag=0;
		}
		
		if(flag){
			form.submit();
		}
	}
}


function checkFormCoeur(){
	
	form=document.frm;
	flag=1;
	//alert("s");
	if(document.getElementById("cboDay_d").value=="0"){
		alert("Le champ \"jour\" est obligatoire");
		document.getElementById("cboDay_d").focus();					
		document.getElementById("cboDay_d").style.background="#FFFF99";
		return false;
		flag=0;
	}
	if(document.getElementById("cboMonth_d").value=="0"){
		alert("Le champ \"mois\" est obligatoire");
		document.getElementById("cboMonth_d").focus();					
		document.getElementById("cboMonth_d").style.background="#FFFF99";
		return false;
		flag=0;
	}
	
	if(document.getElementById("cboYear_d").value=="0000"){
		alert("Le champ \"Annee\" est obligatoire");
		document.getElementById("cboYear_d").focus();					
		document.getElementById("cboYear_d").style.background="#FFFF99";
		return false;
		flag=0;
	}
	
	if(flag==1){
		
		dateB=document.getElementById("cboYear_d").value+"-"+document.getElementById("cboMonth_d").value+"-"+document.getElementById("cboDay_d").value;
		
		dateE=document.getElementById("cboYear_f").value+"-"+document.getElementById("cboMonth_f").value+"-"+document.getElementById("cboDay_f").value;
	
		idProduct=document.getElementById("idProduct").value;
		
		cadena=dateB+","+dateE+","+idProduct;	
		jsrsExecute("check_coups.php",end_checkFormCoeur,"confirmar",cadena);
	}
}

function end_checkFormCoeur(param){
	data=param.split("|");
	err1=data[0];
	err2=data[1];
	
	dateB=document.getElementById("dateFirst").value;
	dateE=document.getElementById("dateLast").value;
	
	if(err1){
		document.getElementById("errdate1").style.display="";
		document.getElementById("errdate1").innerHTML="ERROR : fecha Inicial mayor a fecha final";
		document.getElementById("errdate2").style.display="none";
	}
	if(err2){
		document.getElementById("errdate1").style.display="none";
		document.getElementById("errdate2").style.display="";
		document.getElementById("errdate2").innerHTML="ERROR : Las fechas deben estar entre "+dateB+" y "+dateE;		
	}
	if(err1!=1 && err2!=1){		
		document.getElementById("errdate1").style.display="none";
		document.getElementById("errdate2").style.display="none";
		form.submit();
	}
	
}

function check_stock_spectacle(){

	idProduct=document.getElementById("idProd").value;
	idHour=document.getElementById("idHr").value;
	idDateprod=document.getElementById("idDp").value;
	idUser=document.getElementById("idUser").value;
	num_reserve=document.getElementById("sltReserve").value;

	if(num_reserve!=0){
		cadena=idProduct+","+idHour+","+idDateprod+","+idUser+","+num_reserve;
		jsrsExecute("./include/check_stock_spectacle.php",end_check_stock_spectacle,"confirmar",cadena);
	}else{
		alert("Merci d'indiquer le nombre de places souhaitées");	
		document.getElementById("sltReserve").focus();
		return false;
	}
}

function end_check_stock_spectacle(param){
	
	form=document.frmReserve;
	
	data=param.split("|");	
	msj1=data[0];
	msj2=data[1];
	msj3=data[2];
	msj4=data[3];
	/*msj5=data[4];
	msj6=data[5];
	msj7=data[6];*/
	ok=data[4];
	type=data[6];
	
	document.getElementById("type").value=type;
	//alert(param);
	
	if(msj1==1 && msj2==1 && msj3==1 && msj4==1){
		if(ok){
			form.submit();	
		}else{
			alert("Désolé, votre quota ne vous permet pas de réserver ce nombre de places");
			return false;
		}
	}else{
		
		if(msj1==0){
			alert("Désolé, votre quota ne vous permet pas de réserver ce nombre de places");	
			return false;
		}
		if(msj2==0){
			alert("Attention : aucune place disponible");	
			return false;
		}
		if(msj3==0){
			alert("Attention : pas assez de places disponibles");	
			return false;
		}
		if(msj4==0){
			alert("Désolé, votre quota ne vous permet pas de réserver ce nombre de places");	
			return false;
		}		
	}
	
}

function popup(img, ww, hh){
  derecha=(screen.width-ww)/2;
  arriba=(screen.height-hh)/2;
  string="titlebar='no',toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+ww+",height="+hh+",left="+derecha+",top="+arriba+"";
  fin=window.open(img,this.target,string);
}	

function reload_father(){
	document.location.reload();
}

function onfocus_(){
	if(document.getElementById("txtKeyWord").value=="Mot clé"){
		document.getElementById("txtKeyWord").value="";
	}
}
function onfocus_newletter(){
	if(document.getElementById("mail").value=="Newsletter"){
		document.getElementById("mail").value="";
	}
}
function onfocus_date(){
	if(document.getElementById("fec").value=="Date"){
		document.getElementById("fec").value="";
	}
}

function onblur_(){
	if(document.getElementById("txtKeyWord").value==""){
		document.getElementById("txtKeyWord").value="Mot clé";
	}
}
function onblur_newletter(){
	if(document.getElementById("mail").value==""){
		document.getElementById("mail").value="Newsletter";
	}
}
function onblur_date(){
	if(document.getElementById("fec").value==""){
		document.getElementById("fec").value="Date";
	}
}
function onfocus_gral(text,ctrl){
	if(document.getElementById(ctrl).value==text){
		document.getElementById(ctrl).value="";
	}	
}
function onblur_gral(text,ctrl){
	if(document.getElementById(ctrl).value==""){
		document.getElementById(ctrl).value=text;
	}	
}

function checkLoginAbonne(){
	if(document.getElementById("txtLogin").value=="Identification"){
		alert("Le champ \"Identification\" est obligatorie");
		document.getElementById("txtLogin").value="";
		document.getElementById("txtLogin").focus();
		return false;
	}
	if(document.getElementById("txtPassword").value=="Votre mot de passe"){
		alert("Le champ \"Mot de passe\" est obligatorie");
		document.getElementById("txtPassword").value="";
		document.getElementById("txtPassword").focus();
		return false;
	}
	
	return true;
}

function checkLoginPrepaye(){
	if(document.getElementById("txtCode").value=="Votre code partenaire"){
		alert("Le champ \"Code partenaire\" est obligatorie");
		document.getElementById("txtCode").value="";
		document.getElementById("txtCode").focus();
		return false;
	}
	if(document.getElementById("txtPrepaye").value=="Votre code prépayé"){
		alert("Le champ \"Code prépayé\" est obligatorie");
		document.getElementById("txtPrepaye").value="";
		document.getElementById("txtPrepaye").focus();
		return false;
	}
	
	return true;
}

function checkLoginEmail(){
	if(document.getElementById("txtEmail").value=="Votre email"){
		alert("Le champ \"Email\" est obligatorie");
		document.getElementById("txtEmail").value="";
		document.getElementById("txtEmail").focus();
		return false;
	}

	return true;
}
function enviar_boletin(destino)
{
  
  document.forms[0].opcion.value=destino;  
  cnf=true;
  flag=false;
  
   if(Trim(document.forms[0].nomb.value)=="")
	{
	 alert("Vous devez saisir le nom de la newsletter");
	 document.forms[0].nomb.focus();
	 return false;
	}
  
	
  if(destino == "2")
  {
	  
	 if(Trim(document.forms[0].nomb.value)=="")
	{
	 alert("Vous devez saisir le nom de la newsletter");
	 document.forms[0].nomb.focus();
	 return false;
	}
	
	 if(document.getElementById('ra0').checked==true){
	 		//cnf=confirm("Etes-vous sûr de vouloir envoyer la newsletter à la liste sélectionnée ?");
		 cnf=confirm("Etes-vous sûr de vouloir envoyer la newsletter à la liste sélectionnée ?");
			
	 }else{
		 
		  if(Trim(document.forms[0].nomb.value)=="")
	{
	 alert("Vous devez saisir le nom de la newsletter");
	 document.forms[0].nomb.focus();
	 return false;
	}
	
	
		if(document.getElementById('ra1').checked==true){
			if((document.forms[0].mailb.value=="") || !validarEmail(Trim(document.forms[0].mailb.value))){
				alert('Vous devez entrer a valid email');
	  			document.forms[0].mailb.focus();
				document.forms[0].mailb.style.background='#FFFFCA';
	  			cnf=false;
			}
		}
	 }
		
	if(cnf)
	  document.forms[0].submit();
  }
  else
   document.forms[0].submit();
  
  
}
function check_recovery_password(){
	form=document.frmRecovery;
	if(validaForm(form)!=false){
		cadena=form.txtEmail.value;
		jsrsExecute("./include/check_password_recovery.php",end_check_recovery_password,"confirmar",cadena);
	}
}
function end_check_recovery_password(cadena){
	form=document.frmRecovery;
	if(cadena==1){//ok
		form.submit();
	}else{
		alert("El email ingresado es incorrecto!");	
	}
}
function closePopUp(){
	setTimeout("window.close();",5000);
}
function delete_abonne(url){
	aviso="Vous souhaitez supprimer cet article de mon panier ?";
	if(confirm(aviso)){
		location.href='abonnement.php?page=3&cmdDelete=1&'+url;	
	}
}

function delete_reservation(url){
	msg="De supprimer sûrement cette réserve ?"	
	if(confirm(msg)){
		location.href='include/delete_reservation.php?cmdDelete=1&'+url;	
	}
}

function activa(n){
	if(n==1){
		document.getElementById("divshow").style.display='';	
	}else{
		document.getElementById("divshow").style.display='none';	
	}
}
function check_code_prepaye(){
	form=document.frmPrepago;
	if(validaForm(form)!=false){
		cadena=form.txtCodeprepaye.value;
		jsrsExecute("./include/check_codeprepaye.php",end_check_code_prepaye,"confirmar",cadena);
	}
}
function end_check_code_prepaye(cadena){
	form=document.frmPrepago;
	if(cadena!=0){//ok
		form.subscriptionId.value=cadena;
		form.submit();
	}else{
		alert("Code PRÉPAYÉ incorrect!");
		form.txtCodeprepaye.select();
		return false;
	}
}


function return_pouce(){	
	document.location="coups_pouce.php";	
}

function end_reserve_pouce(){
	document.location="end_reserve_pouce.php?confirm=1";
}

function validaFormFree(){
	if(document.getElementById('cbo_day').value=='0' || document.getElementById('cbo_month').value=='0' || document.getElementById('cbo_year').value=='0000'){
		alert("Le champ \"Date limite\" est obligatorie");
		return false;
	}	
}

function validaFormFreeNew(){
	
	if(document.getElementById('cbo_user').value=='0'){
		alert("Le champ \"Member\" est obligatorie");
		document.getElementById('cbo_user').focus();
		document.getElementById('cbo_user').style.background='#FFFFCA';
		return false;
	}		
	
	if(document.getElementById('cbo_day').value=='0' || document.getElementById('cbo_month').value=='0' || document.getElementById('cbo_year').value=='0000'){
		alert("Le champ \"Date limite\" est obligatorie");
		return false;
	}	
}

function value_default(){
	if(document.getElementById('txtNumSubscription').value==0 || document.getElementById('txtNumSubscription').value==""){
		document.getElementById('txtNumSubscription').value=1;
	}
	if(document.getElementById('txtPlaces').value==0 || document.getElementById('txtPlaces').value==""){			
		document.getElementById('txtPlaces').value=1;
	}
}

function checkAboNew(flag){
	var flagsubmit=1;
	if(flag==0){
		if(document.getElementById('cboTypeAbono').value==0){
			alert("Le champ \"abonnement\" est obligatoire");
			document.getElementById('cboTypeAbono').focus();			
			return false;			
			flagsubmit=0;
		}
		
		if(document.getElementById('cbo_State1').value==0){
			alert("Le champ \"etat\" est obligatoire");
			document.getElementById('cbo_State1').focus();			
			return false;
			flagsubmit=0;
		}
	}
	if(flagsubmit==1){
		//alert("envio");
		document.frm01.submit();
	}
}

function checkAboEdit(flag){
	var flagsubmit=1;
	if(flag==0){
		if(document.getElementById('cboTypeAbono').value==0){
			alert("Le champ \"abonnement\" est obligatoire");
			document.getElementById('cboTypeAbono').focus();			
			return false;			
			flagsubmit=0;
		}	
	}
		
	if(document.getElementById('cboDay1').value==0){
		alert("Choisir Jour");
		document.getElementById('cboDay1').focus();
		return false;
		flagsubmit=0;
	}
	if(document.getElementById('cboMonth1').value==0){
		alert("Choisir Mois");
		document.getElementById('cboMonth1').focus();
		return false;
		flagsubmit=0;
	}
	if(document.getElementById('cboYear1').value==0){
		alert("Choisir Année");
		document.getElementById('cboYear1').focus();
		return false;
		flagsubmit=0;
	}
	
	if(document.getElementById('cboDayE').value==0){
		alert("Choisir Jour");
		document.getElementById('cboDayE').focus();
		return false;
		flagsubmit=0;
	}
	if(document.getElementById('cboMonthE').value==0){
		alert("Choisir Mois");
		document.getElementById('cboMonthE').focus();
		return false;
		flagsubmit=0;
	}
	if(document.getElementById('cboYearE').value==0){
		alert("Choisir Année");
		document.getElementById('cboYearE').focus();
		return false;
		flagsubmit=0;
	}
	
	if(document.getElementById('numplaces').value==0 || document.getElementById('numplaces').value==""){
		alert("Nombre de places est obligatoire");
		document.getElementById('numplaces').focus();
		return false;
		flagsubmit=0;
	}
	
	
	if(document.getElementById('cbo_State1').value==0){
			alert("Le champ \"etat\" est obligatoire");
			document.getElementById('cbo_State1').focus();			
			return false;
			flagsubmit=0;
	}
	
	if(flagsubmit==1){
		//alert("envio");
		document.frm01.submit();
	}
}

function changeCodeParnert(){
	idPartner=document.getElementById("cbo_Partner").value;
	idUser=document.getElementById("idUser").value;
	cadena=idUser+","+idPartner;
	//alert(cadena);
	jsrsExecute("change_abo_partner.php",end_changeAbonnemetPartner,"confirmar",cadena);
}

function end_changeAbonnemetPartner(param){
	data=param;
	//alert(data);
	if(data==1)
		document.getElementById("msgChange").innerHTML=" Modifié! ";		
}

function jstype_reserve(){
	if(document.getElementById('type_reserve').value==1 || document.getElementById('type_reserve').value==0){
		document.getElementById('txtTarifa').value="0.00";
		document.getElementById('showCheck').style.display="none";
		document.getElementById('typePay').style.display="none";
		document.getElementById('chck').checked=true;
		document.getElementById('txtTotal').value="";
		//document.getElementById('txtNumReserve').value="";
		document.getElementById('cboTypePay').value="0";
	}else{			
		idHour=document.getElementById('cboRepresentation').value;
		type_rese=document.getElementById('type_reserve').value
		cadena=idHour+","+type_rese;
		//alert(cadena);
		jsrsExecute("price_representation.php",price_representation,"confirmar",cadena);
	}
}

function price_representation(param){
	//alert(param);
	datos=param.split("|");
	$price_tn=datos[0];
	$price_ta=datos[1];
	type_rese=document.getElementById('type_reserve').value
	
	if(type_rese==2){
		document.getElementById('txtTarifa').value=$price_tn;
	}else{
		document.getElementById('txtTarifa').value=$price_ta;
	}
	
	tot=document.getElementById('txtNumReserve').value*document.getElementById('txtTarifa').value;
	document.getElementById('txtTotal').value=tot;
		
	document.getElementById('showCheck').style.display="";
}

function submit_key(){
	if(event.keyCode==13){
		form=document.searchskey;
		form.submit();
	}
}

function contCaract(field, countfield, maxlimit) {
	if (field.value.length > maxlimit)
		field.value = field.value.substring(0, maxlimit);
	else 
		countfield.value = maxlimit - field.value.length;
}

function activaBtn(){
	cont=document.getElementById('RegTot').value;
	var num_check=0;
	for(i=0;i<cont;i++){
		if(document.getElementById("idHourChk"+i).checked){
			num_check++;
			document.getElementById("desactiver"+i).disabled="";
			document.getElementById("bloque"+i).disabled="";
			document.getElementById("delete"+i).disabled="";
			document.getElementById("pouce"+i).disabled="";
			
			document.getElementById("hh"+i).disabled="";
			document.getElementById("mm"+i).disabled="";
			document.getElementById("TN"+i).disabled="";
			document.getElementById("TA"+i).disabled="";
			document.getElementById("INV"+i).disabled="";
			
			document.getElementById("PrixTn"+i).disabled="";
			document.getElementById("PrixTa"+i).disabled="";
			
		}else{
			document.getElementById("desactiver"+i).disabled="true";
			document.getElementById("bloque"+i).disabled="true";
			document.getElementById("delete"+i).disabled="true";
			document.getElementById("pouce"+i).disabled="true";
			
			document.getElementById("hh"+i).disabled="true";
			document.getElementById("mm"+i).disabled="true";
			document.getElementById("TN"+i).disabled="true";
			document.getElementById("TA"+i).disabled="true";
			document.getElementById("INV"+i).disabled="true";
			
			document.getElementById("PrixTn"+i).disabled="true";
			document.getElementById("PrixTa"+i).disabled="true";
		}
	}
	if(num_check>0){
		document.getElementById("btnModifier").style.display="";
		document.getElementById("btnModifier2").style.display="";
	}else{
		document.getElementById("btnModifier").style.display="none";
		document.getElementById("btnModifier2").style.display="none";
		
		for (i=0;i<document.frmModifier.elements.length;i++){
			if(document.frmModifier.elements[i].type == "checkbox")	
				document.frmModifier.elements[i].checked=0
		}
	}
}

function formatTime(obj){
	string=document.getElementById(obj).value;

	if(string.length==1){
		document.getElementById(obj).value="0"+string;
	}
	if(string=="" || string=="00"){
		alert("Le champ es obligatoire");
		document.getElementById(obj).focus();
	}
}

function check(obj1,obj2,obj3){
	if(document.getElementById(obj1).checked){
		document.getElementById(obj2).checked="";
		document.getElementById(obj3).checked="";
	}
}

function placeReservable(){
	idProduct=document.getElementById('idProduct').value;
	numReserver=document.getElementById('numPlaceReservable').value;		
	cadena=idProduct+","+numReserver;
	jsrsExecute("add_num_reserver.php",end_add_num_reserver,"confirmar",cadena);	
}

function end_add_num_reserver(param){
	// NO BORRAR ESTA FUNCION ES IMPORTANTE	
}

//#@funcion que compara dos fechas 
   function esDigito(sChr){  
    var sCod = sChr.charCodeAt(0);  
    return ((sCod > 47) && (sCod < 58));  
   }  

   function valSep(oTxt){  
    var bOk = false;  
    bOk = bOk || ((oTxt.value.charAt(2) == "-") && (oTxt.value.charAt(5) == "-"));  
    bOk = bOk || ((oTxt.value.charAt(2) == "/") && (oTxt.value.charAt(5) == "/"));  
    return bOk;  
   }  

   function finMes(oTxt){  
    var nMes = parseInt(oTxt.value.substr(3, 2), 10);  
    var nAno = parseInt(oTxt.value.substr(6), 10);  
    var nRes = 0;  
    switch (nMes){  
     case 1: nRes = 31; break;  
     case 2: nRes = 28; break;  
     case 3: nRes = 31; break;  
     case 4: nRes = 30; break;  
     case 5: nRes = 31; break;  
     case 6: nRes = 30; break;  
     case 7: nRes = 31; break;  
     case 8: nRes = 31; break;  
     case 9: nRes = 30; break;  
     case 10: nRes = 31; break;  
     case 11: nRes = 30; break;  
     case 12: nRes = 31; break;  
    }  
    return nRes + (((nMes == 2) && (nAno % 4) == 0)? 1: 0);  
   }  

   function valDia(oTxt){  
    var bOk = false;  
    var nDia = parseInt(oTxt.value.substr(0, 2), 10);  
    bOk = bOk || ((nDia >= 1) && (nDia <= finMes(oTxt)));  
    return bOk;  
   }  

   function valMes(oTxt){  
    var bOk = false;  
    var nMes = parseInt(oTxt.value.substr(3, 2), 10);  
    bOk = bOk || ((nMes >= 1) && (nMes <= 12));  
    return bOk;  
   }  

   function valAno(oTxt){  
    var bOk = true;  
    var nAno = oTxt.value.substr(6);  
    bOk = bOk && ((nAno.length == 2) || (nAno.length == 4));  
    if (bOk){  
     for (var i = 0; i < nAno.length; i++){  
      bOk = bOk && esDigito(nAno.charAt(i));  
     }  
    }  
    return bOk;  
   }  

   function valFecha(oTxt){  
    var bOk = true;  
    if (oTxt.value != ""){  
     bOk = bOk && (valAno(oTxt));  
     bOk = bOk && (valMes(oTxt));  
     bOk = bOk && (valDia(oTxt));  
     bOk = bOk && (valSep(oTxt));  
     return bOk;  
    }  
   }  

   function fechaMayorOIgualQue(fec0, fec1){  
    var bRes = false;  
    var sDia0 = fec0.value.substr(0, 2);  
    var sMes0 = fec0.value.substr(3, 2);  
    var sAno0 = fec0.value.substr(6, 4);  
    var sDia1 = fec1.value.substr(0, 2);  
    var sMes1 = fec1.value.substr(3, 2);  
    var sAno1 = fec1.value.substr(6, 4);  
    if (sAno0 > sAno1) bRes = true;  
    else {  
     if (sAno0 == sAno1){  
      if (sMes0 > sMes1) bRes = true;  
      else {  
       if (sMes0 == sMes1)  
        if (sDia0 >= sDia1) bRes = true;  
      }  
     }  
    }  
    return bRes;  
   }  

   function valFechas(ruta){  
    var bOk = false;  
    if (valFecha(document.frmBusqueda.textDate)){  
     if (valFecha(document.frmBusqueda.textDate2)){  
      if (fechaMayorOIgualQue(document.frmBusqueda.textDate2, document.frmBusqueda.textDate)){  
       bOk = true;  
       //alert("Ok la fecha ");  
	   /// todo esta ok comparacion de los datos 
		var propControl = new Array();
		debecontar=0;
		contar=0;
		validar=0;
		vacios=0;
			for(var i=0; i<ruta.elements.length; i++){
				controlAct=ruta.elements[i];
				if(ruta.elements[i].title.indexOf("*")!=-1){//si existe * entonces valida datos del control actual
					propControl = ruta.elements[i].title.split("*");
					//alert(propControl[1]);
					if(propControl[1].indexOf("r")!= -1){//si es diferente de -1 entonces es un control requerido
						if(controlAct.value=="" || controlAct.value=="0"){
							alert("Le champ \""+propControl[0]+"\" est obligatoire");
							controlAct.focus();
							return false;
							break;
						}
					}
				}
			}
      } else {  
       alert("Le rang de dates est incorrect");  
       document.frmBusqueda.textDate2.focus();
	   return false;  
      }  
     } else {  
      alert("Date incorrecte");  
      document.frmBusqueda.textDate2.focus();  
	  return false; 
     }  
    } else {  
     alert("Date incorrecte");  
     document.frmBusqueda.textDate.focus(); 
	 return false; 
    } 
	
   }  
//#@ fin de la funcion que compara dos fechas 

function keyPressLogin(e){
	//alert(event.keyCode);
	//document.getElementById("btn_enviar").disabled="true";
	tecla=(document.all)?(event.keyCode):(e.which);

	if(tecla==13){
		checkLoginAbonne2();
	}
}

function checkLoginAbonne2(){
	var oklogin=true;
	var okpass=true;
	if(document.getElementById("txtLogin").value=="Identification"){		
		alert("Le champ \"Identification\" est obligatorie");
		document.getElementById("txtLogin").value="";
		document.getElementById("txtLogin").focus();
		return false;
		oklogin=false;
	}
	if(document.getElementById("txtPassword").value=="Votre mot de passe"){
		alert("Le champ \"Mot de passe\" est obligatorie");
		document.getElementById("txtPassword").value="";
		document.getElementById("txtPassword").focus();
		return false;
		okpass=false;
	}
	
	if(oklogin && okpass){
		cadena=document.getElementById("txtLogin").value+","+document.getElementById("txtPassword").value;		
		jsrsExecute("./include/check_login_index.php",end_login_index,"confirmar",cadena);
	}
}

function end_login_index(param){
	form=document.frmLogin;

	data=param.split("|");	
	loginOk=data[0];
	
	document.getElementById('errorLogin').style.display='none';
	
	if(loginOk==1){
		form.submit();
	}else{
		document.getElementById('errorLogin').style.display=''
		setTimeout("divLogin()",4000);
	}	
}

function divLogin(){
	document.getElementById('errorLogin').style.display='none';
	document.getElementById("txtLogin").value="Identification"
	document.getElementById("txtPassword").value="Votre mot de passe";
	document.getElementById("txtLogin").focus();
}

function show_form_abo(e){
	byId=document.getElementById;		
	
	if(document.getElementById('cboUser').value!="" && e==1){
		document.getElementById('frmAbo').style.display="";
	}else{
		document.getElementById('frmAbo').style.display="none";
		byId('cbo_Partner').value="";
		byId('numPlaces').value="";
		//byId('txtVersion').value="";
		byId('txtDuration').value="";
		byId('txtMonto').value="";
	}
}

function submit_form(){
	if(document.getElementById('cboUser').value==""){
		alert("Error!. Sélectionnez le abonné");
		document.getElementById('cboUser').focus();
	}else{
		if(document.getElementById('numPlaces').value=="" || document.getElementById('numPlaces').value==0){
			alert("Error!. Nombre de places");
			document.getElementById('numPlaces').focus();
			return false;
		}
		if(document.getElementById('txtDuration').value=="" || document.getElementById('txtDuration').value==0){
			alert("Error!. Durée d'abonnement ");
			document.getElementById('txtDuration').focus();
			return false;
		}
		if(document.getElementById('txtMonto').value=="" || document.getElementById('txtMonto').value==0){
			alert("Error!. Montant de l'abonnement");
			document.getElementById('txtMonto').focus();
			return false;
		}
		if(document.getElementById('cboTypePay').value==""){
			alert("Error!. Type de Paiement");
			document.getElementById('cboTypePay').focus();
			return false;
		}
		
		document.frm01.submit();
	}	
}

function check_user_abono(){
	var idUser;	
	idUser=document.getElementById('cboUser').value;
	cadena=idUser;
	jsrsExecute("check_user_abono.php",end_check_user_abono,"confirmar",cadena);
}

function end_check_user_abono(param){
	data=param.split("|");
	if(data==1){
		alert("Ce membre n'est pas actuellement abonné \nmais a déjà demandé un abonnement actuellement en attente.\n\nIl n'est pas possible de l'abonner.");
		show_form_abo(0);
	}else{
		show_form_abo(1);
	}
}

function show_data_abonnement(){
	var idAbono;
	idAbono=document.getElementById('cboTypeAbono').value;
	cadena=idAbono;
	jsrsExecute("show_data_abonnement.php",end_show_data_abonnement,"confirmar",cadena);	
}

function end_show_data_abonnement(param){
	data=param.split("|");
	price=data[0];
	duration=data[1];
	//places=data[2];
	version=data[3];
	typeIdFour=data[4];		
	
	byId=document.getElementById;
	
	byId('numPlaces').value=1;
	byId('txtVersion').value=version;
	byId('txtDuration').value=duration;
	byId('txtMonto').value=price;
	
	//byId('txtVersion').readOnly=true;
	if(typeIdFour!=4){
		byId('txtDuration').readOnly=true;
		byId('txtMonto').readOnly=true;
	}else{
		byId('txtDuration').readOnly=false;
		byId('txtMonto').readOnly=false;
	}
		
}

function calculaMonto(){
	byId=document.getElementById;
	var monto;
	
	if(parseFloat(byId('txtReduccion').value)<=parseFloat(byId('txtMonto').value)){
		monto=byId('txtMonto').value-byId('txtReduccion').value;	
		byId('txtMontoTotal').value=monto;
	}else{
		alert("Error!. El descuento es mayor al precio");	
		byId('txtReduccion').value="";
		byId('txtMontoTotal').value=byId('txtMonto').value;
	}
}
function fenetreCent(largeur,hauteur){
	var haut=(screen.height-hauteur)/2;
	var Gauche=(screen.width-largeur)/2;
	window.open('http://admin.clubvisioscene.com/scripts-internes/newsletter/abonnement/abonnement.html','AbonnementNewsletter','top='+haut+',left='+Gauche+',width='+largeur+',height='+hauteur+',menubar=no,scrollbars=no,statusbar=no');
}