compartir_ids=new Array()
compartir_ids[0]="tu_nombre"
compartir_ids[1]="tu_email"
compartir_ids[2]="su_nombre"
compartir_ids[3]="su_email"

compartir_txt=new Array()
compartir_txt[0]="Tu nombre"
compartir_txt[1]="Tu Email"
compartir_txt[2]="Nombre de tu amigo"
compartir_txt[3]="Email de tu amigo"

compartir_rto=new Array()
compartir_rto[0]="Ingresa tu Nombre"
compartir_rto[1]="Ingresa tu Email"
compartir_rto[2]="Ingresa el nombre de tu amigo"
compartir_rto[3]="Ingresa el email de tu amigo"

function validar_compartir(linker,referencia){
	for (i = 0; i < compartir_ids.length; i++){
		document.getElementById(compartir_ids[i]+"_txt").innerHTML="<font class=texto_blanco>"+compartir_txt[i]+"</font>"
	}
	for (i = 0; i < compartir_ids.length; i++){
		if(document.getElementById(compartir_ids[i]).value == ""){
			document.getElementById(compartir_ids[i]+"_txt").innerHTML="<font class=texto_rojo_14>"+compartir_txt[i]+"</font>"
			document.getElementById("retorno_informacion_compartir").innerHTML="<font class=texto_blanco><b>"+compartir_rto[i]+"</b></font>"
			document.getElementById(compartir_ids[i]).focus()
			return
		} else {
			document.getElementById(compartir_ids[i]+"_txt").innerHTML="<font class=texto_blanco>"+compartir_txt[i]+"</font>"
		}
		if(i == 1){
			if(!Emailcheck(document.getElementById(compartir_ids[i]).value)){
				document.getElementById(compartir_ids[i]+"_txt").innerHTML="<font class=texto_rojo_14>"+compartir_txt[i]+"</font>"
				document.getElementById("retorno_informacion_compartir").innerHTML="<font class=texto_blanco><b>"+compartir_rto[i]+" correctamente</b></font>"
				document.getElementById(compartir_ids[i]).focus()
				return
			}
		}
		if(i == 3){
			if(!Emailcheck(document.getElementById(compartir_ids[i]).value)){
				document.getElementById(compartir_ids[i]+"_txt").innerHTML="<font class=texto_rojo_14>"+compartir_txt[i]+"</font>"
				document.getElementById("retorno_informacion_compartir").innerHTML="<font class=texto_blanco><b>"+compartir_rto[i]+" correctamente</b></font>"
				document.getElementById(compartir_ids[i]).focus()
				return
			}
		}
	}
	if(document.getElementById(compartir_ids[1]).value == document.getElementById(compartir_ids[3]).value){
		document.getElementById(compartir_ids[1]+"_txt").innerHTML="<font class=texto_rojo_14>"+compartir_txt[1]+"</font>"
		document.getElementById(compartir_ids[3]+"_txt").innerHTML="<font class=texto_rojo_14>"+compartir_txt[3]+"</font>"
		document.getElementById("retorno_informacion_compartir").innerHTML="<font class=texto_blanco><b>Tu amigo tiene el mismo email que vos ?</b></font>"
		return
	}
	document.getElementById("retorno_informacion_compartir").innerHTML="<img src=imgs/loader_referencia.gif width=26 height=26>"
	from_nombre=trim(document.getElementById(compartir_ids[0]).value)
	from_email=document.getElementById(compartir_ids[1]).value
	to=document.getElementById(compartir_ids[3]).value
	asunto="te lo recomiendo"
	msg=trim(document.getElementById(compartir_ids[2]).value)+',\n'+trim(document.getElementById(compartir_ids[0]).value)+' te recomienda que veas lo siguiente:\n\n'+share_link+'\n'+share_referencia_tipo+' '+share_referencia+'\n\n\n\nelectrorock producciones\nhttp://www.electrorockweb.com.ar\n\n';
	send_form(limpiar_texto(from_nombre),limpiar_texto(from_email),to,asunto,limpiar_texto(msg))
}

valores_contacto=new Array()
valores_contacto[0]="Nombre"
valores_contacto[1]="Email"
valores_contacto[2]="Comentarios"

valores_retorno=new Array()
valores_retorno[0]="Ingresa tu Nombre"
valores_retorno[1]="Ingresa tu Email"
valores_retorno[2]="Ingresa tus Comentarios"

function validar_contacto(){
	for (i = 0; i < valores_contacto.length; i++){
		document.getElementById(valores_contacto[i]+"_txt").innerHTML="<font class=texto_negro_12>"+valores_contacto[i]+":</font>"
	}
	for (i = 0; i < valores_contacto.length; i++){
		if(document.getElementById(valores_contacto[i]+"_input").value == ""){
			document.getElementById(valores_contacto[i]+"_txt").innerHTML="<font class=texto_rojo_12>"+valores_contacto[i]+":</font>"
			document.getElementById("retorno_informacion").innerHTML="<font class=texto_negro_12><b>"+valores_retorno[i]+"</b></font>"
			document.getElementById(valores_contacto[i]+"_input").focus()
			return
		} else {
			document.getElementById(valores_contacto[i]+"_txt").innerHTML="<font class=texto_negro_12>"+valores_contacto[i]+":</font>"
		}
		if(i == 1){
			if(!Emailcheck(document.getElementById(valores_contacto[i]+"_input").value)){
				document.getElementById(valores_contacto[i]+"_txt").innerHTML="<font class=texto_rojo_12>"+valores_contacto[i]+":</font>"
				document.getElementById("retorno_informacion").innerHTML="<font class=texto_negro_12><b>"+valores_retorno[i]+" correctamente</b></font>"
				document.getElementById(valores_contacto[i]+"_input").focus()
				return
			}
		}
	}
	document.getElementById("retorno_informacion").innerHTML="<img src=imgs/loader_form.gif width=26 height=26>"
	from_nombre=trim(document.getElementById(valores_contacto[0]+"_input").value)
	from_email=document.getElementById(valores_contacto[1]+"_input").value
	to="info@electrorockweb.com.ar"
//	to="info@mediajobs.com.ar"
	asunto="contactenos website"
	msg="";
	for (i = 0; i < valores_contacto.length; i++){
		if(msg != ""){msg = msg + "\n"}
		if(i == 2){separacion="\n"}
		else{separacion=" "}
		msg=msg + valores_contacto[i] + ":" + separacion + trim(document.getElementById(valores_contacto[i]+"_input").value)
	}
	send_form(limpiar_texto(from_nombre),limpiar_texto(from_email),to,asunto,limpiar_texto(msg))
}

acreditacion_ids=new Array()
acreditacion_ids[0]="nombre"
acreditacion_ids[1]="tipo"
acreditacion_ids[2]="localidad"
acreditacion_ids[3]="provincia"
acreditacion_ids[4]="pais"
acreditacion_ids[5]="telefono"
acreditacion_ids[6]="email"
acreditacion_ids[7]="web"
acreditacion_ids[8]="director"
acreditacion_ids[9]="nombre2"
acreditacion_ids[10]="documento_tipo"
acreditacion_ids[11]="documento_nro"
acreditacion_ids[12]="telefono_2"
acreditacion_ids[13]="email_2"
acreditacion_ids[14]="funcion"
acreditacion_ids[15]="con_alguien"
acreditacion_ids[16]="acreditado"
acreditacion_ids[17]="show"
acreditacion_ids[18]="detalle"

acreditacion_txt=new Array()
acreditacion_txt[0]="Nombre"
acreditacion_txt[1]="Tipo"
acreditacion_txt[2]="Localidad"
acreditacion_txt[3]="Provincia"
acreditacion_txt[4]="País"
acreditacion_txt[5]="Telefono"
acreditacion_txt[6]="Email"
acreditacion_txt[7]="Sitio web"
acreditacion_txt[8]="Director"
acreditacion_txt[9]="Nombre"
acreditacion_txt[10]="Documento tipo"
acreditacion_txt[11]="Documento nro"
acreditacion_txt[12]="Telefono"
acreditacion_txt[13]="Email"
acreditacion_txt[14]="Función"
acreditacion_txt[15]="¿Quién solicita será acompañado por un Fotógrafo ó Camarógrafo?"
acreditacion_txt[16]="¿Ha sido acreditado con anterioridad a otros eventos realizados por<br>ELECTROROCK PRODUCCIONES?"
acreditacion_txt[17]="Show al cual desea acreditarse"
acreditacion_txt[18]="Detalle como difundió o va a difundir el show"

acreditacion_rto=new Array()
acreditacion_rto[0]="Ingresa el Nombre del medio"
acreditacion_rto[1]="Selecciona el Tipo de medio"
acreditacion_rto[2]="Ingresa la Localidad del medio"
acreditacion_rto[3]="Ingresa la Provincia del medio"
acreditacion_rto[4]="Ingresa el País del medio"
acreditacion_rto[5]="Ingresa el Telefono del medio"
acreditacion_rto[6]="Ingresa el Email del medio"
acreditacion_rto[7]="Ingresa el Sitio web del medio"
acreditacion_rto[8]="Ingresa el Director del medio"
acreditacion_rto[9]="Ingresa tu Nombre"
acreditacion_rto[10]="Selecciona el tipo de tu documento"
acreditacion_rto[11]="Ingresa el número de tu documento"
acreditacion_rto[12]="Ingresa tu Telefono"
acreditacion_rto[13]="Ingresa tu Email"
acreditacion_rto[14]="Selecciona tu Función"
acreditacion_rto[15]="¿Venis acompañado?"
acreditacion_rto[16]="¿Has sido acreditado con anterioridad?"
acreditacion_rto[17]="Selecciona el show"
acreditacion_rto[18]="Detalle como difundió o va a difundir el show"

function validar_acreditacion(){
	for (i = 0; i < acreditacion_ids.length; i++){
		document.getElementById(acreditacion_ids[i]+"_txt").innerHTML="<font class=texto_negro_12>"+acreditacion_txt[i]+":</font>"
	}
	for (i = 0; i < acreditacion_ids.length; i++){
		if(document.getElementById(acreditacion_ids[i]).value == ""){
			document.getElementById(acreditacion_ids[i]+"_txt").innerHTML="<font class=texto_rojo_12>"+acreditacion_txt[i]+":</font>"
			document.getElementById("retorno_informacion").innerHTML="<font class=texto_negro_12><b>"+acreditacion_rto[i]+"</b></font>"
			if(i != 10){
				if(i != 15){
					if(i != 16){
						document.getElementById(acreditacion_ids[i]).focus()
					}
				}
			}
			return
		} else {
			document.getElementById(acreditacion_ids[i]+"_txt").innerHTML="<font class=texto_negro_12>"+acreditacion_txt[i]+":</font>"
		}
		if(i == 6){
			if(!Emailcheck(document.getElementById(acreditacion_ids[i]).value)){
				document.getElementById(acreditacion_ids[i]+"_txt").innerHTML="<font class=texto_rojo_12>"+acreditacion_txt[i]+":</font>"
				document.getElementById("retorno_informacion").innerHTML="<font class=texto_negro_12><b>"+acreditacion_rto[i]+" correctamente</b></font>"
				document.getElementById(acreditacion_ids[i]).focus()
				return
			}
		}
		if(i == 13){
			if(!Emailcheck(document.getElementById(acreditacion_ids[i]).value)){
				document.getElementById(acreditacion_ids[i]+"_txt").innerHTML="<font class=texto_rojo_12>"+acreditacion_txt[i]+":</font>"
				document.getElementById("retorno_informacion").innerHTML="<font class=texto_negro_12><b>"+acreditacion_rto[i]+" correctamente</b></font>"
				document.getElementById(acreditacion_ids[i]).focus()
				return
			}
		}
	}
	document.getElementById("retorno_informacion").innerHTML="<img src=imgs/loader_form.gif width=26 height=26>"
	from_nombre=trim(document.getElementById(acreditacion_ids[9]).value)
	from_email=document.getElementById(acreditacion_ids[13]).value
	to="prensa@electrorockweb.com.ar"
//	to="info@mediajobs.com.ar"
	asunto="acreditaciones website"
	msg="";
	for (i = 0; i < acreditacion_ids.length; i++){
		if(i == 0){msg=msg+"Información del medio al cual representa\n"}
		if(i == 9){msg=msg+"\n\nDatos del solicitante\n"}
		if(i == 17){msg=msg+"\n\nShow\n"}
		if(msg != ""){msg = msg + "\n"}
		dato=acreditacion_txt[i]
		dato=dato.replace(/<br>/g," ");
		msg=msg + dato + ": " + trim(document.getElementById(acreditacion_ids[i]).value)
	}
	send_form(limpiar_texto(from_nombre),limpiar_texto(from_email),to,asunto,limpiar_texto(msg))
}
function send_form(from_nombre,from_email,to,asunto,msg){
	if (window.XMLHttpRequest) {
		xmlhttp_send_form=new XMLHttpRequest();
	} else {
		xmlhttp_send_form=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp_send_form.onreadystatechange=function() {
		if (xmlhttp_send_form.readyState==4 && xmlhttp_send_form.status==200) {
			if(document.getElementById("retorno_informacion")){
				if(document.getElementById("Comentarios_input")){
					document.getElementById("Comentarios_input").value=''
				}
				if(document.getElementById("show")){
					document.getElementById("show").selectedIndex=0
				}
				document.getElementById("retorno_informacion").innerHTML='<font class=texto_negro_12><b>'+xmlhttp_send_form.responseText+'</b></font>'
			}
			if(document.getElementById("retorno_informacion_compartir")){
				document.getElementById("su_nombre").value=''
				document.getElementById("su_email").value=''
				document.getElementById("retorno_informacion_compartir").innerHTML='<font class=texto_blanco><b>'+xmlhttp_send_form.responseText+'</b></font>'
			}
		}
	}
	xmlhttp_send_form.open("GET","send_form.php?from_nombre="+from_nombre+"&from_email="+from_email+"&to="+to+"&asunto="+asunto+"&msg="+msg,true);
	xmlhttp_send_form.send();
}
function limpiar_texto(txt){
	msg_limpio=txt
	msg_limpio=msg_limpio.replace(/&/g,"[signo_and]");
	msg_limpio=msg_limpio.replace(/\"/g,"´");
	msg_limpio=msg_limpio.replace(/\'/g,"´");
	msg_limpio=msg_limpio.replace(/\?/g,"[signo_pregunta]");
	msg_limpio=msg_limpio.replace(/\+/g,"[signo_mas]");
	msg_limpio=msg_limpio.replace(/\n/g,"[nueva_linea]");
	return msg_limpio
}
function trim(cadena){
	str = cadena.replace(/^\s*|\s*$/g,"");
	return str
}
function Emailcheck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){ return false }
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return false }
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ return false }
	if (str.indexOf(at,(lat+1))!=-1){ return false }
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ return false }
	if (str.indexOf(dot,(lat+2))==-1){ return false }
	if (str.indexOf(" ")!=-1){ return false }
	ext=str.substring(ldot+1)
	for(ind=0; ind < ext.length; ind++){
		letra=ext.charAt(ind)
		if(!letra.match(/[a-zA-Z]/)){
			if(letra != '.'){
				return false
			}
		}
	}
	return true
}
