// JavaScript Document
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}


function ir(donde){
	window.location=donde;
}

function load_div(cual,div_id){				
		ColdFusion.navigate(cual,div_id);
	}			 
	

function do_menu(){	
	//document.getElementById('menu_top').style.left = findPosX(document.getElementById('pos_menu'));
	//document.getElementById('menu_top').style.position = "absolute; left:500 px;";
	if (document.getElementById('menu_top').style.display == "none" ){
		x=findPosX(document.getElementById('pos_menu'));	
		document.getElementById('menu_top').style.left = x + "px";
		document.getElementById('menu_top').style.display = "block";
	}else document.getElementById('menu_top').style.display = "none";
}
function do_menu_out(){
	document.getElementById('menu_top').style.display = "none";
}
function domensaje(){
	
}



function hide_show_lb(blockId,lable){
	
	if (document.getElementById(blockId).style.display == "none" ){
		document.getElementById(blockId).style.display = "block";	
		document.getElementById(lable).innerHTML = '(-)'; 							
	}
	else{								
		document.getElementById(blockId).style.display = "none";	
		document.getElementById(lable).innerHTML = '(+)';
	}	
}
function hide_show(div_l){
	if (div_l.style.display == 'block'){
		
		div_l.style.display = 'none';
	}
	else{
		
		div_l.style.display = 'block';
	}	
}

function show(div_l){
		div_l.style.display = 'block';
		
	
}
function max_min(label,div_l){
	if (label.innerHTML == '(-)'){
		label.innerHTML = '(+)';
		div_l.style.display = 'none';
	}
	else{
		label.innerHTML = '(-)';
		div_l.style.display = 'block';
	}
		
	
}
function hide_menu(){
	document.getElementById('menu_quie').style.display='none';
	document.getElementById('menu_facu').style.display='none';
	document.getElementById('menu_estu').style.display='none';
	document.getElementById('menu_doce').style.display='none';
	document.getElementById('menu_serv').style.display='none';
	
}
function div_show(div_var){
		div_var.style.display = 'block';
		
}
function div_hide(div_var){
		div_var.style.display = 'none';	
}
function div_show_ubi(div_var,ubi_td){
		div_var.style.display = 'block';
		x=findPosX(ubi_td) -10
		document.getElementById(div).style.left = x + "px";
}


function findPosX(obj) {
	  var curleft = 0;	
	  if(obj.offsetParent) {
		while(1) {
		  curleft += obj.offsetLeft;
		  if(!obj.offsetParent)
			break;
		  obj = obj.offsetParent;
		}
	  } else if(obj.x) {
		curleft += obj.x;
	  }
	
	  	obj.style.position = "static";		
		
	  return curleft;
}


window.addEvent('domready', function() {
	var el = $('myElement');
	
	// MooTools is able to handle effects without the use of a wrapper,
	// so you are able to do effects with just one easy line.
	
	//FIRST EXAMPLE
	
	// There are different ways to add a fading opacity effect to an element click
	
	// Short version
	$('fadeOpacity').addEvent('click', el.fade.bind(el, [0]));
	
	// Long version
	$('tweenOpacity').addEvent('click', function(e) {
		// You often will need to stop propagation of the event
		e.stop();
		el.fade(1);
	});
	
	$('tweenOpacity1').addEvent('click', function(e) {
		e.stop();
		el.fade(0.3);
	});
	
	
	//SECOND EXAMPLE
	var otherEl = $('myOtherElement');
	
	$('heightEffect').addEvent('click', function(){
		otherEl.tween('height', 50);
		return false; // alternative syntax to stop the event
	});
	
	// We can also create an Fx.Tween instance and use a wrapper variable
	
	var myEffect = new Fx.Tween(otherEl);
	$('colorEffect').addEvent('click', function(e) {
		e.stop();
		// We change the background-color of the element
		myEffect.start('background-color', '#E6EFC2');
	});
	
	$('borderEffect').addEvent('click', function(e) {
		e.stop();
		otherEl.tween('border', '10px dashed #C6D880');
	});
	
	$('resetEffect').addEvent('click', function(e) {
		e.stop();
		otherEl.erase('style');
	});
	
	
	//THIRD EXAMPLE
	
	var anotherEl = $('anotherElement');
	
	// Again we are able to create a morph instance
	var morph = new Fx.Morph('anotherElement');
	
	$('morphEffect').addEvent('click', function(e) {
		e.stop();
		morph.start({
			width: '200px',
			color: '#C6D880'
		});
	});
	
	// Or we just use Element.morph
	$('CSSmorphEffect').addEvent('click', function(e) {
		e.stop();
		// Changes the element's style to .myClass defined in the CSS
		anotherEl.morph('.myClass');
	});
	
	$('resetEffect1').addEvent('click', function(e) {
		e.stop();
		// You need the same selector defined in the CSS-File
		anotherEl.morph('div.demoElement');
	});
});


//funciones agregadas desde comunicados.cfm ECOMUNDO

function view_div(div_in) {	
	all_div_off();
	
	div_in.style.display = "block";
	var el = $(div_in.id);	
	el.fade(1);
};



function view_div_off(div_in) {	
	document.getElementById(div_in).style.display = "none";		
	var el = $(div_in);
	el.fade(0);
};

function ver_info(cod_info,tipo){
					all_div_off();
					//load_div('ife_more_info.cfm?cod_info=' + cod_info + '&tipo=' + tipo,'ife_main');
					ColdFusion.navigate('ife_more_info.cfm?cod_info=' + cod_info + '&tipo=' + tipo);
					//view_div(document.getElementById('ife_main'));
				};
				
function all_div_off() {
					  	
						view_div_off('ife_info_1'); 
						view_div_off('ife_info_2');
						view_div_off('ife_info_3');	
						//view_div_off('ife_main'); 		
									
					};
					
					
function ver_move(dond){
		document.form_gale.ini_row.value=dond;
		document.form_gale.submit();
	}
	
	
	function abrir_album(cod_info,tipo)
	{
		gale_all_div_off();
        gale_view_div(document.getElementById('guid_div'));
		ColdFusion.navigate('quienes_somos_galeria_album.cfm?cod_info=' + cod_info + '&tipo=' + tipo,'guid_div');
		
	};
	


	




