function checkTags(object, tags){
	//alert(object.attr('class'));
	//alert(tags);
	
	for(i=0;i<tags.length;i++){
		if(object.is('.'+tags[i])) return true;
	}
	return false;
}

 $(document).ready(function(){
	if($(".artista-container img")>0){
		$(".artista-container img").lazyload({
			 placeholder : "img/grey.gif",       
			 effect      : "fadeIn"
		 });
	}
	 $('a.colorbox_link').colorbox(
		{
			maxWidth:'90%',
			maxHeight:'90%',
			current:"imatge {current} de {total}",
			previous:"anterior",
			next:"seg&uuml;ent",
			close:"tancar",
			slideshow: true,
			slideshowAuto: false,
			slideshowStart: "INICIAR",
			slideshowStop: "ATURAR"
		
		});
		
		$('#logo_header').click(function(){
			document.location='index.html';
		});
		
		if($('#issu-link').size()>0){
			$('#issu-link').colorbox({
				width:'960px',
				height:'550px'
			});
		}
		
		
		if($('.tags-list').size()>0){
			$('.tags-list a').click(function(e){
				
				e.preventDefault();
				
				if($(this).hasClass('show-all')){
					if($(this).parent().hasClass('disabled')){
						$('.tags-list li').addClass('enabled');
						$('.tags-list li').removeClass('disabled');
						$('.artista-container').slideDown(300);
					}else{	
						$('.tags-list li').addClass('disabled');
						$('.tags-list li').removeClass('enabled');
						//$(this).removeClass('disabled')
						$('.artista-container').slideUp(300);
					}
				}else{
					var selecteds=[];
					var tagclass=$(this).attr('href').split("#")[1];
					$('.tags-list li.enabled').each(function(){
						selecteds.push($(this).find('a').attr('href').split("#")[1]);
					});
					
						//split the url by # and get the anchor target name - home in mysitecom/index.htm#home
						
						if($(this).parent().hasClass('disabled')){
							selecteds.push(tagclass);
							$(this).parent().removeClass('disabled');
							$(this).parent().addClass('enabled');
							$('.'+tagclass).slideDown(300);
						
						}else{
							var idx = selecteds.indexOf(tagclass);
							if(idx!=-1) selecteds.splice(idx, 1);
							var taglink=$(this).parent();
							$('.'+tagclass).each(function(){
								if(!checkTags($(this),selecteds)){
									$(this).slideUp(300);
								}
							});
							
							taglink.removeClass('enabled');
							taglink.addClass('disabled');
									
						
						}
						
						//alert(selecteds);	
					
						
						//goto that anchor by setting the body scroll top to anchor top
						//$('html, body').animate({scrollTop:target_top}, 500,function(e){window.location.href=full_url;});
						
				}
			});
		}
		/*$(".artists-list li a").click(function(event){
					//prevent the default action for the click event
					event.preventDefault();
					//alert(this);
					//get the full url - like mysitecom/index.htm#home
					var full_url = this.href;
					//alert(full_url);
					if(full_url.indexOf('#')!=-1){
						//split the url by # and get the anchor target name - home in mysitecom/index.htm#home
						var parts = full_url.split("#");
						var trgt = parts[1];
				
						//get the top offset of the target anchor
						var target_offset = $("#"+trgt).offset();
						var target_top = target_offset.top;
				
						//goto that anchor by setting the body scroll top to anchor top
						$('html, body').animate({scrollTop:target_top}, 500,function(e){window.location.href=full_url;});
					}
				});*/

	 });
	 
