$().ready(function() {
    
	 
	$("#sub_menu_content li a").not(".follow").click(function(){  
		 
			 $("#sub_menu_content li a").removeClass("active"); 
			 $("#sub_menu_content li a").removeClass("preactive");
			 
			 $(this).addClass("active");  
			
			 var thisitem = $(this);
			 
			 $("#sub_menu_content li a").animate({paddingTop:'0px'},350);
			 
			 
			 $("#left_side").empty();
			 $("#left_side").append('<div id="loader"></div>');
			 $("#loader").fadeIn();
			 
			 
			 var hash = this.href;
			 
			 var cat = hash.replace(/^.*#/, '');
			 
			 var query = 'category='+cat;
				
				$.post('./ajax/core.php', query, function(data){
						
						$("#loader").fadeOut(200, function(){
							
							$("#left_side").html(data);
						    thisitem.stop().animate({paddingTop:'5px'},350);
							

							  $('a[rel*=fading] img').css('opacity',0.15).fadeTo(2300, 1);
							
							  $("a.title").mouseover(
								function() {
								$(this)
								//Fade to the new color
								.animate({color:"#B7BFCC"}, 350)
								})
								.mouseout(function(){	//Fade back to original color
								$(this).animate({color:"white"},350)
								});
								
								
								$('a[rel*=fading] img').click(function(){
								$(this).fadeTo("slow", 0.45);
								},function(){
								$(this).fadeTo("slow", 1);
								}); 	
								
								$("h1 a").mouseover(
								function() {
								$(this)
								//Fade to the new color
								.animate({color:"#eee5dc"}, 350)
								}).mouseout(function(){	//Fade back to original color
								$(this).animate({color:"white"},350)
								});
	
							
						});
				
				});
			 
			 return false;
		 
		 
	});
	
	  // Set the scroll
	  $("a.anchorLink").click(function () {	
				elementClick = $(this).attr("href");
				var targetOffset = $(elementClick).offset().top;
				if(elementClick == "#myAnchor"){
				$("html:not(:animated)").animate({scrollTop: targetOffset}, 1000);
				return true;
				}
				else
				{
				$("html:not(:animated)").animate({scrollTop: targetOffset}, 1000);
				return false;
				}
		  	
		}); 
		
		$('#main_menu li a')
		.css( {backgroundPosition: "-20px 35px", color:"#dadada"} )
		.mouseover(function(){
			$(this).animate({backgroundPosition:"(0px 91px)", color:"#B7BFCC"}, {duration:500})
		})
		.mouseout(function(){
			$(this).animate({backgroundPosition:"(-20px 35px)", color:"#dadada"}, {duration:200, complete:function(){
				
			}})
		})

		
		$('#main_menu li.active a')
		.css( {backgroundPosition: "0px 0px", color:"#FFFFFF"} )
		.mouseover(function(){
			$(this).stop()
		})
		.mouseout(function(){
			$(this).stop();
		})
		
			$("#sub_footer_menu_content a").mouseover(
		function() {
		$(this)
		//Fade to the new color
		.animate({color:"#eee5dc"}, 350)
		}).mouseout(function(){	//Fade back to original color
		$(this).animate({color:"#a09484"},350)
		});	
	
function showFull(height){
	 
	 
	 $("#preview_button").fadeOut(500, function(){ $("#screen_pic").animate({height: height+"px", overflow: "auto"}, 550, 'easeOutBounce'); })
										  
	 return false;	
}

	
	$(".slider:first").css({display:"block"}); 
	
	$("a.title").mouseover(
	function() {
	$(this)
	//Fade to the new color
	.animate({color:"#B7BFCC"}, 350)
	}).mouseout(function(){	//Fade back to original color
	$(this).animate({color:"white"},350)
	});
	
	$('a[rel*=fading] img').hover(function(){
	$(this).fadeTo("slow", 0.45);
	},function(){
	$(this).fadeTo("slow", 1);
	}); 
		
	
	$('#advertisements img').hover(function() {
		$(this).fadeTo("fast", 0.70);
	}, function() {
		$(this).fadeTo("fast", 1);
	});

	$("#dol9").click(
	function() {
	$('.checked_m').removeClass('checked_m');
	$("#dol9").addClass('checked_m');
	return plan = "month";
	});	
	
	$("#dol60").click(
	function() {
	$('.checked_m').removeClass('checked_m');
	$("#dol60").addClass('checked_m');
	return plan = "year";
	});	


	$(".plans:eq(0)").click(
	function() {
	$(this)
	//Fade to the new color
	.animate({color:"#FBD253"}, 350)
	//Fade back to original color
	.animate({color:"white"},350)
	$('.reg')
	//Fade to the new color
	.animate({color:"#FBD253"}, 350)
	//Fade back to original color
	.animate({color:"white"},350)
	});
	
	


	
	$(".plans:first").click(
	function() {
	$('.checkbox_checked').addClass('checkbox').removeClass('checkbox_checked');
	$(this).children('.checkbox').addClass('checkbox_checked');
	$("#continue").addClass('simple');
	return plan = "reg";
	});	
	
	$(".plans:eq(1)").click(
	function() {
	$('.checkbox_checked').addClass('checkbox').removeClass('checkbox_checked');
	$(this).children('.checkbox').addClass('checkbox_checked');
	$("#continue").removeClass('simple');
	return plan = "exclu";
	});	
	
	$(".plans_last").click(
	function() {
	$('.checkbox_checked').addClass('checkbox').removeClass('checkbox_checked');
	$(this).children('.checkbox').addClass('checkbox_checked');
	$("#continue").removeClass('simple');
	return plan = "dev";
	});	
	
	
	$(".plans:eq(1)").click(
	function() {
	$(this)
	//Fade to the new color
	.animate({color:"#A0C3FC"}, 350)
	//Fade back to original color
	.animate({color:"white"},350)
	$('.sus:first')
	//Fade to the new color
	.animate({color:"#A0C3FC"}, 350)
	//Fade back to original color
	.animate({color:"white"},350)
		
	});	
	


	$(".plans_last").click(
	function() {
	$(this)
	//Fade to the new color
	.animate({color:"#ACD8B1"}, 350)
	//Fade back to original color
	.animate({color:"white"},350)
	$('.developer')
	//Fade to the new color
	.animate({color:"#ACD8B1"}, 350)
	//Fade back to original color
	.animate({color:"white"},350)
	});	
	
	
	$('textarea.expanding').autogrow();



});



function registerForm(){
	
	 
										  

										 $("#login_box").animate({ 
											 top: "53%",
											 height: "285px"
											}, 200 ).animate({ top: "-50%" }, "fast", 'swing', function()
											{
											
											
											 $("#dark").fadeTo(150, 0, function(){
											 $("#login_box").css({display:"none"}); 									
											 $("#dark").css({display:"none"}); 
											 window.location.replace("register.php");
											 });
											 
											 
											}
											);
										  

										  
										
	 return false;	
}






function planslist() {
alert();
};

function submitComment(id){  
	 
	 $("#formShareComment").fadeTo(100,0.5);
	 var pclass = $(".writter:first").parent().attr("class");
     var name = $("input#InputName").val();
     var comment = $("#InputComment").val();
	 var email = $("input#InputEmail").val();
	 var website = $("input#InputWebsite").val();
	 var query = "id="+id+"&name="+name+"&comment="+comment+"&email="+email+"&website="+website+"&pclass="+pclass;
	 $.post("./ajax/callbacks_comment.php",query, function(data){												   
	 $("#commentVide").prepend(data);
	 $(".comments_posted:first").slideDown("fast");
	 $(".comments_posted_imp:first").slideDown("fast");
	  $("#formShareComment").fadeTo(100,1);
	});

}; 

function updateOverBg(){
		var theID = $("#main_menu").find("#first").children("span").attr("id");
		if(theID == "top_left_menu"){ $("#main_menu").find("#first").children("span").addClass('hover'); }
}
function input(obj, id){
			var content = $("#"+id).text();
			$("#"+id).hide();
			$("#"+id).html('<input name="'+id+'" type="text" class="update_input" value="'+content+'"').slideDown("fast");
			$("input[name='"+id+"']").toggleVal();
			$("//#"+id+" ~ .update").remove().empty();
			$("#"+id).after("<span class='update'>Save!</span>");
			$("//#"+id+" ~ .update").click(function() { updateData(obj,id); } );
		    
}
function updateData(obj, id){
			
			$("#"+id).hide();
			$("#"+id).html(content).slideDown("fast");
			$("//#"+id+" ~ .update").remove().empty();
			$("#"+id).after("<span class='update'>Change this ?</span>");
			$("//#"+id+" ~ .update").click(function() { input(obj,id); } );
}

function showEdit(id){
		
		if ($("#"+id).is(":hidden")) {
		$("#"+id).slideDown("fast");
		$("input[name='"+id+"']").toggleVal();
		}
		else
		{
		$("#"+id).slideUp("fast", function(){ $("#"+id).hide(); } );
		}

}


function updateData(obj, id){

		 $("#"+id).fadeTo(100,0.8);
		 var content = $("input[name='"+id+"']").val();
		 // edit_email -> email_adress
		 if(id == "edit_email"){ 
			
		 	 var query = "email=" + content;
			 $.post("./ajax/callbacks_update_email.php",query, function(data){												   
			 $("#vide").html(data);
			 });
		 }
		 if(id == "edit_pass"){ 
			
		 	 var query = "pass=" + content;
			 $.post("./ajax/callbacks_update_pass.php",query, function(data){												   
			 $("#vide").html(data);
			 });
		 }		
		  if(id == "edit_web"){ 
			
		 	 var query = "website=" + content;
			 $.post("./ajax/callbacks_update_website.php",query, function(data){												   
			 $("#vide").html(data);
			 });
		 }		
		 

}

