//Clase aviso


var openWindow=false;	//Indica si la ventana está abierta

function oW(url,w,h){
	var top=(parseInt(oWindow.height())-h)/2;
	var left=(parseInt(oWindow.width())-w)/2;
	var p="top="+top+",left="+left+",scrollbars=1,resizable=0,width="+w+",height="+h;
	window.open(url,"",p); 
}
function oF(url){ window.open(url,"",""); }


lSePo=function(ido,idd){
	var param;
	$(idd).options.length=0;
	$(idd).options[0] = new Option("cargando poblaciones...", "");
	var param="id="+$F(ido);
	new Ajax.Request(uJx+"poblaciones.php",{method:"get",parameters:param,onComplete:function(request){
		var r=eval("("+request.responseText+")");
		$(idd).options.length=0;
		if(r==null){
			$(idd).options[0] = new Option("sin poblaciones", "");	
		}else{
			$(idd).options[0] = new Option("", "");	
		}
		
		r.each(function(item,index){
			$(idd).options[index+1] = new Option(item.name,item.id);
		});
		
	}});	

}

	
var htmlInit=null;

var oLayer={
show:function(t,w,h,file,funcDest){
	var e=$("win");
	if(!e){ this.createWindow(); e=$("win"); }
	var c=$("whtml");
	$("cbar").innerHTML=t;
	e.style.position="absolute";
	e.style.width=w+"px";
	e.style.height=h+"px";
	c.style.height=(h-40)+"px";
	
	e.style.top=(parseInt(oWindow.height())/2)+(parseInt(oWindow.scrollHeight()))+"px";
	e.style.left="50%";
	e.style.marginTop=(-parseInt(h/2))+"px";
	e.style.marginLeft=-parseInt(w/2)+"px";
	e.style.zIndex="1000";
	this.opacity();
	openWindow=true;
	//e.show();
	new Effect.BlindDown("win");
	if(file!=""){
		$("whtml").innerHTML="<div class='aviso'>"+imgLoad+"<br>cargando</div>";
		new Ajax.Updater("whtml",file,{method:"get",onComplete:funcDest});	
	}
},
remove:function(){
	var e=$("win");
	e.style.top=(parseInt(oWindow.height())/2)+(parseInt(oWindow.scrollHeight()))+"px";
},
close:function(){
	var e=$("win");
	if(e){ 
		//e.hide(); 
		new Effect.BlindUp("win",{afterFinish:function(){
			var o=$("Lopacity"); if(o){ o.hide(); }
			var o=$("iframeOpa"); if(o){ o.hide(); }		
		}});
		openWindow=false; 
	}
	
	
},
upd:function(d,file){
	if($(d)){
		if(htmlInit==null) htmlInit=$(d).innerHTML;
		$(d).innerHTML="<div class='aviso'>"+imgLoad+"<br>cargando datos...</div>";
		new Ajax.Updater(d,file,{method:"get"});
	}
},
reset:function(d){
	if(htmlInit!=null) $(d).innerHTML=htmlInit;
},
load:function(file){
	$("whtml").innerHTML="<div class='aviso'>"+imgLoad+"<br>cargando</div>";
	new Ajax.Updater("whtml",file,{method:"get"});
	
},
opacity:function(){
	var e=$("Lopacity");
	if(!e){
		var e=document.createElement("div");
		e.id="Lopacity";
		document.body.appendChild(e);
	}
	e.style.position="absolute";
	e.style.zIndex="999";
	e.style.top="0px";
	e.style.left="0px";
	e.style.height=parseInt(oWindow.realHeight())+"px";
	e.style.width=parseInt(oWindow.realWidth())+"px";
	e.style.backgroundColor="#3b3b38";
	e.style.filter = "alpha(opacity=80)";
	e.style.opacity="0.8";
	Element.show("Lopacity");
	if(browser.isIE){ this.iframeOpacity(); }
},
iframeOpacity:function(){
	var e=$("iframeOpa");
	if(!e){
		var e=document.createElement("iframe");
		e.id="iframeOpa";
		document.body.appendChild(e);
	}
	e.style.position="absolute";
	e.style.top="0px";
	e.style.left="0px";
	e.style.zIndex="998";
	e.style.height=parseInt(oWindow.realHeight())+"px";
	e.style.width=parseInt(oWindow.realWidth())+"px";
	e.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';
	Element.show("iframeOpa");
},
createWindow:function(){
	var e=$("win");	
	if(!e){
		var e=document.createElement("div");
		e.id="win";
		e.style.display='none';
		document.body.appendChild(e);
		h='<div id="bar"><span id="cbar"></span><a href="javascript:oLayer.close();">'+
		'<img src="'+uIm+'close.gif" alt="cerrar" title="cerrar" /></a>'+
		'</div><div id="lcnt"><div id="whtml"></div></div>';	
		e.innerHTML=h;
	}
	
	
}

};

// Extension del objeto pantalla
var oWindow={
height:function(){
	if(window.innerHeight){
		return window.innerHeight;
   	}else if(document.body.parentElement.clientHeight){ 
		return document.body.parentElement.clientHeight;
	}else if(document.body && document.body.clientHeight){ 
		return document.body.clientHeight;
	}
	return 0;	
},
width:function(){
	if (window.innerWidth) {
       	return window.innerWidth;
   	}else if (document.body.parentElement.clientWidth){
		return document.body.parentElement.clientWidth;
	}else if (document.body && document.body.clientWidth) {
       	return document.body.clientWidth;
	}
   	return 0;
},
realHeight:function(){
	var y=0;
	var y1=document.body.offsetHeight;
	var y2=parseInt(this.height());
	(y1>y2)?y=y1:y=y2;
	return y;
},
realWidth:function(){
	var x=0;
	var x1=document.body.offsetWidth;
	var x2=parseInt(this.width());
	(x1>x2)?x=x1:x=x2;
	return x1;
},
scrollHeight:function(){
	var sh=0;
	if(document.body && typeof(document.body.scrollTop)!="undefined"){
   		sh += document.body.scrollTop;
		if(document.body.parentNode&&typeof(document.body.parentNode.scrollTop)!="undefined"){
			sh += document.body.parentNode.scrollTop;
		}
 	}else if(typeof(window.pageYOffset)!="undefined"){
		sh += window.pageYffset;
    }	
	return sh;
},
scrollWidth:function(){
	var sw=0;
	if(document.body && typeof(document.body.scrollLeft)!="undefined"){
    	sw += document.body.scrollLeft;
		if(document.body.parentNode&&typeof(document.body.parentNode.scrollLeft)!="undefined"){
			sw += document.body.parentNode.scrollLeft;
		}
    }else if(typeof(window.pageXOffset)!= "undefined"){
		sw += window.pageXOffset;
    }	
	return sw;
}

};

// Objeto de flash
var oFlash={
swf:function(url,width,height,titulo){
	if(FlashDetect.installed){
		h='<object type="application/x-shockwave-flash" data="'+url+'" '+
		'width="'+width+'" height="'+height+'">'+
		'<param name="movie" value="'+url+'" />'+
		'<param name="wmode" value="transparent"></param>'+
		'<param name="quality" value="high" />'+
		'</object>';
	}else{ h="<p class='no'>"+ERR_18+"</p>";	 }
	document.write(h);
	},
youtube:function(url,width,height,id){
	if(FlashDetect.installed){	
		h='<object width='+width+'" height="'+height+'">'+
		'<param name="movie" value="'+url+'&rel=1"></param>'+
		'<param name="wmode" value="transparent"></param>'+
		'<embed src="'+url+'&rel=1" type="application/x-shockwave-flash" '+
		'wmode="transparent" width="'+width+'" height="'+height+'">'+
		'</embed></object>';
	}else{ h="<p class='no'>"+ERR_18+"</p>";	 }	
	document.write(h);
	},
quicktime:function(u,w,h,id){
	h='<object width="'+w+'" height="'+h+'" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" '+ 
	'codebase="http://www.apple.com/qtactivex/qtplugin.cab"> '+
	'<param name="src" value="'+u+'" /> '+
	'<param name="target" value="myself" /> '+
	'<param name="controller" value="true" /> '+
	'<param name="autoplay" value="false" /> '+
	'<param name="scale" value="ToFit" /> '+
	'<embed width="'+w+'" height="'+h+'" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/" '+
		'src="'+u+'" '+
		'target="myself" '+
		'controller="true" '+
		'autoplay="false" '+
		'scale="ToFit"> '+
	'</embed> '+
	'</object> ';
	document.write(h);
	},	
video:function(url,width,height,id){
	if(FlashDetect.installed){
		h='<object type="application/x-shockwave-flash" data="'+url+'" '+
		'width="'+width+'" height="'+height+'">'+
		'<param name="movie" value="'+url+'" />'+
		'<param name="quality" value="high" />'+
		'</object>';
	}else{ h="<p class='no'>"+ERR_18+"</p>";	 }	
	document.write(h);
	}
};


function createMarker(point,html,icono) {
	var blueIcon = new GIcon(G_DEFAULT_ICON);
	blueIcon.image = icono;
	markerOptions = { icon:blueIcon,draggable:false};
	
	var marker = new GMarker(point,markerOptions);
	GEvent.addListener(marker,"click",function(){
		marker.openInfoWindowHtml(html);
  	});
	
  return marker;
}


/*
Copyright (c) Copyright (c) 2007, Carl S. Yestrau All rights reserved.
Code licensed under the BSD License: http://www.featureblend.com/license.txt
Version: 1.0.2
*/
var FlashDetect=new function(){var self=this;self.installed=false;self.major=-1;self.minor=-1;self.revision=-1;self.revisionStr="";self.activeXVersion="";var activeXDetectRules=[{"name":"ShockwaveFlash.ShockwaveFlash.7","version":function(obj){return getActiveXVersion(obj);}},{"name":"ShockwaveFlash.ShockwaveFlash.6","version":function(obj){var version="6,0,21";try{obj.AllowScriptAccess="always";version=getActiveXVersion(obj);}catch(err){}
return version;}},{"name":"ShockwaveFlash.ShockwaveFlash","version":function(obj){return getActiveXVersion(obj);}}];var getActiveXVersion=function(activeXObj){var version=-1;try{version=activeXObj.GetVariable("$version");}catch(err){}
return version;};var getActiveXObject=function(name){var obj=-1;try{obj=new ActiveXObject(name);}catch(err){}
return obj;};var parseActiveXVersion=function(str){var versionArray=str.split(",");return{"major":parseInt(versionArray[0].split(" ")[1],10),"minor":parseInt(versionArray[1],10),"revision":parseInt(versionArray[2],10),"revisionStr":versionArray[2]};};var parseRevisionStrToInt=function(str){return parseInt(str.replace(/[a-zA-Z]/g,""),10)||self.revision;};self.majorAtLeast=function(version){return self.major>=version;};self.FlashDetect=function(){if(navigator.plugins&&navigator.plugins.length>0){var type='application/x-shockwave-flash';var mimeTypes=navigator.mimeTypes;if(mimeTypes&&mimeTypes[type]&&mimeTypes[type].enabledPlugin&&mimeTypes[type].enabledPlugin.description){var desc=mimeTypes[type].enabledPlugin.description;var descParts=desc.split(' ');var majorMinor=descParts[2].split('.');self.major=parseInt(majorMinor[0],10);self.minor=parseInt(majorMinor[1],10);self.revisionStr=descParts[3];self.revision=parseRevisionStrToInt(self.revisionStr);self.installed=true;}}else if(navigator.appVersion.indexOf("Mac")==-1&&window.execScript){var version=-1;for(var i=0;i<activeXDetectRules.length&&version==-1;i++){var obj=getActiveXObject(activeXDetectRules[i].name);if(typeof obj=="object"){self.installed=true;version=activeXDetectRules[i].version(obj);if(version!=-1){var versionObj=parseActiveXVersion(version);self.major=versionObj.major;self.minor=versionObj.minor;self.revision=versionObj.revision;self.revisionStr=versionObj.revisionStr;self.activeXVersion=version;}}}}}();};FlashDetect.release="1.0.2";


function precargar(id) {
	if(id==undefined) id="mrc";
	$(id).hide();
	var p = true;	
	$$("#"+id+" img").each(function(item){
		p=item.complete;		
	});	
	if (p){ 
		$(id).show();
		if($("loadpage")) $("loadpage").hide();
	}else{ 
		setTimeout("precargar("+id+")", 100);
	}
}


function maxC(obj,limit,n){
	var o=$(n);
	if (parseInt(obj.value.length)>parseInt(limit))
		obj.value = obj.value.substring(0,limit);
	o.innerHTML = parseInt(limit) - parseInt(obj.value.length);
}

var controlBur_bind;

function burIn(event){
	$("burbujas").show();
	burMove(event);
	//Event.observe(window, 'mousemove', controlBur_bind);
}

function burOut(){
	//Event.stopObserving(window,'mousemove', controlBur_bind);
	$("burbujas").hide();
}

function burMove(event){
	var x=Event.pointerX(event);
	var y=Event.pointerY(event);
	var e=$("burbujas");
	e.style.top=parseInt(y-40)+"px";
	e.style.left=parseInt(x)+4+"px";
	e.show();
}

controlBur_bind = burMove.bindAsEventListener();

