document.oncontextmenu=function(){return false}
document.onselectstart=function(){if(event.srcElement.type!="text"&&event.srcElement.type!="textarea"&&event.srcElement.type!="password")
return false
else return true;};if(window.sidebar){document.onmousedown=function(e){var obj=e.target;if(obj.tagName.toUpperCase()=="INPUT"||obj.tagName.toUpperCase()=="TEXTAREA"||obj.tagName.toUpperCase()=="PASSWORD")
return true;else
return false;}}
document.ondragstart=function(){return false}
function llenar_combo_localidad(){var listalocalidades=document.getElementById("lista_localidades");var select_provincia=document.getElementById("provincias");var select_localidad=document.getElementById("localidades");var ItemLocalidad=listalocalidades.value.split("+");var SubItemLocalidad;select_localidad.options.length=0
opcioncur=document.createElement("OPTION");opcioncur.value="TODAS";opcioncur.innerHTML="TODAS";select_localidad.appendChild(opcioncur);if(ItemLocalidad.length>0){for(i=0;i<ItemLocalidad.length;i++){SubItemLocalidad=ItemLocalidad[i].split("|");if(SubItemLocalidad.length>0){if(SubItemLocalidad[2]==select_provincia.value){opcioncur=document.createElement("OPTION");opcioncur.value=SubItemLocalidad[0];opcioncur.innerHTML=SubItemLocalidad[1];select_localidad.appendChild(opcioncur);}}}}}
function llenar_combo_localidad_registro(){var listalocalidades=document.getElementById("lista_localidad");var select_provincia=document.getElementById("provincia");var select_localidad=document.getElementById("localidad");var ItemLocalidad=listalocalidades.value.split("+");var SubItemLocalidad;select_localidad.options.length=0
opcioncur=document.createElement("OPTION");opcioncur.value="TODAS";opcioncur.innerHTML="TODAS";select_localidad.appendChild(opcioncur);if(ItemLocalidad.length>0){for(i=0;i<ItemLocalidad.length;i++){SubItemLocalidad=ItemLocalidad[i].split("|");if(SubItemLocalidad.length>0){if(SubItemLocalidad[2]==select_provincia.value){opcioncur=document.createElement("OPTION");opcioncur.value=SubItemLocalidad[0];opcioncur.innerHTML=SubItemLocalidad[1];select_localidad.appendChild(opcioncur);}}}}}
function llenar_combo_localidad_Farmacias(){var listalocalidades=document.getElementById("lista_localidadesFarmacias");var select_provincia=document.getElementById("provinciasFarmacias");var select_localidad=document.getElementById("localidadesFarmacias");var ItemLocalidad=listalocalidades.value.split("+");var SubItemLocalidad;select_localidad.options.length=0
opcioncur=document.createElement("OPTION");opcioncur.value="TODAS";opcioncur.innerHTML="TODAS";select_localidad.appendChild(opcioncur);if(ItemLocalidad.length>0){for(i=0;i<ItemLocalidad.length;i++){SubItemLocalidad=ItemLocalidad[i].split("|");if(SubItemLocalidad.length>0){if(SubItemLocalidad[2]==select_provincia.value){opcioncur=document.createElement("OPTION");opcioncur.value=SubItemLocalidad[0];opcioncur.innerHTML=SubItemLocalidad[1];select_localidad.appendChild(opcioncur);}}}}}
function buscar(path){var provincia=document.getElementById("provincias");var localidad=document.getElementById("localidades");var rubro=document.getElementById("rubros");var raz_soc=document.getElementById("raz_soc");var text_avi=document.getElementById("text_avi");var texto=document.getElementById("texto");var parametros="";if(provincia.value!='TODAS')parametros=parametros+"prov="+provincia.value+"&";if(localidad.value!='TODAS')parametros=parametros+"loc="+localidad.value+"&";if(rubro.value!='TODOS')parametros=parametros+"rub="+rubro.value+"&";if(texto.value){if(raz_soc.checked==true)parametros=parametros+"raz_soc="+texto.value+"&";if(text_avi.checked==true)parametros=parametros+"text_avi="+texto.value+"";}
window.open(path+'resultados.php?'+parametros,'_self')}
function BuscarServ(tipo){var provincia=document.getElementById("provincias");var localidad=document.getElementById("localidades");var ped_of=document.getElementById("tipo");var parametros="tipo="+tipo;if(provincia.value!='TODAS')parametros=parametros+"&prov="+provincia.value;if(localidad.value!='TODAS')parametros=parametros+"&loc="+localidad.value;if(ped_of.value!='TODOS')parametros=parametros+"&ped_of="+ped_of.value+"";window.open('servicios.php?'+parametros,'_self')}
function cambiarborde(obj,modo,pathimg){var tabl=document.getElementById(obj);switch(modo){case 0:tabl.src=pathimg+"/banner7.png";break;case 1:tabl.src=pathimg+"/banner7a.png";break;}
return 0;}
function verificardni(){var dni=document.getElementById("dni");var listadni=document.getElementById("listadni");array_dni=listadni.value.split(";");if(validarNumero(dni.value)==false){alert("DNI Invalido");}
else if(dni.value.length<6||dni.value.length>10){alert("DNI Invalido");}
else if(array_dni.length>0){for(i=0;i<array_dni.length;i++){if(array_dni[i]==dni.value){alert("Los datos del DNI ingresado ya estan registrados");}}}}
function maximaLongitud(texto,maxlong){var tecla,int_value,out_value;if(texto.value.length>maxlong){in_value=texto.value;out_value=in_value.substring(0,maxlong);texto.value=out_value;alert("La longitud máxima es de "+maxlong+" caractéres");return false;}
return true;}
function grabar(modo){var iSeguir=true;var mensaje="";var iAux=false;var confirmar=false;var s=document.getElementById("sqll");var nombre=document.getElementById("nombre");var apellido=document.getElementById("apellido");var dni=document.getElementById("dni");var telefono1=document.getElementById("telefono1");var telefono2=document.getElementById("telefono2");var mail=document.getElementById("mail");var provincia=document.getElementById("provincia");var localidad=document.getElementById("localidad");var cp=document.getElementById("cp");var calle=document.getElementById("calle");var numero=document.getElementById("numero");if(!nombre.value){mensaje=mensaje+"Falta ingresar el Nombre.\n";iSeguir=false;}
if(!apellido.value){mensaje=mensaje+"Falta ingresar el Apellido.\n";iSeguir=false;}
if(provincia.value=='TODAS'){mensaje=mensaje+"Falta ingresar la Provincia\n";iSeguir=false;}
if(localidad.value=='TODAS'){mensaje=mensaje+"Falta ingresar la Localidad\n";iSeguir=false;}
if(!calle.value){mensaje=mensaje+"Falta ingresar la Calle\n";iSeguir=false;}
if(!numero.value){mensaje=mensaje+"Falta ingresar el Numero\n";iSeguir=false;}else{if(numero.value){if(validarNumero(numero.value)==false){mensaje=mensaje+"Numero de calle es Incorrecto\n";iSeguir=false;}}}
if(telefono1.value)iAux=true;if(telefono2.value)iAux=true;if(mail.value)iAux=true;if(iAux==false){mensaje=mensaje+"Coloque al menos un metodo de contacto: Telefono / mail\n";iSeguir=false;}
if(mail.value){}
if(iSeguir==true){confirmar=confirm("Confirmar el Registro?");if(confirmar==true)iSeguir=true;else iSeguir=false;}
if(iSeguir==true){if(modo==0){var sql="insert into tpersona (dni, nombre, apellido, id_provincia, id_localidad, calle, numero, telefono1, telefono2, mail, cp) values(";sql=sql+"'"+dni.value+"', ";sql=sql+"'"+nombre.value+"', ";sql=sql+"'"+apellido.value+"', ";sql=sql+provincia.value+", ";sql=sql+localidad.value+", ";sql=sql+"'"+calle.value+"', ";sql=sql+numero.value+", ";sql=sql+"'"+telefono1.value+"', ";sql=sql+"'"+telefono2.value+"', ";sql=sql+"'"+mail.value+"', ";sql=sql+"'"+cp.value+"')";}else if(modo==1){var sql="update tpersona set ";sql=sql+"nombre = '"+nombre.value+"', ";sql=sql+"apellido = '"+apellido.value+"', ";sql=sql+"id_provincia ="+provincia.value+", ";sql=sql+"id_localidad = "+localidad.value+", ";sql=sql+"calle = '"+calle.value+"', ";sql=sql+"numero="+numero.value+", ";sql=sql+"telefono1 = '"+telefono1.value+"', ";sql=sql+"telefono2 = '"+telefono2.value+"', ";sql=sql+"mail = '"+mail.value+"', ";sql=sql+"cp = '"+cp.value+"' ";sql=sql+"where dni= '"+dni.value+"';";}
s.value=sql;return true;}else{alert(mensaje);return false;}}
function IngresarServicio(){var iSeguir=true;var mensaje="";var iAux=false;var confirmar=false;var s=document.getElementById("sqll");var nombre=document.getElementById("nombre");var apellido=document.getElementById("apellido");var provincia=document.getElementById("provincia");var localidad=document.getElementById("localidad");var calle=document.getElementById("calle");var numero=document.getElementById("numero");var cp=document.getElementById("cp");var telefono1=document.getElementById("telefono1");var telefono2=document.getElementById("telefono2");var mail1=document.getElementById("mail1");var mail2=document.getElementById("mail2");var web=document.getElementById("web");var descripcion=document.getElementById("descripcion");var tipo=document.getElementById("tipo");var ped_of=document.getElementById("ped_of");if(!nombre.value){mensaje=mensaje+"Falta ingresar el Nombre.\n";iSeguir=false;}
if(!apellido.value){mensaje=mensaje+"Falta ingresar el Apellido.\n";iSeguir=false;}
if(provincia.value=='TODAS'){mensaje=mensaje+"Falta ingresar la Provincia\n";iSeguir=false;}
if(localidad.value=='TODAS'){mensaje=mensaje+"Falta ingresar la Localidad\n";iSeguir=false;}
if(!calle.value){mensaje=mensaje+"Falta ingresar la Calle\n";iSeguir=false;}
if(!numero.value){mensaje=mensaje+"Falta ingresar el Numero\n";iSeguir=false;}else{if(numero.value){if(validarNumero(numero.value)==false){mensaje=mensaje+"Numero de calle es Incorrecto\n";iSeguir=false;}}}
if(telefono1.value)iAux=true;if(telefono2.value)iAux=true;if(mail1.value)iAux=true;if(mail2.value)iAux=true;if(iAux==false){mensaje=mensaje+"Coloque al menos un metodo de contacto: Telefono / mail\n";iSeguir=false;}
if(mail1.value){}
if(mail2.value){}
if(iSeguir==true){confirmar=confirm("Confirmar la grabacion?");if(confirmar==true)iSeguir=true;else iSeguir=false;}
var nombrecompleto=nombre.value+" "+apellido.value;if(iSeguir==true){var sql="insert into tservicios (nombre, telefono1, telefono2, mail1, mail2, url, descripcion, id_localidad, id_provincia, calle, numero, cp, tipo, ped_of) values(";sql=sql+"'"+nombrecompleto+"', ";sql=sql+"'"+telefono1.value+"', ";sql=sql+"'"+telefono2.value+"', ";sql=sql+"'"+mail1.value+"', ";sql=sql+"'"+mail2.value+"', ";sql=sql+"'"+web.value+"', ";sql=sql+"'"+descripcion.value+"', ";sql=sql+localidad.value+", ";sql=sql+provincia.value+", ";sql=sql+"'"+calle.value+"', ";sql=sql+numero.value+", ";sql=sql+"'"+cp.value+"', ";sql=sql+"'"+tipo.value+"', ";sql=sql+"'"+ped_of.value+"')";s.value=sql;return true;}else{alert(mensaje);return false;}}
function AltaAviso(usuario,id_usuario,destacado){var iSeguir=true;var mensaje="";var iAux=false;var confirmar=false;var s=document.getElementById("sqll");var s2=document.getElementById("sql2");var razon_social=document.getElementById("razon_social");var razonsocial=document.getElementById("razonsocial");var telefono1=document.getElementById("telefono1");var telefono2=document.getElementById("telefono2");var mail1=document.getElementById("mail1");var mail2=document.getElementById("mail2");var web=document.getElementById("url");var rubro=document.getElementById("rubro");var rubro2=document.getElementById("rubro2");var provincia=document.getElementById("provincia");var localidad=document.getElementById("localidad");var calle=document.getElementById("calle");var numero=document.getElementById("numero");var cp=document.getElementById("cp");var contacto=document.getElementById("contacto");var descripcion=document.getElementById("descripcion");var ck_profesional=document.getElementById("check_profesional");var coordenadasmapa="";var frasemapa="";if(parseInt(destacado)>1){coordenadasmapa=document.getElementById("coordenadas").value;frasemapa=document.getElementById("frase").value;}
switch(parseInt(destacado)){case 3:var foto5=document.getElementById("foto5");var foto6=document.getElementById("foto6");var foto7=document.getElementById("foto7");var foto8=document.getElementById("foto8");var foto9=document.getElementById("foto9");case 2:var foto2=document.getElementById("foto2");var foto3=document.getElementById("foto3");var foto4=document.getElementById("foto4");case 1:var foto1=document.getElementById("foto1");case 0:var foto0=document.getElementById("foto0");break;}
switch(parseInt(destacado)){case 3:var archivo5=document.getElementById("archivo5");var archivo6=document.getElementById("archivo6");var archivo7=document.getElementById("archivo7");var archivo8=document.getElementById("archivo8");var archivo9=document.getElementById("archivo9");case 2:var archivo2=document.getElementById("archivo2");var archivo3=document.getElementById("archivo3");var archivo4=document.getElementById("archivo4");case 1:var archivo1=document.getElementById("archivo1");case 0:var archivo0=document.getElementById("archivo0");break;}
switch(parseInt(destacado)){case 3:foto5.value=archivo5.value;foto6.value=archivo6.value;foto7.value=archivo7.value;foto8.value=archivo8.value;foto9.value=archivo9.value;case 2:foto2.value=archivo2.value;foto3.value=archivo3.value;foto4.value=archivo4.value;case 1:foto1.value=archivo1.value;case 0:foto0.value=archivo0.value;break;}
if(!razonsocial.value){mensaje=mensaje+"Falta ingresar la Razon Social.\n";iSeguir=false;}
if(!contacto.value){mensaje=mensaje+"Falta ingresar el nombre del contacto.\n";iSeguir=false;}
if(provincia.value=='TODAS'){mensaje=mensaje+"Falta ingresar la Provincia\n";iSeguir=false;}
if(localidad.value=='TODAS'){mensaje=mensaje+"Falta ingresar la Localidad\n";iSeguir=false;}
if(!calle.value){mensaje=mensaje+"Falta ingresar la Calle\n";iSeguir=false;}
if(rubro.value==0&&!rubro2.value){mensaje=mensaje+"Falta Seleccionar el Rubro\n";iSeguir=false;}
if(!numero.value){mensaje=mensaje+"Falta ingresar el Numero\n";iSeguir=false;}
else{if(numero.value){if(validarNumero(numero.value)==false){mensaje=mensaje+"Numero de calle es Incorrecto\n";iSeguir=false;}}}
if(telefono1.value)iAux=true;if(telefono2.value)iAux=true;if(mail1.value)iAux=true;if(mail2.value)iAux=true;if(iAux==false){mensaje=mensaje+"Coloque al menos un metodo de contacto: Telefono / mail\n";iSeguir=false;}
if(mail1.value){}
if(mail2.value){}
if(iSeguir==true){confirmar=confirm("Confirmar la grabacion?");if(confirmar==true)iSeguir=true;else iSeguir=false;}
if(iSeguir==true){var sql="Alta de Nuevo Comercio\n";sql=sql+"Usuario: '"+usuario+"'\n";sql=sql+"id_usuario: '"+id_usuario+"'\n";sql=sql+"Razon Social: '"+razonsocial.value+"'\n";if(ck_profesional.checked==true)sql=sql+"Soy un Profesional\n";sql=sql+"Telefono 1: '"+telefono1.value+"'\n";sql=sql+"Telefono 2: '"+telefono2.value+"'\n";sql=sql+"Mail 1: '"+mail1.value+"'\n";sql=sql+"Mail 2: '"+mail2.value+"'\n";sql=sql+"WEB: '"+web.value+"'\n";sql=sql+"Rubro: '"+rubro.value+"'\n";sql=sql+"Rubro Alternativo: '"+rubro2.value+"'\n";sql=sql+"Provincia: '"+provincia.value+"'\n";sql=sql+"Localidad: '"+localidad.value+"'\n";sql=sql+"Calle: '"+calle.value+"'\n";sql=sql+"Numero: '"+numero.value+"'\n";sql=sql+"CP: '"+cp.value+"'\n";sql=sql+"Nombre Contacto: '"+contacto.value+"'\n";sql=sql+"coordenadasmapa: '"+coordenadasmapa+"'\n";sql=sql+"frasemapa:       '"+frasemapa+"'\n";sql=sql+"Descripcion del anuncio: '"+descripcion.value+"'\n";var sql2="insert into tcomercio(id_rubro, razon_social, contacto, borrado, cuponera, telefono1, telefono2, mail1, mail2, url, id_provincia, id_localidad, calle, numero, cp, texto, profesionales, coordenadasmapa, frasemapa,usuario, id_usuario) values(";sql2=sql2+rubro.value+", ";sql2=sql2+"'"+razonsocial.value+"', ";sql2=sql2+"'"+contacto.value+"', ";sql2=sql2+"'n', ";sql2=sql2+"'n', ";sql2=sql2+"'"+telefono1.value+"', ";sql2=sql2+"'"+telefono2.value+"', ";sql2=sql2+"'"+mail1.value+"', ";sql2=sql2+"'"+mail2.value+"', ";sql2=sql2+"'"+web.value+"', ";sql2=sql2+provincia.value+", ";sql2=sql2+localidad.value+", ";sql2=sql2+"'"+calle.value+"', ";sql2=sql2+"'"+numero.value+"', ";sql2=sql2+"'"+cp.value+"', ";sql2=sql2+"'"+descripcion.value+"', ";if(ck_profesional.checked==true)sql2=sql2+"'s', ";else sql2=sql2+"'n', ";sql2=sql2+"'"+coordenadasmapa+"', ";sql2=sql2+"'"+frasemapa+"', ";sql2=sql2+"'"+usuario+"', ";sql2=sql2+id_usuario+");";razon_social.value=razonsocial.value;s2.value=sql2;s.value=sql;return true;}else{alert(mensaje);return false;}}
function ModificaAviso(usuario,id_usuario,id_publicacion,destacado){var iSeguir=true;var mensaje="";var iAux=false;var confirmar=false;var s=document.getElementById("sqll");var s2=document.getElementById("sql2");var IdPublicacion=document.getElementById("id_publicacion");var razonsocial=document.getElementById("razonsocial");var telefono1=document.getElementById("telefono1");var telefono2=document.getElementById("telefono2");var mail1=document.getElementById("mail1");var mail2=document.getElementById("mail2");var web=document.getElementById("url");var rubro=document.getElementById("rubro");var rubro2=document.getElementById("rubro2");var provincia=document.getElementById("provincia");var localidad=document.getElementById("localidad");var calle=document.getElementById("calle");var numero=document.getElementById("numero");var cp=document.getElementById("cp");var contacto=document.getElementById("contacto");var descripcion=document.getElementById("descripcion");var ck_profesional=document.getElementById("check_profesional");var coordenadasmapa="";var frasemapa="";if(parseInt(destacado)>1){coordenadasmapa=document.getElementById("coordenadas").value;frasemapa=document.getElementById("frase").value;}
switch(parseInt(destacado)){case 3:var foto5=document.getElementById("foto5");var foto6=document.getElementById("foto6");var foto7=document.getElementById("foto7");var foto8=document.getElementById("foto8");var foto9=document.getElementById("foto9");case 2:var foto2=document.getElementById("foto2");var foto3=document.getElementById("foto3");var foto4=document.getElementById("foto4");case 1:var foto1=document.getElementById("foto1");case 0:var foto0=document.getElementById("foto0");break;}
switch(parseInt(destacado)){case 3:var archivo5=document.getElementById("archivo5");var archivo6=document.getElementById("archivo6");var archivo7=document.getElementById("archivo7");var archivo8=document.getElementById("archivo8");var archivo9=document.getElementById("archivo9");case 2:var archivo2=document.getElementById("archivo2");var archivo3=document.getElementById("archivo3");var archivo4=document.getElementById("archivo4");case 1:var archivo1=document.getElementById("archivo1");case 0:var archivo0=document.getElementById("archivo0");break;}
switch(parseInt(destacado)){case 3:foto5.value=archivo5.value;foto6.value=archivo6.value;foto7.value=archivo7.value;foto8.value=archivo8.value;foto9.value=archivo9.value;case 2:foto2.value=archivo2.value;foto3.value=archivo3.value;foto4.value=archivo4.value;case 1:foto1.value=archivo1.value;case 0:foto0.value=archivo0.value;break;}
if(!razonsocial.value){mensaje=mensaje+"Falta ingresar la Razon Social.\n";iSeguir=false;}
if(!contacto.value){mensaje=mensaje+"Falta ingresar el nombre del contacto.\n";iSeguir=false;}
if(provincia.value=='TODAS'){mensaje=mensaje+"Falta ingresar la Provincia\n";iSeguir=false;}
if(localidad.value=='TODAS'){mensaje=mensaje+"Falta ingresar la Localidad\n";iSeguir=false;}
if(!calle.value){mensaje=mensaje+"Falta ingresar la Calle\n";iSeguir=false;}
if(rubro.value=="OTRO"&&!rubro2.value){mensaje=mensaje+"Falta Seleccionar el Rubro\n";iSeguir=false;}
if(!numero.value){mensaje=mensaje+"Falta ingresar el Numero\n";iSeguir=false;}
else{if(numero.value){if(validarNumero(numero.value)==false){mensaje=mensaje+"Numero de calle es Incorrecto\n";iSeguir=false;}}}
if(telefono1.value)iAux=true;if(telefono2.value)iAux=true;if(mail1.value)iAux=true;if(mail2.value)iAux=true;if(iAux==false){mensaje=mensaje+"Coloque al menos un metodo de contacto: Telefono / mail\n";iSeguir=false;}
if(mail1.value){}
if(mail2.value){}
if(iSeguir==true){confirmar=confirm("Confirmar la grabacion?");if(confirmar==true)iSeguir=true;else iSeguir=false;}
if(iSeguir==true){var sql="Modificacion de publicacion\n";sql=sql+"razon_social    ='"+razonsocial.value+"', ";if(ck_profesional.checked==true)sql=sql+"profesionales   ='s', ";else sql=sql+"profesionales   ='n', ";sql=sql+"id_provincia    ='"+provincia.value+"', ";sql=sql+"id_localidad    ='"+localidad.value+"', ";sql=sql+"calle           ='"+calle.value+"', ";sql=sql+"numero          ='"+numero.value+"', ";sql=sql+"cp              ='"+cp.value+"', ";sql=sql+"telefono1       ='"+telefono1.value+"', ";sql=sql+"telefono2       ='"+telefono2.value+"', ";sql=sql+"mail1           ='"+mail1.value+"', ";sql=sql+"mail2           ='"+mail2.value+"', ";sql=sql+"contacto        ='"+contacto.value+"', ";sql=sql+"url             ='"+web.value+"', ";sql=sql+"id_rubro        ='"+rubro.value+"', ";sql=sql+"texto           ='"+descripcion.value+"', ";sql=sql+"coordenadasmapa ='"+coordenadasmapa+"', ";sql=sql+"frasemapa       ='"+frasemapa+"' ";sql=sql+"where ";sql=sql+"id      ='"+id_publicacion+"' and ";sql=sql+"id_usuario       ='"+id_usuario+"' and ";sql=sql+"usuario ='"+usuario+"'; ";if(rubro.value!="OTRO"){var sql2="update tcomercio set ";sql2=sql2+"razon_social    ='"+razonsocial.value+"', ";if(ck_profesional.checked==true)sql2=sql2+"profesionales   ='s', ";else sql2=sql2+"profesionales   ='n', ";sql2=sql2+"id_provincia    ='"+provincia.value+"', ";sql2=sql2+"id_localidad    ='"+localidad.value+"', ";sql2=sql2+"calle           ='"+calle.value+"', ";sql2=sql2+"numero          ='"+numero.value+"', ";sql2=sql2+"cp              ='"+cp.value+"', ";sql2=sql2+"telefono1       ='"+telefono1.value+"', ";sql2=sql2+"telefono2       ='"+telefono2.value+"', ";sql2=sql2+"mail1           ='"+mail1.value+"', ";sql2=sql2+"mail2           ='"+mail2.value+"', ";sql2=sql2+"contacto        ='"+contacto.value+"', ";sql2=sql2+"url             ='"+web.value+"', ";sql2=sql2+"id_rubro        ='"+rubro.value+"', ";sql2=sql2+"texto           ='"+descripcion.value+"', ";sql2=sql2+"coordenadasmapa ='"+coordenadasmapa+"', ";sql2=sql2+"frasemapa       ='"+frasemapa+"' ";sql2=sql2+"where ";sql2=sql2+"id      ='"+id_publicacion+"' and ";sql2=sql2+"id_usuario       ='"+id_usuario+"' and ";sql2=sql2+"usuario ='"+usuario+"'; ";s2.value=sql2;}
IdPublicacion.value=id_publicacion;s.value=sql;return true;}else{alert(mensaje);return false;}}
function AltaCuponDescuento(id_usuario){var iSeguir=true;var mensaje="";var iAux=false;var confirmar=false;var s=document.getElementById("sqll");var s2=document.getElementById("sql2");var s3=document.getElementById("sql3");var id_comercio=document.getElementById("id_comercio");var ListaComercio=document.getElementById("comercio");var ItemComercio=ListaComercio.value.split("|");var idcomercio=ItemComercio[0];var comercio=ItemComercio[1];var textocupon=document.getElementById("textocupon");var descuento=document.getElementById("descuento");var diadesde=document.getElementById("dia_desde");var mesdesde=document.getElementById("mes_desde");var aniodesde=document.getElementById("anio_desde");var diahasta=document.getElementById("dia_hasta");var meshasta=document.getElementById("mes_hasta");var aniohasta=document.getElementById("anio_hasta");var desde=aniodesde.value+"-"+mesdesde.value+"-"+diadesde.value;var hasta=aniohasta.value+"-"+meshasta.value+"-"+diahasta.value;if(comercio=='TODOS'){mensaje=mensaje+"seleccione el comercio al que asociar este cupon de descuento.\n";iSeguir=false;}
if(!textocupon.value){mensaje=mensaje+"Falta ingresar el Texto Principal.\n";iSeguir=false;}
if(!descuento.value){mensaje=mensaje+"Falta ingresar el monto (%) del descuento.\n";iSeguir=false;}
if(!desde.value=='TODAS'){mensaje=mensaje+"Falta ingresar la Fecha de Inicio de validez del Cupon\n";iSeguir=false;}
if(!hasta.value=='TODAS'){mensaje=mensaje+"Falta ingresar la Fecha de Fin de validez del Cupon";iSeguir=false;}
if(iSeguir==true){confirmar=confirm("Confirmar la grabacion?");if(confirmar==true)iSeguir=true;else iSeguir=false;}
if(iSeguir==true){var sql="Alta de Nuevo Cupon de Descuento\n";sql=sql+"Razon Social: '"+comercio+"'\n";sql=sql+"id_comercio: '"+idcomercio+"'\n";sql=sql+"id_usuario: '"+id_usuario+"'\n";sql=sql+"textocupon: '"+textocupon.value+"'\n";sql=sql+"descuento: '"+descuento.value+"'\n";sql=sql+"desde: '"+desde+"'\n";sql=sql+"hasta: '"+hasta+"'\n";var sql2="insert into tcuponera(id_comercio, id_usuario, leyenda, descuento, desde, hasta, borrado) values(";sql2=sql2+idcomercio+", ";sql2=sql2+id_usuario+", ";sql2=sql2+"'"+textocupon.value+"', ";sql2=sql2+descuento.value+", ";sql2=sql2+"'"+desde+"', ";sql2=sql2+"'"+hasta+"', ";sql2=sql2+"'n'); ";var sqll3="update tcomercio set cuponera='s' where id="+idcomercio;s.value=sql;s2.value=sql2;s3.value=sqll3;id_comercio.value=idcomercio;return true;}else{alert(mensaje);return false;}}
function validarEmail(valor){var filter=/^[A-Za-z][A-Za-z0-9_]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;if(filter.test(valor))
return true;else
return false;}
function validarNumero(valor){var filter=/^[0-9]*$/;if(filter.test(valor))
return true;else
return false;}
function cancelar(){var confirmar=confirm("Realmente desea cancelar la Operacion?");if(confirmar==true)window.open('../index.php','_self');else return false;}
function ingresarcupon(){var seguir=true;var dni=document.getElementById("dni");var cupon=document.getElementById("cupon");var mensaje="";if(cupon.value.length<10){mensaje="Codigo de Cupon Invalido\n";seguir=false;}
if(dni.value.length<6){mensaje=mensaje+"DNI Invalido";seguir=false;}
if(seguir==false)alert(mensaje);return seguir;}
var margenizq=0;var margentop=0;var incrementar=20;function abrir(id){var iddiv=document.getElementById(id);var top_ant=iddiv.style.top;margenizq=margenizq+incrementar;marginLeft=-200+margenizq;margentop=margentop+incrementar;marginTop=-200+margentop;iddiv.style.top='50%';iddiv.style.left='50%';iddiv.style.width='500px';iddiv.style.height='400px';iddiv.style.marginLeft=marginLeft+'px';iddiv.style.marginTop=marginTop+'px';iddiv.style.overflow='scroll';var boton=document.getElementById("botonazo"+id);var valor_onclick="cerrar('"+id+"','"+top_ant+"')";boton.value="X";boton.setAttribute("onClick",valor_onclick);}
function cerrar(id,top){var iddiv=document.getElementById(id);var botonazo=document.getElementById("botonazo"+id);var valor_onMouseOver="abrir('"+id+"')";margenizq=margenizq-incrementar;margentop=margentop-incrementar;var boton=document.getElementById("botonazo"+id);var valor_onclick="abrir('"+id+"')";boton.setAttribute("onClick",valor_onclick);boton.value="->";iddiv.style.width='175px';iddiv.style.height='30px';iddiv.style.top=top;iddiv.style.left='0px';iddiv.style.marginLeft='0px';iddiv.style.marginTop='0px';iddiv.style.overflow='hidden';}
function imprSelec(nombre){var ficha=document.getElementById(nombre);var ventimp=window.open(' ','popimpr');ventimp.document.write(ficha.innerHTML);ventimp.document.close();ventimp.print();ventimp.close();}
function vercupon(id){window.open('./cuponera.php?id='+id,'_self');}
function mouseOver(elem,action){if(action==1){elem.style.cursor="pointer";}else{elem.style.cursor="auto";}}
function mouseOverIdChange(elem,action,idnuevo){if(action==1){elem.id=idnuevo;}else{elem.id=idnuevo;}}
function mailS(){var iSeguir=true;var vmail=document.getElementById("vmail");var nombre=document.getElementById("nombre");var mail=document.getElementById("mail");var telefono=document.getElementById("telefono");var asunto=document.getElementById("asunto");var texto=document.getElementById("texto");var mensaje="";if(!nombre.value){mensaje=mensaje+"Falta completar el campo Nombre y apellido.\n";iSeguir=false;}
if(!mail.value&&!telefono.value){mensaje=mensaje+"Ingrese al menos una forma de contacto.\n";iSeguir=false;}
if(!asunto.value){asunto.value="INFO"}
if(!texto.value){mensaje=mensaje+"Falta ingresar el Texto prinicpal del mensaje\n";iSeguir=false;}
if(iSeguir==false)alert(mensaje);else vmail.value="enviar";return iSeguir;}
function presupuesto(modo){var iSeguir=true;var vmail=document.getElementById("vmail");var nombre=document.getElementById("nombre");var mail=document.getElementById("mail");var telefono=document.getElementById("telefono");var texto=document.getElementById("texto");var mensaje="";if(modo==1){var id_rubro_comercio=document.getElementById("id_rubro_comercio");var rubros_2=document.getElementById("rubros_2");id_rubro_comercio.value=rubros_2.value;}
if(!nombre.value){mensaje=mensaje+"Falta completar el campo Nombre y apellido.\n";iSeguir=false;}
if(!mail.value&&!telefono.value){mensaje=mensaje+"Ingrese al menos una forma de contacto.\n";iSeguir=false;}
if(!texto.value){mensaje=mensaje+"Falta ingresar el Texto prinicpal del mensaje\n";iSeguir=false;}
if(iSeguir==false)alert(mensaje);else vmail.value="enviar";return iSeguir;}
function poner(id,modo,pathimg){switch(modo){case 1:var img1=document.getElementById(id);img1.src=pathimg;break;case 2:var img1=document.getElementById(id);img1.src=pathimg;break;}
return 0;}
function movein(which,html,boxdescription){which.style.background='#00F';which.style.fontSize='18px';if(document.getElementById)
document.getElementById(boxdescription).innerHTML=html
else
boxdescription.innerHTML=html}
function moveout(which,boxdescription){which.style.background='#F4F4F4';which.style.fontSize='14px';if(document.getElementById)
document.getElementById(boxdescription).innerHTML='&nbsp;'
else
boxdescription.innerHTML='&nbsp;'}
function MM_swapImgRestore(){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(){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){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(){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];}}
var ns4=(document.layers)?true:false
var ie4=(document.all)?true:false
var ns6=(document.getElementById&&!document.all)?true:false;var coorX,coorY;if(ns6)document.addEventListener("mousemove",mouseMove,true)
if(ns4){document.captureEvents(Event.MOUSEMOVE);document.mousemove=mouseMove(Event.MOUSEMOVE);}
function mouseMove(e){if(ns4||ns6){coorX=e.pageX;coorY=e.pageY;}
if(ie4){coorX=event.x;coorY=event.y;coorX+=window.event.clientX+document.body.scrollLeft;coorY+=window.event.clientY+document.body.scrollTop;}
return true;}
function ini(){if(ie4)document.body.onmousemove=mouseMove;}
function mostrar(dato,id_div){with(document.getElementById(id_div)){style.top=coorY+10;style.left=coorX+10;style.visibility="visible";innerHTML=dato;}}
function mostrar_rubro_flotante(dato,id_div){with(document.getElementById(id_div)){style.top=coorY;style.left=coorX;style.visibility="visible";innerHTML=dato;}}
function ocultar(id_div){document.getElementById(id_div).style.visibility="hidden";}
function mover(id_div){with(document.getElementById(id_div)){style.top=coorY+10;style.left=coorX+10;}}
function CargarImagen(img){document.getElementById("ImagenMayor").src=img;}
function OtroRubro(){var rubro=document.getElementById("rubro");if(rubro.value=="0")document.getElementById("rubro2").disabled=false;else document.getElementById("rubro2").disabled=true;}
function initialize(lat,long,zoom,frase){if(GBrowserIsCompatible()){var map=new GMap2(document.getElementById("map_canvas"));map.setMapType(G_HYBRID_MAP);map.setCenter(new GLatLng(lat,long),zoom);map.setUIToDefault();map.openInfoWindow(map.getCenter(),document.createTextNode(frase));}}
function HabilitarTagName(valor){if(valor=='si'){document.getElementById("nombre").disabled=false;document.getElementById("apellido").disabled=false;document.getElementById("telefono1").disabled=false;document.getElementById("telefono2").disabled=false;document.getElementById("mail").disabled=false;document.getElementById("provincia").disabled=false;document.getElementById("localidad").disabled=false;document.getElementById("cp").disabled=false;document.getElementById("calle").disabled=false;document.getElementById("numero").disabled=false;document.getElementById("boton1").disabled=false;document.getElementById("boton2").disabled=false;document.getElementById("dni").disabled=true;document.getElementById("cupon").disabled=true;document.getElementById("boton0").disabled=true;}else if(valor=='no'){document.getElementById("nombre").disabled=true;document.getElementById("apellido").disabled=true;document.getElementById("telefono1").disabled=true;document.getElementById("telefono2").disabled=true;document.getElementById("mail").disabled=true;document.getElementById("provincia").disabled=true;document.getElementById("localidad").disabled=true;document.getElementById("cp").disabled=true;document.getElementById("calle").disabled=true;document.getElementById("numero").disabled=true;document.getElementById("boton1").disabled=true;document.getElementById("boton2").disabled=true;}}
function login(){var seguir=true;var usuario=document.getElementById("usuario");var password=document.getElementById("password");var mensaje="";if(!usuario.value){mensaje=mensaje+"Debe ingresar un nombre de usuario válido\n"
seguir=false;}
if(!password.value){mensaje=mensaje+"Debe ingresar una clave de acceso Válida\n"
seguir=false;}
if(seguir==false)alert(mensaje);return seguir;}
function RecuperarDatos(){var seguir=true;var mail=document.getElementById("recuperardatos");var mensaje="";if(!mail.value){mensaje=mensaje+"Debe ingresar un mail válido\n"
seguir=false;}else{}
if(seguir==false)alert(mensaje);return seguir;}
function registro(valor){if(valor=='si'){document.getElementById("div1").style.display='none';document.getElementById("div2").style.display='table-footer-group';}else if(valor=='no'){document.getElementById("div1").style.display='table-footer-group';document.getElementById("div2").style.display='none';}
return false;}
function RegistrAranunciante(){var iSeguir=true;var mensaje="";var iAux=false;var confirmar=false;var s=document.getElementById("sqll");var nombre_contacto=document.getElementById("nombre_contacto");var apellido_contacto=document.getElementById("apellido_contacto");var dni_contacto=document.getElementById("dni_contacto");var telefono_contacto_1=document.getElementById("telefono_contacto_1");var telefono_contacto_2=document.getElementById("telefono_contacto_2");var mail_contacto_1=document.getElementById("mail_contacto_1");var mail_contacto_2=document.getElementById("mail_contacto_2");var provincia_contacto=document.getElementById("provincia_contacto");var localidad_contacto=document.getElementById("localidad_contacto");var calle_contacto=document.getElementById("calle_contacto");var numero_contacto=document.getElementById("numero_contacto");var cp_contacto=document.getElementById("cp_contacto");var user_contacto=document.getElementById("user_contacto");var clave_contacto=document.getElementById("clave_contacto");var nombre=document.getElementById("nombre");var apellido=document.getElementById("apellido");var dni=document.getElementById("dni");var telefono1=document.getElementById("telefono1");var telefono2=document.getElementById("telefono2");var mail1=document.getElementById("mail1");var mail2=document.getElementById("mail2");var provincia=document.getElementById("provincia");var localidad=document.getElementById("localidad");var calle=document.getElementById("calle");var numero=document.getElementById("numero");var cp=document.getElementById("cp");var usuarionuevo=document.getElementById("usuarionuevo");var passwordnuevo=document.getElementById("passwordnuevo");if(!nombre.value){mensaje=mensaje+"Falta ingresar el Nombre de contacto.\n";iSeguir=false;}
if(!apellido.value){mensaje=mensaje+"Falta ingresar el Apellido de contacto.\n";iSeguir=false;}
if(!dni.value){mensaje=mensaje+"Falta ingresar el dni.\n";iSeguir=false;}
if(telefono1.value)iAux=true;if(telefono2.value)iAux=true;if(mail1.value){iAux=true;mail_contacto_1.value=mail1.value;}
if(mail2.value){iAux=true;mail_contacto_2.value=mail2.value;}
if(iAux==false){mensaje=mensaje+"Coloque al menos un metodo de contacto: Telefono / mail\n";iSeguir=false;}
if(mail1.value){}
if(mail2.value){}
if(provincia.value=='TODAS'){mensaje=mensaje+"Falta ingresar la Provincia\n";iSeguir=false;}
if(localidad.value=='TODAS'){mensaje=mensaje+"Falta ingresar la Localidad\n";iSeguir=false;}
if(!calle.value){mensaje=mensaje+"Falta ingresar la Calle\n";iSeguir=false;}
if(!numero.value){mensaje=mensaje+"Falta ingresar el Numero\n";iSeguir=false;}else{if(numero.value){if(validarNumero(numero.value)==false){mensaje=mensaje+"Numero de calle es Incorrecto\n";iSeguir=false;}}}
if(!cp.value){mensaje=mensaje+"Falta ingresar el Codigo Postal\n";iSeguir=false;}
if(!usuarionuevo.value){mensaje=mensaje+"Falta ingresar el nombre de Usuario.\n";iSeguir=false;}else{if(usuarionuevo.value.length<6){mensaje=mensaje+"El nombre de usuario debe ser de entre 6 y 10 caracteres de longitud.\n";iSeguir=false;}}
if(!passwordnuevo.value){mensaje=mensaje+"Falta ingresar la clave de acceso.\n";iSeguir=false;}else{if(passwordnuevo.value.length<6){mensaje=mensaje+"La contraseña debe ser de entre 6 y 10 caracteres de longitud.\n";iSeguir=false;}}
if(iSeguir==true){confirmar=confirm("Confirmar el Registro?");if(confirmar==true)iSeguir=true;else iSeguir=false;}
if(iSeguir==true){var sql="insert into tusuario (usuario, clave, nombre, apellido, dni, telefono1, telefono2, mail1, mail2, id_provincia, id_localidad, calle, numero, cp, borrado, habilitado) values(";sql=sql+"'"+usuarionuevo.value+"', ";sql=sql+"'"+passwordnuevo.value+"', ";sql=sql+"'"+nombre.value+"', ";sql=sql+"'"+apellido.value+"', ";sql=sql+"'"+dni.value+"', ";sql=sql+"'"+telefono1.value+"', ";sql=sql+"'"+telefono2.value+"', ";sql=sql+"'"+mail1.value+"', ";sql=sql+"'"+mail2.value+"', ";sql=sql+provincia.value+", ";sql=sql+localidad.value+", ";sql=sql+"'"+calle.value+"', ";sql=sql+numero.value+", ";sql=sql+"'"+cp.value+"', ";sql=sql+"'n', ";sql=sql+"'s'); ";nombre_contacto.value=nombre.value;apellido_contacto.value=apellido.value;dni_contacto.value=dni.value;telefono_contacto_1.value=telefono1.value;telefono_contacto_2.value=telefono2.value;provincia_contacto.value=provincia.value;localidad_contacto.value=localidad.value;calle_contacto.value=calle.value;numero_contacto.value=numero.value;cp_contacto.value=cp.value;user_contacto.value=usuarionuevo.value;clave_contacto.value=passwordnuevo.value;s.value=sql;return true;}else{alert(mensaje);return false;}}
function ActualizarMesDia(form,dia,mes,ano){var qmes;var maxfebrero;var imax;qmes=document.forms[form].elements[mes].value;maxfebrero=28;if(AnoBisiesto(document.forms[form].elements[ano].value)==true)maxfebrero=29;if(qmes==2)imax=maxfebrero;if((qmes==9)||(qmes==4)||(qmes==6)||(qmes==11))imax=30;if((qmes==1)||(qmes==3)||(qmes==5)||(qmes==7)||(qmes==8)||(qmes==10)||(qmes==12))imax=31;document.forms[form].elements[dia].options.length=0;for(i=1;i<=imax;i++)document.forms[form].elements[dia].options[i-1]=new Option(i,i);}
function AnoBisiesto(ano){var por4;var por100;var por400;por4=ano%4;por100=ano%100;por400=ano%400;if(por400==0)return true;else if(por100==0)return false;else if(por4==0)return true;else return false;}
function alteraraviso(id,accion){
	var paramatros="?id="+id+"&accion="+accion;
	window.open('./alteraraviso.php'+paramatros,'_self')
}
function estadisticas(id){
	var paramatros="?id="+id;
	window.open('./graficos.php'+paramatros,'_self')
}
function alterarcupon(id_cupon,id_comercio,accion){var paramatros="?id_cupon="+id_cupon+"&id_comercio="+id_comercio+"&accion="+accion;window.open('./alterarcupon.php'+paramatros,'_self')}
function ModificarCupon(id_usuario,id_cupon){var iSeguir=true;var mensaje="";var iAux=false;var confirmar=false;var s=document.getElementById("sqll");var s2=document.getElementById("sql2");var ListaComercio=document.getElementById("comercio");var ItemComercio=ListaComercio.value.split("|");var idcomercio=ItemComercio[0];var comercio=ItemComercio[1];var textocupon=document.getElementById("textocupon");var descuento=document.getElementById("descuento");var diadesde=document.getElementById("dia_desde");var mesdesde=document.getElementById("mes_desde");var aniodesde=document.getElementById("anio_desde");var diahasta=document.getElementById("dia_hasta");var meshasta=document.getElementById("mes_hasta");var aniohasta=document.getElementById("anio_hasta");var desde=aniodesde.value+"-"+mesdesde.value+"-"+diadesde.value;var hasta=aniohasta.value+"-"+meshasta.value+"-"+diahasta.value;if(comercio.value=="TODOS"){mensaje=mensaje+"seleccione el comercio al que asociar este cupon de descuento.\n";iSeguir=false;}
if(!textocupon.value){mensaje=mensaje+"Falta ingresar el Texto Principal.\n";iSeguir=false;}
if(!descuento.value){mensaje=mensaje+"Falta ingresar el monto (%) del descuento.\n";iSeguir=false;}
if(!desde.value=='TODAS'){mensaje=mensaje+"Falta ingresar la Fecha de Inicio de validez del Cupon\n";iSeguir=false;}
if(!hasta.value=='TODAS'){mensaje=mensaje+"Falta ingresar la Fecha de Fin de validez del Cupon";iSeguir=false;}
if(iSeguir==true){confirmar=confirm("Confirmar la grabacion?");if(confirmar==true)iSeguir=true;else iSeguir=false;}
if(iSeguir==true){var sql="Modificacion de Cupon de Descuento\n";sql=sql+"ID_CUPON: '"+id_cupon+"'\n";sql=sql+"id_comercio: '"+idcomercio+"'\n";sql=sql+"id_usuario: '"+id_usuario+"'\n";sql=sql+"Razon Social: '"+comercio+"'\n";sql=sql+"textocupon: '"+textocupon.value+"'\n";sql=sql+"descuento: '"+descuento.value+"'\n";sql=sql+"desde: '"+desde+"'\n";sql=sql+"hasta: '"+hasta+"'\n";var sql2="update tcuponera set ";sql2=sql2+"id_comercio = "+idcomercio+", ";sql2=sql2+"leyenda = '"+textocupon.value+"', ";sql2=sql2+"descuento = "+descuento.value+", ";sql2=sql2+"desde = '"+desde+"', ";sql2=sql2+" hasta = '"+hasta+"' ";sql2=sql2+"where id = "+id_cupon+" ";sql2=sql2+"and id_usuario = "+id_usuario+" ";sql2=sql2+"and borrado='n';";s2.value=sql2;s.value=sql;return true;}else{alert(mensaje);return false;}}
function subir(){var iSeguir=true;var confirmar=false;var subir_0=document.getElementById("subir_0");var foto0=document.getElementById("foto0");var foto1=document.getElementById("foto1");var foto2=document.getElementById("foto2");var foto3=document.getElementById("foto3");var foto4=document.getElementById("foto4");var foto5=document.getElementById("foto5");var foto6=document.getElementById("foto6");var foto7=document.getElementById("foto7");var foto8=document.getElementById("foto8");var foto9=document.getElementById("foto9");var destino1=document.getElementById("destino1");var destino2=document.getElementById("destino2");var destino3=document.getElementById("destino3");var destino4=document.getElementById("destino4");var destino5=document.getElementById("destino5");var destino6=document.getElementById("destino6");var destino7=document.getElementById("destino7");var destino8=document.getElementById("destino8");var destino9=document.getElementById("destino9");var destino10=document.getElementById("destino10");var destino_1=document.getElementById("destino_1");var destino_2=document.getElementById("destino_2");var destino_3=document.getElementById("destino_3");var destino_4=document.getElementById("destino_4");var destino_5=document.getElementById("destino_5");var destino_6=document.getElementById("destino_6");var destino_7=document.getElementById("destino_7");var destino_8=document.getElementById("destino_8");var destino_9=document.getElementById("destino_9");var destino_10=document.getElementById("destino_10");var archivo0=document.getElementById("archivo0");var archivo1=document.getElementById("archivo1");var archivo2=document.getElementById("archivo2");var archivo3=document.getElementById("archivo3");var archivo4=document.getElementById("archivo4");var archivo5=document.getElementById("archivo5");var archivo6=document.getElementById("archivo6");var archivo7=document.getElementById("archivo7");var archivo8=document.getElementById("archivo8");var archivo9=document.getElementById("archivo9");foto0.value=archivo0.value;foto1.value=archivo1.value;foto2.value=archivo2.value;foto3.value=archivo3.value;foto4.value=archivo4.value;foto5.value=archivo5.value;foto6.value=archivo6.value;foto7.value=archivo7.value;foto8.value=archivo8.value;foto9.value=archivo9.value;destino_1.value=destino1.value;destino_2.value=destino2.value;destino_3.value=destino3.value;destino_4.value=destino4.value;destino_5.value=destino5.value;destino_6.value=destino6.value;destino_7.value=destino7.value;destino_8.value=destino8.value;destino_9.value=destino9.value;destino_10.value=destino10.value;confirmar=confirm("Confirmar?");if(confirmar==true){iSeguir=true;}else iSeguir=false;if(iSeguir==true){subir_0.value="si";return true;}else{return false;}}
function ModificarAranunciante(user,pass,id){var iSeguir=true;var mensaje="";var iAux=false;var confirmar=false;var s=document.getElementById("sqll");var nombre=document.getElementById("nombre");var apellido=document.getElementById("apellido");var dni=document.getElementById("dni");var telefono1=document.getElementById("telefono1");var telefono2=document.getElementById("telefono2");var mail1=document.getElementById("mail1");var mail2=document.getElementById("mail2");var provincia=document.getElementById("provincia");var localidad=document.getElementById("localidad");var calle=document.getElementById("calle");var numero=document.getElementById("numero");var cp=document.getElementById("cp");if(!nombre.value){mensaje=mensaje+"Falta ingresar el Nombre de contacto.\n";iSeguir=false;}
if(!apellido.value){mensaje=mensaje+"Falta ingresar el Apellido de contacto.\n";iSeguir=false;}
if(!dni.value){mensaje=mensaje+"Falta ingresar el dni.\n";iSeguir=false;}
if(telefono1.value)iAux=true;if(telefono2.value)iAux=true;if(mail1.value){iAux=true;mail_contacto_1.value=mail1.value;}
if(mail2.value){iAux=true;mail_contacto_2.value=mail2.value;}
if(iAux==false){mensaje=mensaje+"Coloque al menos un metodo de contacto: Telefono / mail\n";iSeguir=false;}
if(mail1.value){}
if(mail2.value){}
if(provincia.value=='TODAS'){mensaje=mensaje+"Falta ingresar la Provincia\n";iSeguir=false;}
if(localidad.value=='TODAS'){mensaje=mensaje+"Falta ingresar la Localidad\n";iSeguir=false;}
if(!calle.value){mensaje=mensaje+"Falta ingresar la Calle\n";iSeguir=false;}
if(!numero.value){mensaje=mensaje+"Falta ingresar el Numero\n";iSeguir=false;}else{if(numero.value){if(validarNumero(numero.value)==false){mensaje=mensaje+"Numero de calle es Incorrecto\n";iSeguir=false;}}}
if(!cp.value){mensaje=mensaje+"Falta ingresar el Codigo Postal\n";iSeguir=false;}
if(iSeguir==true){confirmar=confirm("Confirmar el Registro?");if(confirmar==true)iSeguir=true;else iSeguir=false;}
if(iSeguir==true){var sql="update tusuario set ";sql=sql+"nombre = '"+nombre.value+"', ";sql=sql+"apellido = '"+apellido.value+"', ";sql=sql+"dni = '"+dni.value+"', ";sql=sql+"telefono1 = '"+telefono1.value+"', ";sql=sql+"telefono2 = '"+telefono2.value+"', ";sql=sql+"mail1 = '"+mail1.value+"', ";sql=sql+"mail2 = '"+mail2.value+"', ";sql=sql+"id_provincia = "+provincia.value+", ";sql=sql+"id_localidad = "+localidad.value+", ";sql=sql+"calle = '"+calle.value+"', ";sql=sql+"numero = "+numero.value+", ";sql=sql+"cp = '"+cp.value+"' ";sql=sql+"where id = "+id;sql=sql+" and usuario= '"+user+"' ";sql=sql+" and clave= '"+pass+"';";s.value=sql;return true;}else{alert(mensaje);return false;}}
function activar(id,ima){var imgy=document.getElementById(id);imgy.src=ima;}
function desactivar(id,ima){var imgy=document.getElementById(id);imgy.src=ima;}
function fijar(id,ima,aviso){OcultarDestacado("cuenta_0","../img/equis.png");OcultarDestacado("cuenta_1","../img/equis.png");OcultarDestacado("cuenta_2","../img/equis.png");OcultarDestacado("cuenta_3","../img/equis.png");var imgy=document.getElementById(id);imgy.style.backgroundImage="url("+ima+")";var destacado=document.getElementById("destacado");destacado.value=aviso;window.open('./elejirplan.php?destacado='+destacado.value,'_self')}
function fijaractual(id,ima,aviso){OcultarDestacado("cuenta_0","../img/equis.png",0);OcultarDestacado("cuenta_1","../img/equis.png",1);OcultarDestacado("cuenta_2","../img/equis.png",2);OcultarDestacado("cuenta_3","../img/equis.png",3);var imgy=document.getElementById(id);imgy.style.backgroundImage="url("+ima+")";var destacado=document.getElementById("destacado");destacado.value=aviso;}
function MostrarDestacado(id,ima){OcultarDestacado("cuenta_0","../img/equis.png",0);OcultarDestacado("cuenta_1","../img/equis.png",1);OcultarDestacado("cuenta_2","../img/equis.png",2);OcultarDestacado("cuenta_3","../img/equis.png",3);var imgy=document.getElementById(id);imgy.style.backgroundImage="url("+ima+")";}
function OcultarDestacado(id,ima,aviso){var destacado=document.getElementById("destacado");if(destacado.value!=aviso){var imgy=document.getElementById(id);imgy.style.backgroundImage="url("+ima+")";}}
function RegistrarPago(){
		var iSeguir=true;
		var mensaje="";
		var iAux=false;
		var confirmar=false;
		var sql=document.getElementById("sql");
		var usuario=document.getElementById("usuario");
		var id=document.getElementById("id_usuario");
		var nombre=document.getElementById("nombre");
		var apellido=document.getElementById("apellido");
		var cuenta=document.getElementById("cuenta");
		var valor_abono=document.getElementById("valor_abono");
		var fecha_pago=document.getElementById("fecha_pago");
		var importe_abonado=document.getElementById("importe_abonado");
		var detalle=document.getElementById("detalle");
		var promo=document.getElementById("promo");
		var destacado;

		if(cuenta.value == 'Gratuita') destacado = 0;
		else if(cuenta.value == 'Comun') destacado = 1;
		else if(cuenta.value == 'Destacado') destacado = 2;
		else if(cuenta.value == 'VIP') destacado = 3;
		else {mensaje = mensaje + "No se pudo obtener el tipo de cuenta a abonar.\n"; iSeguir=false;}
		
		if (promo.checked==true) promocion="promo navidad 2011: 2012 a 100 pesos"; else promocion="Sin promo";
		if (!fecha_pago.value) {mensaje = mensaje + "Falta ingresar la fecha de realizacion del Pago.\n"; iSeguir=false;}
		if (!importe_abonado.value || parseFloat(importe_abonado.value)==0) {mensaje = mensaje + "Falta ingresar el Importe Abonado.\n"; iSeguir=false;}
		
		if(iSeguir==true){
			var sql2="insert into tpagos(usuario, id_usuario, nombre, apellido, fechapago, cuenta, valor_abono, importe_abonado, detalles, promocion) values(";
			sql2=sql2 + "'" + usuario.value + "', ";
			sql2=sql2 + id.value + ", ";
			sql2=sql2 + "'" + nombre.value + "', ";
			sql2=sql2 + "'" + apellido.value 	+ "', ";
			sql2=sql2 + "'" + fecha_pago.value 	+ "', ";
			sql2=sql2 + destacado + ", ";
			sql2=sql2 + parseFloat(valor_abono.value)  	+ ", ";
			sql2=sql2 + parseFloat(importe_abonado.value) 	  	+ ", ";
			sql2=sql2 + "'" + detalle.value 	  	+ "', ";
			sql2=sql2 + "'" + promocion 	  	+ "');";
			
			sql.value=sql2;
			//alert(sql.value);		
			return true;
		}else{
			alert(mensaje);
			return false;
		}
		return true;
}
function VerNuevosIngresos(){var nuevo=document.getElementById("nuevos");var dato=nuevo.value.split("|");var id_comercio=dato[0];var id_rubro=dato[1];var destacado=dato[2];if(destacado>1)window.open('http://www.clasiguia.com.ar/php/resultadosextendidos.php?index='+id_comercio,'_self');else{window.open('http://www.clasiguia.com.ar/php/resultados.php?rub='+id_rubro,'_self')}}
function FondoColor(modo,id){var iddiv=document.getElementById(id);var top_ant=iddiv.style.top;if(modo==1)iddiv.style.background='#ffff11';else iddiv.style.background='#FFFFFF';}
function VerMasBuscados(){var nuevo=document.getElementById("losmasbuscados");var dato=nuevo.value.split("|");var id_comercio=dato[0];var id_rubro=dato[1];var destacado=dato[2];if(destacado>1)window.open('http://www.clasiguia.com.ar/php/resultadosextendidos.php?index='+id_comercio,'_self');else{window.open('http://www.clasiguia.com.ar/php/resultados.php?rub='+id_rubro,'_self')}}
function VerificarMonto(){var monto=document.getElementById("importe_abonado");var promo=document.getElementById("promo");	if(monto.value==100){promo.disabled=false;promo.checked=true;}else{promo.disabled=true;promo.checked=false;}}
(function(){function hoverButtons(){var links=document.getElementsByTagName('*'),i=links.length;while(i--){if(links[i].className.indexOf('boton')!=-1){var firstSpan=links[i].getElementsByTagName('span')[0];firstSpan.onmouseover=function(){this.className+=' hover';}
firstSpan.onmouseout=function(){this.className=this.className.split(' hover')[0];}}}}
if(!window.XMLHttpRequest)window.attachEvent('onload',hoverButtons);})();  

function cerrar(){
	setTimeout('cerrar2()', 3000);	
}

function cerrar2(){
	var table = document.getElementById('Tabla_01'); 
	table.deleteRow(2);
}

function HabilitarPanelBusqueda(){
	var td = document.getElementById('td_panel_busqueda'); 
	var valor_onclick="CerrarPanelBusqueda()";
	var tr = document.getElementById('tr_panel_busqueda'); 
	
	td.setAttribute("onClick",valor_onclick);
	tr.style.display="";
}

function CerrarPanelBusqueda(){
	var td = document.getElementById('td_panel_busqueda'); 
	var valor_onclick="HabilitarPanelBusqueda()";
	var tr = document.getElementById('tr_panel_busqueda'); 
	
	td.setAttribute("onClick",valor_onclick);
	tr.style.display="none";
}
