var curCropper,errores='';
AIM = {

	frame : function(c) {

		var n = 'f' + Math.floor(Math.random() * 99999);
		var d = document.createElement('DIV');
		d.innerHTML = '<iframe style="display:none" src="about:blank" id="'+n+'" name="'+n+'" onload="AIM.loaded(\''+n+'\')"></iframe>';
		document.body.appendChild(d);

		var i = document.getElementById(n);
		if (c && typeof(c.onComplete) == 'function') {
			i.onComplete = c.onComplete;
		}

		return n;
	},

	form : function(f, name) {
		f.setAttribute('target', name);
	},

	submit : function(f, c) {
		AIM.form(f, AIM.frame(c));
		if (c && typeof(c.onStart) == 'function') {
			return c.onStart();
		} else {
			return true;
		}
	},

	loaded : function(id) {
		var i = document.getElementById(id);
		if (i.contentDocument) {
			var d = i.contentDocument;
		} else if (i.contentWindow) {
			var d = i.contentWindow.document;
		} else {
			var d = window.frames[id].document;
		}
		if (d.location.href == "about:blank") {
			return;
		}

		if (typeof(i.onComplete) == 'function') {
			i.onComplete(d.body.innerHTML);
		}
	}

}


function showAjaxLoader(divContainer,idLoader,claseCSS)
{
	var objCont=$(divContainer);
	var tamano= Element.getDimensions(divContainer);
	var d = document.createElement('DIV');
	d.id=idLoader+"panel";
	d.className="ajaxPanel";
	d.style.width=tamano.width;
	d.style.height=tamano.height;
	var l = document.createElement('DIV');
	l.id=idLoader+"loader";
	l.className=claseCSS;
	l.style.width=tamano.width;
	l.style.height=tamano.height;
	objCont.appendChild(d);
	objCont.appendChild(l);
}

function hideAjaxLoader(idLoader)
{
	Element.remove(idLoader+"panel");
	Element.remove(idLoader+"loader");
}

function cargaTerminada( resp )	
{
hideAjaxLoader('ajaxLoaderDiv');
}

function toggleCheckBox (idCheck)
{
if ($(idCheck).checked==true)
	$(idCheck).checked=false;
else
	$(idCheck).checked=true;
}



var divActivo=null;

function confirm_entry(){
input_box=confirm('Al recordar tu contraseņa la pagina automaticamente iniciara tu sesion incluyendo en computadoras publicas, estas seguro de querer continuar?');
if (input_box==true){ 
	$('mantener').checked=true; 
	}
else{
	$('mantener').checked=false;
	}
}


function formularioContacto(formulario)
{
	alert();
	var errores='';
	if(!$ ) return;
	var f = $( formulario ).getelements();  // Buscar Los Elementos 
for( var i = 0; i < f.length; i++ )  
	{
		
	if (f[i].name!='elementos' && f[i].type!='submit')
		{
		if (i==0)
			{
			$('elementos').value=f[i].name;
			}
		else
			{
			$('elementos').value=$('elementos').value + '|' + f[i].name;
			}
		}
	}
	//alert($('elementos').value);
  document.valorRetorno = (errores == '');
}


function thumbImagen(idImagen)
{
	$('div'+idImagen).style.display='block';
	var objImagen=$(idImagen);
	var dimensions = $(idImagen).getDimensions();
	var ancho=$(idImagen).height;
	//dimensions.height;
	var porcen = ((100 * 100) /(ancho))/100 ;
	ancho=$(idImagen).width;
	objImagen.width='100';
	if ($(idImagen).getHeight()>100)
	{
	objImagen.height='100';
	objImagen.width=ancho*porcen;
	}
	
}


var color=new Array("333366","333366","333366","444477","555588","666699","7777aa","8888bb","7777aa","666699","555588","444477");

function animarColorTexto(x,div,txt){
	var html="";
	for(i=txt.length-1,j=x;i>=0;i--){
		html="<font color='#"+color[j]+"'>"+txt.charAt(i)+"</font>"+html;
		j+=1;
		if(j==color.length)
			j=0;
	}
	document.getElementById(div).innerHTML=html;
	x=x==color.length-1?0:x+1;
	setTimeout("animarColorTexto("+x+",'"+div+"','"+txt+"')",250);
}

	
function startCallback() {
	//showAjaxLoader("uploadAjaxForm","ajaxLoaderDiv","ajaxLoaderBar");
	return true;
}

function completeCallback(response) {
	// make something useful after (onComplete)
	//document.getElementById('nr').innerHTML = parseInt(document.getElementById('nr').innerHTML) + 1;
	//hideAjaxLoader("ajaxLoaderDiv");
	//alert(response);
	$('#AjaxDiv').html(response);
}
		
function soloNumeros(valor)
{
    if (isNaN(valor))
	{
	window.event.returnValue = false;  
	}			
}

function noinput(){
			window.event.returnValue = false;
		  }
		  
function mostrarPanelAnuncio(idPanel)
{

	$('#InformacionAnuncio').hide();
	$('#GaleriaAnuncio').hide();
	$('#UbicacionAnuncio').hide();
	switch (idPanel)
	{
		case 3:
				$('#UbicacionAnuncio').show();
				$('#MapaAnuncio').html($('#MapaAnuncioHidden').val());
	}
	
}

function detenerError(){
return true
}
window.onerror=detenerError