// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function showArrow(arrow_id){
	var arrow = document.getElementById("arrow_"+arrow_id);										
	if (arrow != null) {		
		arrow.className='right_button_on'
	}
}
function hideArrow(arrow_id){
	var arrow = document.getElementById("arrow_"+arrow_id);											
	if (arrow != null) {	
		arrow.className='right_button_off'
	}
}
function showArrowHouse(arrow_id){
	var arrow = document.getElementById("arrow_"+arrow_id);										
	if (arrow != null) {		
		arrow.className='right_button_house_on'
	}
}
function hideArrowHouse(arrow_id){
	var arrow = document.getElementById("arrow_"+arrow_id);											
	if (arrow != null) {	
		arrow.className='right_button_house_off'
	}
}
function leftShowArrow(arrow_id){
	var arrow = document.getElementById("arrow_"+arrow_id);											
	if (arrow != null) {
		arrow.className='left_button_on'
	}
}
function leftHideArrow(arrow_id){
	var arrow = document.getElementById("arrow_"+arrow_id);											
	if (arrow != null) {	
		arrow.className='left_button_off'
	}
}

function addArrowToRollover(element_id){
	var element=document.createElement('img');
	var rollover=document.getElementById("rollover_"+element_id);
	var gko = navigator.userAgent.toLowerCase();	
	rollover.appendChild(element);
	element.setAttribute('src', '/images/adelante.jpg');
	element.setAttribute('id', "arrow_" + element_id);	
	if (gko.indexOf('gecko') != -1) 
	{//is firefox safari
		element.setAttribute('class', 'left_button_off');
	}
	else {   //is I Explorer
		element.className='left_button_off'
//		element.setAttribute('className','left_button_off');
	}
}


function addRightArrowToRollover(element_id){

	var element=document.createElement('img');
	var rollover=document.getElementById("rollover_"+element_id);
	rollover.appendChild(element);
	element.setAttribute('src','/images/atras.jpg');
	element.setAttribute('id',"arrow_"+element_id);
	var gko = navigator.userAgent.toLowerCase()
	if (gko.indexOf('gecko') != -1) 
	{//is firefox safari
		element.setAttribute('class','right_button_off');
	}
	else {   //is I Explroer
		element.className='right_button_off'
//		element.setAttribute('className','right_button_off');
	}
	
}
function addRightArrowHouseToRollover(element_id){

	var element=document.createElement('img');
	var rollover=document.getElementById("rollover_"+element_id);
	rollover.appendChild(element);
	element.setAttribute('src','/images/atras.jpg');
	element.setAttribute('id',"arrow_"+element_id);
	var gko = navigator.userAgent.toLowerCase()
	if (gko.indexOf('gecko') != -1) 
	{//is firefox safari
		element.setAttribute('class','right_button_house_off');
	}
	else {   //is I Explroer
	element.className='right_button_house_off'	
//		element.setAttribute('className','right_button_house_off');
	}
	
}

function submitEnter(e)
{
	var keycode;
	if (window.event) 
	keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	
	if (keycode == 13)
	   {
	   document.login.submit()
	   return false;
	   }
	else
	   return true;
}

function hideArticles(year){
	var articles = document.getElementById("articles_"+year);											
	var year_min = document.getElementById("year_"+year+"_min");													
	var year_max = document.getElementById("year_"+year+"_max");													
	if (articles != null) {	
		articles.className='articles_hide'
	}
	if (year_min != null) {	
		year_min.className='articles_hide'
	}
	if (year_max != null) {	
		year_max.className='articles_show'
	}
	
}

function showArticles(year){
	var articles = document.getElementById("articles_"+year);
	var year_min = document.getElementById("year_"+year+"_min");													
	var year_max = document.getElementById("year_"+year+"_max");													
	if (articles != null) {	
		articles.className='articles_show'
	}
	if (year_min != null) {	
		year_min.className='articles_show'
	}
	if (year_max != null) {	
		year_max.className='articles_hide'
	}		
}	

function changeMinImage(image,turnOn){
	var image = document.getElementById(image);
	if (image != null) {
		if (turnOn == true) {
			image.src = '/images/min_on.gif'
		}else{
			image.src = '/images/min_off.gif'			
		}		
	}
}
function changeMaxImage(image,turnOn){
	var image = document.getElementById(image);
	if (image != null) {
		if (turnOn == true) {
			image.src = '/images/max_on.gif'
		}else{
			image.src = '/images/max_off.gif'			
		}		
	}
}
// functios for the blog

function hideMonths(year){
	var months = document.getElementById("archive_months_"+year);											
	var year_min = document.getElementById("year_"+year+"_min");													
	var year_max = document.getElementById("year_"+year+"_max");													
	if (months != null) {	
		months.className='articles_hide'
	}
	if (year_min != null) {	
		year_min.className='articles_hide'
	}
	if (year_max != null) {	
		year_max.className='articles_show'
	}
	
}

function showMonths(year){
	var months = document.getElementById("archive_months_"+year);
	var year_min = document.getElementById("year_"+year+"_min");													
	var year_max = document.getElementById("year_"+year+"_max");													
	if (months != null) {	
		months.className='articles_show'
	}
	if (year_min != null) {	
		year_min.className='articles_show'
	}
	if (year_max != null) {	
		year_max.className='articles_hide'
	}		
}	

function showHidePosts(year,month){
	var posts = document.getElementById("archive_posts_"+month+"_"+year);											
	if (posts != null) {
		if (posts.className =='articles_hide'){
			posts.className='articles_show'			
		}
		else{
		posts.className='articles_hide'			
		}	
	}
	
}

