

// remap jQuery to $
(function($){})(window.jQuery);


//init for navigation
	//var menu=new menu.dd("menu");
	//menu.init("menu","menuhover");
	

/* trigger when page is ready */
$(document).ready(function (){

	
	// for scroll pane
	$('#scrollpane').tinyscrollbar();	
	
	//Retina zoomView
	$("#cfeed .webpage").hover(function() {
			var left	= 0,
				top		= 0,
				sizes	= { retina: { width:320, height:320 },
						webpage:{ width:329, height:278 } },
				webpage	= $(this).find('.preview'),
				offset	= { left: webpage.offset().left, top: webpage.offset().top },
				retina	= $(this).find('.zoomView');
		
			if(navigator.userAgent.indexOf('Chrome')!=-1)
			{
				/*	Applying a special chrome curosor,
					as it fails to render completely blank curosrs. */
		
				retina.addClass('chrome');
			}
		
			webpage.mousemove(function(e){
		
				left = (e.pageX-offset.left);
				top = (e.pageY-offset.top);
		
				if(retina.is(':not(:animated):hidden')){
					/* Fixes a bug where the retina div is not shown */
					webpage.trigger('mouseenter');
				}
		
				if(left<0 || top<0 || left > sizes.webpage.width ||
					top > sizes.webpage.height)
				{
					/*	If we are out of the bondaries of the
						webpage screenshot, hide the retina div */
		
					if(!retina.is(':animated')){
						webpage.trigger('mouseleave');
					}
					return false;
				}
		
				/*	Moving the retina div with the mouse
					(and scrolling the background) */
		
				retina.css({
					left				: left - sizes.retina.width/2,
					top					: top - sizes.retina.height/2,
					backgroundPosition	: '-'+(2.0*left)+'px -'+(2.0*top)+'px'
				});
		
			}).mouseleave(function(){
				retina.fadeOut('fast');
			}).mouseenter(function(){
				retina.fadeIn();
			});
		});	
});


/* optional triggers

$(window).load(function() {
	
});

$(window).resize(function() {
	
});

*/


