﻿jQuery.noConflict();

function topfotos(){

	//actual1 = 0;
	
	//do{
		randn = Math.floor(Math.random()*25);
	//}while(randn == actual1);

	jQuery("div#header-fotos img").fadeTo(1000, 0, function () {
		jQuery(this).attr("src", "skins/0/top/escola" + randn + ".jpg").load(function () {
			jQuery(this).fadeTo(1500,1);
		});
	});

	temps = setTimeout('topfotos()', 5000);
}

/*
 * Codi x fer q es mostrin o s'amaguin els items de la Cerca i mes ...
 */
jQuery(document).ready(function(){

	//temps = setTimeout('topfotos()', 2000);

	jQuery("input.button_js").css({'display': 'none'});

	
	/************** Expandir  ********************************/
	/* Fa visible el div amb el Expand i Collapse ALL */
	jQuery('div.expand_content').css({'display': 'none'});
	jQuery('div.search_box_expand').css({'display': 'block'});
	jQuery('div.expander a.menuExt').css({'display': 'inline'});
	
	/* Expandeix o contrau, segons com estigui en aquell moment, el contingut del item clicat */
	jQuery("div.expand_container a.menuExt").bind("click", function(e) { 
		if (this.className.indexOf("menuCom") == -1){
			jQuery(this)
				.addClass('menuCom')
				.css({'text-decoration': 'underline'})
				.parent().parent().find('div.expand_content').slideDown("slow");
		}
		else{
			jQuery(this)
				.removeClass('menuCom')
				.css({'text-decoration': 'none'})
				.parent().parent().find('div.expand_content').slideUp("slow");
		}
		return false;
	});
	
	/* Expandeix totes les taules de la cronologia */
	jQuery("div.expander a.menuExtALL").bind("click", function(e) { 
		jQuery("div.expand_container a.menuExt:not(.menuCom)").css({'text-decoration': 'underline'})
		jQuery("div.expand_container a.menuExt:not(.menuCom)").parent().parent().find('div.expand_content').slideDown("slow");
		jQuery("div.expand_container a.menuExt:not(.menuCom)").addClass('menuCom');
		return false;
	});

	/* Contrau totes les taules de la cronologia */
	jQuery("div.expander a.menuComALL").bind("click", function(e) { 
		jQuery("div.expand_container a.menuExt.menuCom").css({'text-decoration': 'none'})
		jQuery("div.expand_container a.menuExt.menuCom").parent().parent().find('div.expand_content').slideUp("slow");
		jQuery("div.expand_container a.menuExt.menuCom").removeClass('menuCom');
		return false;
	});
	/************** FI DE: Expandir  ********************************/
	
	if(typeof jQuery().pager == 'function') {
		jQuery('.gal-fotos-big').pager('div.pager_page', {
			navId: 'nav_pager_espais_dos',
			navAttach: 'after',
			prevText: '« Anterior',
			nextText: 'Següent »'
		});
	}
	
});//fi de Ready
