/* RESALTAR */

window.onload = function(){
	moneyElement = document.getElementsByClassName("moneychange");
	for (i=0; i< moneyElement.length; i++){
		moneyElement[i].onmouseover = function(){
			this.lastChild.style.display="block";
		}
		moneyElement[i].onmouseout=function() {
			this.lastChild.style.display="none";
		}
	}
}


/* ACORDION FAQS */

function accordion(){
	var IdOpenDiv;
	
	$$(".accordion_content").invoke("hide");
	
	this.abrir = function(element){
		if(this.IdOpenDiv != element){
			$$(".accordion_content").invoke("hide");
		}
		Effect.toggle(element, 'blind', {duration: 0.3});
		this.IdOpenDiv = element;
	}
	
	this.cerrar = function(element){
		alert(element);
	}
	
}





/* FUNCIONES DEL SITIO DAR */

/*
for(i in document){
	document.writeln("<b>"+ i +"</b> = "+ document[i] +"<br>");
}
*/


/*
Habre un pop-up dentro de la ventana dejando la página en segundo plano (31/10/2007)
*/
var rPopUp = function(sContenidos){
	document.body.style.overflow = "hidden";
	
	//Inserto el contenido del popup (ver de hacerlo por ajax)
	$('page-popup-contents').update(sContenidos);
	
	//muestro el pop-up
	Effect.Appear('page-screen', {to: .7});
	Effect.Appear('page-popup', {delay: 1});

	//cerrar pop-up
	this.close = function(){
		Effect.Fade('page-popup', {from: 1, to: 0});
		Effect.Fade('page-screen', {delay: 1});
		document.body.style.overflow = "auto";
	};
};


/*
Rota los textos del título
*/
var rMarquee = function(){
	var aFraces = new Array(
				"Más de 2.000.000 de extranjeros visitaron la Argentina este año",
				"El 81% de los turistas viajó a Argentina por vacaciones",
				"El turismo receptivo le dejó a Argentina ingresos por 920 millones de dólares",
				"El 95 % de turistas quieren volver a Argentina");
	var i = 0;
	document.writeln('<div id="rMarquee"></div>');

	rotar = function(){
		$('rMarquee').update(aFraces[i])
		Effect.Appear('rMarquee', {duration: 1});
		Effect.Fade('rMarquee', {duration: 1, delay: 4});
		i++;
		if(i == 4) i = 0;
		setTimeout("rotar()", 5000);
	};
	
	//arranco el rotador de fraces
	rotar();
};

/*
Validador de formularios
*/

function rValidator(sForm){
	rVal = document.getElementsByClassName("rRequerido");
	bError = false;
	for (i=0; i< rVal.length; i++){
		if(rVal[i].value == ""){
			new Effect.Highlight(rVal[i], {startcolor:'#ff0000'});
			rVal[i].style.border = "1px solid #ff0000";
			bError = true;
			rVal[i].onfocus = function(){
				this.style.border = "";
			}
		}
	}
	
	if(bError){
		$('rValidatorAlert').show();
		new Effect.Highlight($('rValidatorAlert'), {startcolor:'#FFCCCC'});
		$('rValidatorAlert').scrollTo();
	}else{
		$(sForm).submit();	
	}
	
}


function rActiveFields(){
	aFields = document.getElementsByClassName("rField");
	for (i=0; i< aFields.length; i++){
		aFields[i].onfocus = function(){
			this.style.border = "2px solid #337ec1";
			this.style.margin = "0";
		};
		aFields[i].onblur = function(){
			this.style.border = "1px solid #EBF2F9";
			this.style.margin = "1px";
		};
	}
}

function rQuickZoom(srcIn, srcOut){
	document.writeln('<div><img src="images/spacer.gif" id="rZoomSpacer" width="1" height="1" border="0" /><div id="rImageDiv" style="margin: 0 auto; position: relative; width: 100%; text-align: center;">');
	document.writeln('<img src="'+ srcIn +'" id="rImageSmall" border="0" width="329" height="201" title="Zoon In" style="position: absolute; border: 1px solid #eeeeee; cursor: pointer;" />');
	document.writeln('<img src="'+ srcOut +'" id="rImageBig" border="0" width="329" height="201" title="Zoon Out" style="border: 1px solid #999999; cursor: pointer;" />');
	document.writeln('</div></div>');
	
	$('rImageSmall').onmouseover = function(){
		$('rImageSmall').setStyle({border: "1px solid #999999"})
	}
	$('rImageSmall').onmouseout = function(){
		$('rImageSmall').setStyle({border: "1px solid #eeeeee"})
	}
	
	$('rImageSmall').onclick = function(){
		$('rImageDiv').setStyle({position: "absolute", left: "0px"});
		if(!document.all) $('rImageDiv').setStyle({marginTop: '-221px'});
	
		Effect.Fade('rImageSmall');
		$('rZoomSpacer').style.height = "221px";
		new Effect.Scale('rImageSmall', 200);
		new Effect.Scale('rImageBig', 200);
	};
	
	$('rImageBig').onclick = function(){
		Effect.Appear('rImageSmall');
		new Effect.Scale('rImageSmall', 50);
		new Effect.Scale('rImageBig', 50);
		setTimeout("$('rImageDiv').setStyle({position: 'relative'}); $('rZoomSpacer').style.height = '1px'; if(!document.all) $('rImageDiv').setStyle({marginTop: '1px'});", 1000);
	};
}

