// JavaScript Document

$(document).ready(function(){
	
	$('.an-exhibitor a').click(function(){
		var href = $(this).attr('href');
		$.get("/set_sess.php", { box: "1" },function(data){ window.location = href; }); return false;
	});
	$('.an-organiser a').click(function(){
		var href = $(this).attr('href');
		$.get("/set_sess.php", { box: "2" },function(data){ window.location = href; }); return false;
	});
	
	
	$('.exhibitor a').click(function(){
		$('.organiser').removeClass('on');
		var rel = $(this).attr('rel');
		if(rel=='open'){
			$('.an-exhibitor').animate({height:0},function(){
				$('.organiser .cover').fadeOut();
				$('.an-exhibitor').hide();
			});
			$(this).attr('rel','');
			$('.exhibitor').removeClass('on');
		}else{
			$('.organiser .cover').fadeIn();
			$('.an-organiser').animate({height:0},function(){
				$('.exhibitor .cover').fadeOut();
				$('.an-organiser').hide();
				$('.an-exhibitor').show();
				$('.an-exhibitor').animate({height:272});
			});
			$(this).attr('rel','open');
			$('.organiser a').attr('rel','');
			$('.exhibitor').addClass('on');
		}
		return false;
	});
	
	$('.organiser a').click(function(){
		$('.exhibitor').removeClass('on');
		var rel = $(this).attr('rel');
		if(rel=='open'){
			$('.an-organiser').animate({height:0},function(){
				$('.exhibitor .cover').fadeOut();
				$('.an-organiser').hide();
			});
			$(this).attr('rel','');
			$('.organiser').removeClass('on');
		}else{
			$('.exhibitor .cover').fadeIn();
			$('.an-exhibitor').animate({height:0},function(){
				$('.organiser .cover').fadeOut();
				$('.an-exhibitor').hide();
				$('.an-organiser').show();
				$('.an-organiser').animate({height:337});
			});
			$(this).attr('rel','open');
			$('.exhibitor a').attr('rel','');
			$('.organiser').addClass('on');
		}
		return false;
	});
	
	$('#are-you-an div').mouseover(function(){
		$(this).children('a').text('click here').css('backgroundPosition','192px 11px');
	});
	$('#are-you-an div').mouseout(function(){
		$(this).children('a').text('yes i am').css('backgroundPosition','170px 11px');
	});
	
	$('#home-gallery img').click(function(){
		var src = $(this).attr('rel');
		$('#home-gallery #show-image').html('<img src="'+ src +'" />').stop(true, true).fadeIn();
		return false;
	});
	
	$('#home-gallery #show-image').click(function(){
		$('#home-gallery #show-image img').stop(true, true).fadeOut();
		return false;
	});
	
});
