jQuery.ajaxSetup({contentType: "application/x-www-form-urlencoded; charset=utf-8"});

$(document).ready(function(){
	/* png transparent for IE6 
	$.ifixpng('data/img/pixel.gif');
	$('img[@src$=.png]').ifixpng();
	$('#headerAuto').ifixpng(); */
	
	$('#menuList').droppy();	
	$('#glowneNewsy .boxBigMenu').accordion({
		header: 'h3',
		autoHeight: false,
		change: function(event, ui) {
			var index = $(this).find("h3").index (ui.newHeader[0]);
            var img = ui.newHeader.find("a").attr("href");
			
			$(".boxBigImage > img").hide();
            $(".boxBigImage").find("img").attr("src", img);
			$(".boxBigImage > img").fadeIn();
		}
})	
	$('.boxesAccordion').accordion({
		header: 'h3',
		autoHeight: false
})	
	$(".galeriaBox .scrollable").scrollable({
		size: 3,
		prev: '.galeriaBox .prev',
		next: '.galeriaBox .next'
});	
	$(".galeriaVertical .scrollable").scrollable({
		size: 2,
		vertical: true,	
		prev: '.galeriaVertical .prev',
		next: '.galeriaVertical .next'
});	
	$(".mainGallery .scrollable").scrollable({
		size: 4,
		vertical: true,	
		prev: '.mainGallery .prev',
		next: '.mainGallery .next'
});		
       

var mainPlayer = document.getElementById('#mainPlayer');
 if(typeof photos != 'undefined' && photos) {
	$('.mainGallery .scrollable .items > a').click(function(){
	 var id = $('.mainGallery .scrollable .items > a').index(this);
	  var href = $('.mainGallery .scrollable .items > a:eq(' + id + ')').attr('href');
      var description = $('.mainGallery .scrollable .items > a:eq(' + id + ')').attr('title');

	 var galleryPreview = $(this).parent().parent().parent().parent().children(".galleryPreview");
	  galleryPreview.hide();
	  // Movies are handled by playlist module
	 	  $('.galleryPreview a').css('display','none');          
          var els = $('.items').children().length;         
          for(var i=0;i<els;i++) {    
         		if(id == i) { 
         			var string = ".imgContainer a#photo" + i;
            		$(string).css('display','block');
         			

			}          
          
		  description = $('<div>' + description + '</div>').html();
          $("#gallery-description").html(description);
}
$("#gallery-description").html(description);	 
	 galleryPreview.fadeIn();	 
	  $(".galleryPreview .fb").fancybox({ imageScale:true});
	 return false;

	//$.preloadImages('data/img/bg-menu.jpg');
});
};

jQuery.preloadImages = function() {
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
    }
}
});

