// JavaScript Document
var comercial= new Array();
comercial[0] = new Array('galicia', 'Galicia','Avda. General Sanjurjo, 175 bajo', '', '15006 A Coru&ntilde;a', '981 210 462', 'galicia@conexionempresas.com');
comercial[1] = new Array('cantabria', 'Cantabria','Pol. Ind. Mies de Molladar, 7', '', '39311 Cartes', '942 82 31 92', 'cantabria@conexionempresas.com');
//comercial[2] = new Array('pais_vasco', 'Euskadi','C/ General Concha, 32', '', '48012 Bilbao', '944 420 483', 'euskadi@conexionempresas.com');
comercial[2] = new Array('pais_vasco', 'Euskadi','C/ Junqueral, 13 (2&ordf; planta dpto. 14). Pol. Ind. Kareaga Goikoa', '', '48903  Barakaldo Bizkaia', '', 'euskadi@conexionempresas.com');
comercial[3] = new Array('madrid', 'Madrid','Centro Empresarial Skyline', 'salida 36 M-40, n&deg; 19 Lob 42', 'salida 36 M-40, n&deg; 19 Lob 42', '28925 Alcorc&oacute;n', 'madrid@conexionempresas.com');
comercial[4] = new Array('catalunya', 'Catalu&ntilde;a','P&deg; Maragall, 66', '', '08041 Barcelona', '934 365 004', 'catalunya@conexionempresas.com');
//comercial[6] = new Array('malaga', 'Malaga','Paseo de Reding, 43 - 1º Izq.', '', '29016 Málaga', '952 211 901', 'malaga@conexionempresas.com');
comercial[6] = new Array('malaga', 'Malaga','C/ Pepita Barrientos 7, edificio Galia litoral, m&oacute;dulo 6 plta baja', '', '29004 M&aacute;laga', '', 'malaga@conexionempresas.com');
comercial[7] = new Array('central', 'TIENDAS CONEXI&Oacute;N, SL','', '', '', '', '');
comercial[8] = new Array('sevilla','Sevilla','C/ Asunci&oacute;n, 37', '', '41011 Sevilla','902 013 279', 'sevilla@conexionempresas.com' );
//comercial[9] = new Array('asturias','Asturias','C/ 9 de Mayo, esq. Salesas', '', 'Oviedo','985 216 718', '' );
comercial[9] = new Array('asturias','Asturias','Avda/ De la constitucion 8-10', '', 'Gijon','', '' );
comercial[10] = new Array('catalunya','Catalu&ntilde;a','C/Josep M. Gironella, 1-3, Plaza Europa', '', 'Gerona','', '' );
comercial[11] = new Array('palma de mallorca','Palma de Mallorca','', '', '','', '' );
comercial[12] = new Array('Valencia','Valencia','C/Olta,12', '', '', '963 344 890', '' );
comercial[13] = new Array('Valencia','Valencia','Ronda Narciso Monturiol 4Bl. A Of 109, Parque Tecnologico Paterna', '', '', '961 822 588', '' );

function isset(variable_name) {
try {
	 if (typeof(eval(variable_name)) != 'undefined')
	 if (eval(variable_name) != null)
	 return true;
 } catch(e) { }
return false;
}

function getcomercial(cual)
{
document.getElementById('mapregion').innerHTML=comercial[cual][1];
document.getElementById('mapdireccion1').innerHTML=comercial[cual][2];
//document.getElementById('mapdireccion2').innerHTML=comercial[cual][3]; 
document.getElementById('codpostal').innerHTML=comercial[cual][4];
document.getElementById('telefono').innerHTML=comercial[cual][5];
document.getElementById('email').innerHTML=comercial[cual][6];

if(isset(document.getElementById('noticia')))
	{
	getnoticia(comercial[cual][0])
	}
}

function limpiar(cual)
{
document.getElementById('mapregion').innerHTML="";
document.getElementById('mapdireccion1').innerHTML="";
document.getElementById('codpostal').innerHTML="";
document.getElementById('telefono').innerHTML="";
document.getElementById('email').innerHTML="";

}
function limpiar_Info(cual)
{
document.getElementById('comunidadConoce').innerHTML="";
document.getElementById('direccionConoce').innerHTML="";
document.getElementById('codpostalConoce').innerHTML="";
document.getElementById('telefonoConoce').innerHTML="";
document.getElementById('emailConoce').innerHTML="";

}

function limpiar_Info_c(cual)
{
document.getElementById('comunidadContacto').innerHTML="";
document.getElementById('direccionContacto').innerHTML="";
document.getElementById('codpostalContacto').innerHTML="";
document.getElementById('telefonoContacto').innerHTML="";
document.getElementById('emailContacto').innerHTML="";

}

function envia_email(form)
{
	if(form!='frmRenove')
	{
		if(megavalidacion(form))
		{
			if($("#colectivo").html()!='')
			{
				respuesta = document.getElementById('resp_visita');
				envia('visita/mail.php','nombre='+document.frmVisita.nombre.value+
					  '&telefono='+document.frmVisita.telefono.value+
					  '&email='+document.frmVisita.email.value+
					  '&para='+document.frmVisita.para.value+
					  '&consulta='+document.frmVisita.consulta.value+
					  '&colectivo='+document.frmVisita.colectivo.value);
			}
			else
			{
				respuesta = document.getElementById('resp_visita');
				envia('visita/mail.php','nombre='+document.frmVisita.nombre.value+
					  '&telefono='+document.frmVisita.telefono.value+
					  '&email='+document.frmVisita.email.value+
					  '&para='+document.frmVisita.para.value+
					  '&consulta='+document.frmVisita.consulta.value);		
			}
		}
	}
	else
	{
		var nombre = $('#frmRenove input[name="nombre"]').val();
		var email = $('#frmRenove input[name="email"]').val();
		var telefono = $('#frmRenove input[name="telefono"]').val();
		var consulta = $('#frmRenove textarea[name="consulta"]').val();
		
		if(megavalidacion('frmRenove'))
		{
			$('#resp_renove').load('renove/mail.php',{
				'nombre':nombre,
				'email':email,
				'telefono':telefono,
				'consulta':consulta
			})
		}
	}
	//else
	//	alert("hola");
	//alert("hola");
}

function envia_email_c(form)
{
	var nombre = document.frmContacto.nombre.value;
	var telefono = document.frmContacto.telefono.value;
	var email = document.frmContacto.email.value;
	var para = document.frmContacto.para.value;
	var consulta = document.frmContacto.consulta.value;
	
	if(megavalidacion(form))
					  {
	$('#respcontacto').load('contacto/mail.php', { 'nombre': nombre , 'telefono': telefono, 'email': email , 'para': para, 'consulta': consulta});
					  }
}

function verInfo_tienda(cual)
{
document.getElementById('comunidadConoce').innerHTML=comercial[cual][1];
document.getElementById('direccionConoce').innerHTML=comercial[cual][2];
document.getElementById('codpostalConoce').innerHTML=comercial[cual][4];
document.getElementById('telefonoConoce').innerHTML=comercial[cual][5];
document.getElementById('emailConoce').innerHTML=comercial[cual][6];

if(isset(document.getElementById('noticia')))
	{
	getnoticia(comercial[cual][0])
	}
}


function verInfo_tienda_c(cual)
{
	document.getElementById('comunidadContacto').innerHTML=comercial[cual][1];
	document.getElementById('direccionContacto').innerHTML=comercial[cual][2];
	document.getElementById('codpostalContacto').innerHTML=comercial[cual][4];
	document.getElementById('telefonoContacto').innerHTML=comercial[cual][5];
	document.getElementById('emailContacto').innerHTML=comercial[cual][6];
	
	if(isset(document.getElementById('noticia')))
	{
	getnoticia(comercial[cual][0])
	}
}

function cambiarmarca()
{
	respuesta = document.getElementById('divmodelo');
	envia('catalogo/ajax/selectModelo.php','marca='+document.avanzado.marca.value);
}
function cambiarservicio()
{
	respuesta = document.getElementById('divmarca');
	envia('catalogo/ajax/selectServicio.php','servicio='+document.avanzado.servicio.value);
}


function buscar()
{
document.forms['avanzado'].submit();
}
function buscador_avanzado()
{
	var caracteristicas = new Array('TresG','VL','CA','BT','MP','MS','IR','RA','MM','VJ','TB','CB','GP','ML','TM');
	
	var carac=0;
	for(x=0;x<caracteristicas.length;x++)
	{
		if(document.getElementById(caracteristicas[x]).checked)
			carac = carac+"-"+document.getElementById(caracteristicas[x]).id;
	}
	
	respuesta = document.getElementById('resultado');
	envia('catalogo/ajax/resultados.php','marca='+document.avanzado.marca.value+
		  '&modelo='+document.avanzado.modelo.value+
		  '&servicio='+document.avanzado.servicio.value+
		  '&caracteristicas='+carac);
}
function paginador(servicio,marca,modelo,caracteristicas,pagina)
{
	respuesta=document.getElementById('resultado');
	envia('catalogo/ajax/resultados.php','marca='+marca+
		  '&modelo='+modelo+
		  '&caracteristicas='+caracteristicas+
		  '&servicio='+servicio+
		  '&pagina='+pagina);
}

function abre_popup(pagina)
{
	var alto = $(document).height();
	var ancho = $(window).width();
	
	$("#popup").css({"width":ancho,"height":alto});
	$('#popup').fadeTo("slow",0.6);    
	$("#todopopup").fadeTo("slow",1);
	//$("#todopopup").css("display","block");
	
	$(".imgpopup").load("tarifas/popups.php",{"pagina":pagina});
}

