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

};
this.imageHover = function(){
/* CONFIG */
		
var $project_item = jQuery('.project-item');
$project_item.mouseenter(function(e) {
			this_el = jQuery(this);
			this_el.children().children('img.preview-thumb').stop().fadeTo("fast", 0.5);			
			move_thumb(this_el,e);
			this_el.css('z-index','15').children("div.project-popup").css({'top': y + 10,'left': x + 20,'display':'block'});
		}).mousemove(function(e) {
			move_thumb(this_el,e);	
			this_el.children("div.project-popup").css({'top': y + 10,'left': x + 20});
		}).mouseleave(function() {
			this_el.css('z-index','1').children().children("img.preview-thumb").fadeTo("fast", 1);
			this_el.children("div.project-popup").animate({"opacity": "hide"}, 200);
		});
		
		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() {
	$('html').removeClass('js');
	toggleFun();
	imageHover();
	$("a.fbopen").fancybox({ 
	'hideOnContentClick': false
	});  
	
	$("a.clientlogin").fancybox({ 
	'hideOnContentClick': false,
	frameWidth:250,
	frameHeight:200
	});  	
	
	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;
	});
	$('#acc').hoverAccordion({ activateitem: '1', speed: 'fast'  });
	$('#acc').children('li:first').addClass('firstitem');
	$('#acc').children('li:last').addClass('lastitem'); 
	$('.slide').before('<div id="pagination">').cycle({ fx: 'fade',   speed:  'fast', pager:  '#pagination', next:   '.next',  prev:   '.prev', speed:    600,  timeout:  10000,pause:  1   });

});

