//var $j = jQuery.noConflict();
this.toggleFun = function(){
	$(".toggle-container").hide();
   	$(".trigger").click(function(e){
		e.preventDefault();
		if ($(".toggle-container").is(":hidden")) {
			$(".toggle-container").slideDown("slow");
		$(this).addClass("active");
			 $.cookie('showTop', 'collapsed');
		return false;
		  } else {
			$(".toggle-container").slideUp("slow");
		$(this).removeClass("active");
			$.cookie('showTop', 'expanded');
		return false;
      }
   });

// COOKIES
    // Header State
    var showTop = $.cookie('showTop');

    // Set the user's selection for the Header State
    if (showTop == 'collapsed') {
	$(".toggle-container").show();
	$(".trigger").addClass("active");
	
    };

};
this.imageHover = function(){
/* CONFIG */
		
var $project_item = jQuery('.project-item');
$project_item.mouseover(function(e) {

			this_el = jQuery(this);
			this_el.children().children('img.preview-thumb').stop(true).fadeTo("slow", 0.5);			
			move_thumb(this_el,e);
			this_el.parent().css('z-index','15');
			this_el.css('z-index','15').children("div.project-popup").css({'top': y + -40,'left': x + 40, visibility:"visible"}).fadeIn(300);
		}).mousemove(function(e) {
			move_thumb(this_el,e);	
			this_el.children("div.project-popup").css({'top': y + -40, 'left': x + 40});
		}).mouseout(function() {
			this_el.parent().css('z-index','1');
			this_el.css('z-index','1').children().children("img.preview-thumb").fadeTo("slow", 1);
			this_el.children("div.project-popup").css({display:"none", visibility:"hidden"});
		});
		
		function move_thumb(this_element,event_name){
			x = event_name.pageX - this_element.offset().left;
			y = event_name.pageY - this_element.offset().top;
		};
};

$(document).ready(function() {
	toggleFun();
	imageHover();
	$("a.fbopen").fancybox({ 
	'hideOnContentClick': false
	});  
	
	$("a.clientlogin").fancybox({ 
	
	});  	
	
	//	("#login_form").bind("submit", function() {
	//	$.fancybox.showActivity();
		
	//	var data = $(this).serializeArray();
		
	//	$.ajax({
	//	type : "POST",
	//	cache : false,
	//	url : "/members-area?=login",
	//	data : data,
	//	success: function(data) {
	//	$.fancybox(data);
	//	}
	//	});
	
	//return false;
	///});
	
	if($.cookie('TEXT_SIZE')) {
		$('#wrap').addClass($.cookie('TEXT_SIZE'));
	}
	$('.resizer a').click(function() {
		var textSize = $(this).attr('class');
		$('#wrap').removeClass('normal large').addClass(textSize);
		$.cookie('TEXT_SIZE',textSize, { path: '/', expires: 10000 });
		return false;
	});
	
	$("#blogtabs").idTabs(function(id,list,set){ 
    $("a",set).removeClass("selected") 
    .filter("[@href='"+id+"']",set).addClass("selected"); 
    for(i in list) 
      $(list[i]).hide(); 
    $(id).fadeIn(); 
    return false; 
  }); 
//$("div#about, div#benefits").hide();
//$(".js #featured-slider, .js div#recent-projects, .js div#from-blog div.content").show(); 
});

