$(document).ready(function(){
$("#content2-text").css('left','-430');

state = 0;

	$("#createChannelLink").click(function(){	
		
		$("#channel-info").fadeOut();
		
		$('body').scrollTo($('#content1'),800);
		
		$("#channel-teaser-container").fadeOut(function(){
		
			$("#content1").removeClass('box');
			$("#content1").css('background','transparent');
		
			$("#content1").css({height:'290px'});
			$("#content1").animate({height: '1455px'},500,function(){
			
				$("#channel-form-container").fadeIn('slow');
				
			});
			
		});
		
		if(state==2)
		{
			$("#content2-left").animate({width:75},function(){ 
				$("#content2-right").css('z-index','10');											
			});

			$("#content2-left").css('cursor','pointer');
			$("#content2-right").css('cursor','default');
			
			$("#content2-right").hide();
			$("#content2-right").show();

			$("#advertise-tab").fadeIn();
			$("#whitelabel-tab").fadeOut();
		}
		
		
	});


	$("#content2-left").click(function(){
		
		if(state == 0)
		{
			$('body').scrollTo($('#content2-container'),800);
			
			$("#content2-right").css('z-index','0');
			
			$("#content2-text").hide();
			$("#content2-right").animate({height:'500px', width:'905px', left:-430}, function(){
				$("#content2-text").fadeIn();
				$("#whitelabel-title").css('left','5px');
			});
			
			$("#content2-left").css('z-index','10');
			$("#content2-left").animate({height:'500px', width:'900px'});
			$("#content2-container").animate({height:'500px'});	
			$("#content2-left").css('cursor','default');
			$("#content2-right").css('cursor','pointer');
			
			$("#content2-text").css('left','-430');
			
			$("#content2-text").css('left','-400');
			$("#content2-text").animate({left:0});
			
			$("#whitelabel-tab").fadeIn();
			
			state  = 1;
		}
		
		if(state == 2)
		{
		
			$("#content2-container").animate({height:'500px'});	
			$("#content2-left").animate({height:'500px'});
			$("#content2-right").animate({height:'500px'});
			
			
			$("#content2-right").css('z-index','0');
			
			$("#content2-left").css('width','100');
			$("#content2-left").css('z-index','10');
			$("#content2-left").animate({width:'900px'});

			$("#content2-left").css('cursor','default');
			$("#content2-right").css('cursor','pointer');						
			
			$("#content2-right").hide();
			$("#content2-right").show();
			
			$("#advertise-tab").fadeOut();
			$("#whitelabel-tab").fadeIn();
			
			state  = 1;
		}
		
		
	});

	$("#content2-right").click(function(){
		
		if(state == 0)
		{
			$('body').scrollTo($('#content2-container'),800);
			
			$("#content2-right").css('z-index','10');
			$("#content2-text").hide();
			$("#content2-right").animate({height:'501px', width:'905px', left:-430}, function(){
				$("#content2-text").fadeIn();
			});
			
			$("#content2-left").css('z-index','0');
			$("#content2-left").animate({height:'501px', width:'65px'});
			$("#content2-container").animate({height:'501px'});	
			$("#content2-left").css('cursor','pointer');
			$("#content2-right").css('cursor','default');
			
			$("#advertise-tab").fadeIn();

			$("#content2-text").css('left','-400');
			$("#content2-text").animate({left:0},0);

			$("#whitelabel-title").css('left','5px');

			
			$("#content2-right").hide();
			$("#content2-right").show();
			
			state  = 2;
		}
	
		if(state == 1)
		{	
			
			$("#content2-left").animate({height:'501px'});
			
			$("#content2-left").animate({width:75},function(){ 
				$("#content2-right").css('z-index','10');											
			});
			
			$("#content2-container").animate({height:'501px'});	
			
			$("#content2-right").animate({height:'501px'});

			$("#content2-left").css('cursor','pointer');
			$("#content2-right").css('cursor','default');
			
			$("#content2-right").hide();
			$("#content2-right").show();

			$("#advertise-tab").fadeIn();
			$("#whitelabel-tab").fadeOut();
			
			state  = 2;
		}
	
	});

});
