function initShowSection(){
	Behaviour.apply();
}

var myrules = {
		'.show_extend a' : function(el){
			el.href="javascript:void(0);";
			var id=el.id.replace(/zoomshow_(\d+)/,'$1');
			el.onclick=function(){
				goShowDetails(id,this);
			}
		},
		'.backshowlist a' : function(el){
			el.href="javascript:void(0);";
			el.onclick=function(){
				goShowList();
			}
		}
	};
Behaviour.register(myrules);

function goShowDetails(id,element){
	Element.scrollTo(0,0);
	Effect.BlindUp('show_contents',{duration:1.0, afterFinish:function(){
		Element.update($('section_title').firstChild,Element.getElementsByClassName(element.parentNode.parentNode,'show_name')[0].innerHTML);
		Effect.Appear($('section_title').firstChild,{duration:1.0});
		setLoadingShowDetails();
		loadShowDetails(id);
	}});
	Effect.Fade($('section_title').firstChild,{duration:1.0});
}

function goShowList(){
	Element.scrollTo(0,0);
	Effect.BlindUp('show_contents',{duration:1.0, afterFinish:function(){
		new Ajax.Updater($('section_title').firstChild, 'ajaxdata.php', {
	  		method:'get', parameters: { localized_text: 'title_show' },
	  		onComplete:function(){
				setLoadingShowDetails();
				Effect.Appear($('section_title').firstChild,{duration:1.0});
				Element.update('show_details','');
				loadShowList();
	  		}
		});
	}});
	Effect.Fade($('section_title').firstChild,{duration:1.0});
}

function loadShowList(){
	new Ajax.Updater('show_contents', 'ajaxdata.php', {
	  method:'get', parameters: { show_list: true },
	  onComplete:function(){
	  	var lang=$('swaplang_action').href.replace(/^.*?(lang=.*?)($|&)/,'$1');
	  	$('swaplang_action').href='?section=show&'+lang;
	  	Element.update('show_loader','');
	  	Effect.BlindDown('show_contents',{duration:1.0});
		Behaviour.apply();
	  }
	});
}


function setLoadingShowDetails(){
	new Ajax.Updater('show_loader', 'ajaxdata.php', {
	  method:'get', parameters: { loader: 'show_details' },
	  onComplete:function(){
	  	if ($('show_details').innerHTML!='')
			Element.update('show_loader','');
	  }
	});
}
function loadShowDetails(id){
	new Ajax.Updater('show_contents', 'ajaxdata.php', {
	  method:'get', parameters: { show_details: id },
	  onComplete:function(){
	  	var lang=$('swaplang_action').href.replace(/^.*?(lang=.*?)($|&)/,'$1');
	  	$('swaplang_action').href='?section=show&id='+id+'&'+lang;
	  	Element.update('show_loader','');
	  	Effect.BlindDown('show_contents',{duration:1.0});
		Behaviour.apply();
	  }
	});
}


