var mycarousel_itemList = [
    {url: 'art/pub/166/aguasdelapalma.jpg', title: ''},
    {url: 'art/pub/166/ayumar.jpg', title: ''},
    {url: 'art/pub/166/islas.jpg', title: ''},
    {url: 'art/pub/166/traysesa.jpg', title: ''},
	{url: 'art/pub/166/hummel.jpg', title: ''},
    {url: 'art/pub/166/cupalma.jpg', title: ''},
    {url: 'art/pub/166/doris.jpg', title: ''},
    {url: 'art/pub/166/tinabana.jpg', title: ''},
    {url: 'art/pub/166/elguanche.jpg', title: ''},
    {url: 'art/pub/166/playamont.jpg', title: ''},
    {url: 'art/pub/166/toldospalma.jpg', title: ''},
    {url: 'art/pub/166/agrovial.jpg', title: ''},
    {url: 'art/pub/166/antani.jpg', title: ''},
	{url: 'art/pub/166/conseca.jpg', title: ''}
];

function nuevoAjax(){
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
function pasa_menus(){
	var actu=document.getElementById('menu_actualidad_mostrado').value;
	var club=document.getElementById('menu_club_mostrado').value;
	var liga=document.getElementById('menu_liga_mostrado').value;
	var post=document.getElementById('menu_post_mostrado').value;
	var equi=document.getElementById('menu_equipo_mostrado').value;
	var url_menu = "actualiza_menus.php?actu="+actu+"&club="+club+"&liga="+liga+"&post="+post+"&equi="+equi;
	ajax=nuevoAjax();
	ajax.open("GET", url_menu,true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			//contenedor.innerHTML = ajax.responseText
		}
	}
	ajax.send(null)
}
// FIN AJAX
function muestra_ElClub(){
	if (document.getElementById('menu_club_mostrado').value == "block"){
		new Effect.Fade(document.getElementById('menu_club'));
		document.getElementById('menu_club_mostrado').value = "none";pasa_menus();
	}else{
		new Effect.Appear(document.getElementById('menu_club'));
		document.getElementById('menu_club_mostrado').value = "block";pasa_menus();
		//document.location='index.php?cat=3'
	}
}
function muestra_Equipo(){
	if (document.getElementById('menu_equipo_mostrado').value == "block"){
		new Effect.Fade(document.getElementById('menu_equipo'));
		document.getElementById('menu_equipo_mostrado').value = "none";pasa_menus();
	}else{
		new Effect.Appear(document.getElementById('menu_equipo'));
		document.getElementById('menu_equipo_mostrado').value = "block";pasa_menus();
	}
}
function muestra_Liga(){
	if (document.getElementById('menu_liga_mostrado').value == "block"){
		new Effect.Fade(document.getElementById('menu_liga'));
		document.getElementById('menu_liga_mostrado').value = "none";pasa_menus();
	}else{
		new Effect.Appear(document.getElementById('menu_liga'));
		document.getElementById('menu_liga_mostrado').value = "block";pasa_menus();
	}
}
function muestra_Post(){
	if (document.getElementById('menu_post_mostrado').value == "block"){
		new Effect.Fade(document.getElementById('menu_post'));pasa_menus();
		document.getElementById('menu_post_mostrado').value = "none";
	}else{
		new Effect.Appear(document.getElementById('menu_post'));
		document.getElementById('menu_post_mostrado').value = "block";pasa_menus();
	}
}
function muestra_Actualidad(){
	if (document.getElementById('menu_actualidad_mostrado').value == "block"){
		new Effect.Fade(document.getElementById('menu_actualidad'));
		document.getElementById('menu_actualidad_mostrado').value = "none";pasa_menus();
	}else{
		new Effect.Appear(document.getElementById('menu_actualidad'));
		document.getElementById('menu_actualidad_mostrado').value = "block";pasa_menus();
	}
}
// Funciones del carrusel
function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
    // The index() method calculates the index from a
    // given index who is out of the actual item range.
    var idx = carousel.index(i, mycarousel_itemList.length);
    carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1]));
};

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
    carousel.remove(i);
};

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(item)
{
    //return '<img src="' + item.url + '" width="90" height="90" alt="' + item.title + '" />';
	return '<img src="' + item.url + '" alt="' + item.title + '" />';
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
		auto: 5,	/*Segundos*/
		scroll: 1,
        wrap: 'circular',
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback},
		buttonNextHTML: '',
		buttonPrevHTML: '',
		visible: 4
    });
});
