var map;
var over=[];
var currentGeoPoint=[];
 var wclick=0;
var mpan; 
var pant=1;
var ppan=0;
var alto;
var ancho;
function iniciar(){

alto=document.body.offsetHeight; 
 ancho=document.body.offsetWidth; 

document.getElementById("ciudades").value=wciud2;



if (typeof(wpuntos) !="undefined"){

document.getElementById('mapas').style.display = "block";


document.getElementById("map").style.height=ancho*.33+"px";
 map = new YMap(document.getElementById('map'));

	// Add map type control
	map.addTypeControl();
     map.addZoomLong();  
   
     // Add the Pan Control  
     map.addPanControl();
	// Set map type to either of: YAHOO_MAP_SAT, YAHOO_MAP_HYB, YAHOO_MAP_REG
	map.setMapType(YAHOO_MAP_REG);

	// Display the map centered on a geocoded location
	
	
	
	switch (wciud2){
case 614:
map.drawZoomAndCenter("28.646607411159582,-106.07025146484375", 7); 
break;
case 656:
map.drawZoomAndCenter("31.687860441812497,-106.40533447265625", 7); 
break;
case 625:
map.drawZoomAndCenter("28.40529274756662,-106.8665885925293", 6);
break;
case 639:
map.drawZoomAndCenter("28.178408533181702,-105.46377182006836", 6);  
break;
case 648:
map.drawZoomAndCenter("27.674407053577525,-105.16542434692383", 6);
break;
case 629:
map.drawZoomAndCenter("27.128813241669732,-104.91188049316406", 6); 
break;
case 627:
map.drawZoomAndCenter("26.93615030625719,-105.67285537719727", 6); 
break;
case 626:
map.drawZoomAndCenter("29.55165721816412,-104.41080093383789", 6); 
break;
}
	
	
	
	
	
	
	
	
	
	
puntos();
}
else {

document.se.reset();
document.getElementById('banner').style.display = "block";
pantalla(1);
mpan=setInterval("m_pantallas();", 15000);

}
if (typeof(wwreg) !="undefined"){
a_registro();
}
}

function createCustomMarkerImage(g){

		 	var myImage = new YImage();
		  	myImage.src = 'marcadores/sym_1'+g+'.png';
		 	myImage.size = new YSize(25,25);
			//myIMage.offset = new YCoordPoint(0,0);
		  	myImage.offsetSmartWindow = new YCoordPoint(0,0);
			return myImage;	
		}
		
function changeColor(id,color) {
//alert(id);
element = document.getElementById(id);


element.style.background = '#'+color;
} 

function cambiar2(id) {

element = document.getElementById(id);


element.style.background = 'blue';
element.style.color = 'white';
} 

function cambiar3(id) {
element = document.getElementById(id);


element.style.background = 'white';
element.style.color = 'black';
}

function pantalla2(x){



clearInterval (mpan);
pantalla(x);
mpan=setInterval("m_pantallas();", 15000);
}

function pantalla(x){

if (wclick!=x){
if (wclick!=0){


document.getElementById('opcion_'+wclick).style.backgroundPosition = "0 -140px";
document.getElementById('opcion_'+wclick).style.color = "#3462AE";
}

wclick=x;
pant=x;
document.getElementById('opcion_'+x).style.backgroundPosition = "-140px -30px";

document.getElementById('opcion_'+wclick).style.color = "#ffffff";

xmlhttp.open("GET","pantallas.php?num="+x+"&ciud="+document.getElementById("ciudades").value,true);

xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
   if (xmlhttp.status!=404) {
  
    document.getElementById("area").innerHTML=xmlhttp.responseText; 


   }
  }  
 }
 
 xmlhttp.send(null); 
 }
}

function c_fondo(x){

if (wclick!=x){
document.getElementById('opcion_'+x).style.backgroundPosition = "0px 0px";
//document.getElementById('opcion_2').style.backgroundPosition = "0 -140px";
}
}

function c_fondo2(x){
if (wclick!=x){
document.getElementById('opcion_'+x).style.backgroundPosition = "0px -140px";
}
}

function m_pantallas(){
pant=pant+1;
if (pant==5){
pant=1;
}
pantalla(pant);


}
function p_pantalla(){
if(ppan==0){
document.getElementById('opcion_5').style.backgroundPosition = "-140px -25px";
document.getElementById("opcion_5").innerHTML="<div  style='position: relative; top: 15px;'>Play</div>"; 
clearInterval (mpan);
ppan=1;}
else{
document.getElementById('opcion_5').style.backgroundPosition = "0px -25px";
document.getElementById("opcion_5").innerHTML="<div  style='position: relative; top: 15px;'>Pausa</div>"; 
mpan=setInterval("m_pantallas();", 15000);
ppan=0;
}
}

function vciudades(x){


document.getElementById("ciudades").value=x;
}
 function enviar(x) {
 
 location.href = x+'&ciudades='+document.getElementById("ciudades").value; 
 }

function a_registro(){
document.getElementById('todo').style.opacity = 0.4;
   
   document.getElementById('todo').style.filter="alpha(opacity=40)"; 

 //document.body.style.opacity=0.4;

 document.getElementById('registrob').style.top = (alto-600)/2 + 'px';

  document.getElementById('registrob').style.left = (ancho-500)/2 + 'px';
   
 document.getElementById('registrob').style.display = "block";
 parent.frames['registrob'].document.getElementById('forma_registro').reset();
parent.frames['registrob'].document.getElementById('log_res').innerHTML="";
parent.frames['registrob'].document.getElementById('clasificaciones').disabled=true;
 parent.frames['registrob'].document.getElementById('clasificaciones').options.length = 0;	
 //parent.frames[wid].document.getElementById(wid2).reset();
//parent.frames[wid].document.getElementById('log_res').innerHTML="";


}
 
 function c_registro(){
 document.getElementById('todo').style.opacity = 1;
 document.getElementById('todo').style.filter="alpha(opacity=100)"; 

  document.getElementById('registrob').style.display = "none";
 } 
 
  function c_publicidad(){
 document.getElementById('todo').style.opacity = 1;
 document.getElementById('todo').style.filter="alpha(opacity=100)"; 

  document.getElementById('publicidadb').style.display = "none";
  parent.frames['publicidadb'].document.getElementById('toolbar4').style.display = "none";
 } 
 
 function a_publicidad(){
document.getElementById('todo').style.opacity = 0.4;
   
   document.getElementById('todo').style.filter="alpha(opacity=40)"; 

 //document.body.style.opacity=0.4;

 document.getElementById('publicidadb').style.top = (alto-400)/2 + 'px';

  document.getElementById('publicidadb').style.left = (ancho-500)/2 + 'px';


   document.getElementById('publicidadb').style.display = "block";
    parent.frames['publicidadb'].document.getElementById('forma_publicidad').reset();
parent.frames['publicidadb'].document.getElementById('log_res').innerHTML="";
 }
 
 window.onload = iniciar;
