var $jq=jQuery.noConflict();

$jq(document).ready(function()
{
	$jq(".panel>img").hide().show("slide", {}, 'slow');
	if($jq(".logo").length)
	 $jq(".logo").mouseover(showPage).mouseout(hidePage);
	$jq("#slideshow_content").cycle({fx: 'fade', timeout: 0});
	$jq(".video, .photo").fancybox();
	//$jq(".photo, .photo").click(flipPhoto);	
	$jq(".video").click(function()
	{
		$jq.fancybox({'padding': 0, 'autoscale': false, 'title': this.title, 'width': 640, 'height': 385, 'href': this.href, 'type': 'swf'});
		return false;
	});
	
	$jq(".video, .photo").draggable({containment: "#desk", cursor: 'move',distance: 10, stack: ".photo", 
		start: function(event, ui) 
		{
            ui.helper.bind("click.prevent",function(event) { event.preventDefault(); });
        },
		stop: function(event, ui) 
		{
            setTimeout(function(){ui.helper.unbind("click.prevent");}, 300);
		}
	});

	$jq("#left_picture_panel").mouseover(function()
		{
			$jq("#right_content_panel").show();
		})
		.mouseout(function()
		{
			$jq("#right_content_panel").hide();
		});
		
	$jq("#right_picture_panel").mouseover(function()
		{
			$jq("#left_content_panel").show();
		})
		.mouseout(function()
		{
			$jq("#left_content_panel").hide();
		});
				
	//$jq(".photo").fancyZoom();
	//Shadowbox.init();
	//$jq(".photo").click(expandPhoto);
	//$jq(".photo").lightBox({fixedNavigation: true});
	//$jq(".photo").mousedown(grabPhoto);
	//$jq("#desk").mouseup(releasePhoto);
	//$jq("#desk").mousemove(movePhoto);
	$jq('#booklet').booklet({
		pageNumbers: false,
		manual: false,
		next: '#booklet-next',                
        prev: '#booklet-prev',
		arrows: true,
		hovers: false,
		overlays: false,
		before: fadeTitle,
        after: turnPage
	});
	$jq(".rollover").mouseover(function() 
	{
		$jq(this).fadeTo("slow",1);
	}).mouseout(function()
	{
		$jq(this).fadeTo("slow",0);
	});
	
	$jq("#tweet_carousel").jCarouselLite({visible: 2, btnPrev: "#tweet_prev", btnNext: "#tweet_next", circular: false, auto: 10000, speed: 1000});
	$jq("#tweet_box_content").jCarouselLite({visible: 1, circular: true, auto: 10000, speed: 1000});
});

function set_transform()
{
	var selectedEffect = $jq( "#transform" ).val();
			
	// most effect types need no options passed by default
	var options = {};
	// some effects have required parameters
	if(selectedEffect=="scale")
	 options={percent: 100};
	else
 	 if(selectedEffect=="drop")
	  options={direction: "up"};
	 else
 	  if(selectedEffect=="explode")
	   options={pieces: 16};

	// run the effect
	$jq(".panel>img").hide().show(selectedEffect, options, 'slow');
}

function FloatObject(jqObj)
{
	this.jqObj=jqObj;
	
	var offset=jqObj.parent().offset();
	//jqObj.css({'position':'absolute' , 'top':offset.top ,'left':offset.left});
	//jqObj.css({visibility: hidden}).clone().appendTo("#container").css({visibility:visible,position:absolute, top:offset.top ,left:offset.left}).animate({opacity:0, left:0, top:0, width: 900, height: 760},'slow');
	//jqObj.clone().appendTo("#container").css({position:absolute, top:offset.top, left:offset.left}).animate({'opacity':0, left:0, top:0, width: 900, height: 760},'slow');
	jqObj.detach().css({'position':'absolute', 'top':offset.top, 'left':offset.left}).appendTo("body").animate({'opacity':0, left:0, top:0, width: $jq(window).width(), height: $jq(window).height()},'slow');
}

function explodePanel()
{
	var offset=$jq(this).parent().offset();
	$jq(this).clone().css({'position':'absolute', 'top':offset.top, 'left':offset.left}).appendTo("body").animate({'opacity':0, left:0, top:0, width: $jq(window).width(), height: $jq(window).height()},'slow', function(){$jq(this).remove();});
}

function fadeTitle()
{
	$jq("#title").fadeTo('slow',0);
}

function turnPage(o)
{
	$jq("#title").text(o.titles[o.curr]);
	$jq("#title").fadeTo('slow',1);
}

/*
function set_transform()
{
	$jq(".panel").cycle({
		fx: fx(),
		delay: -4000,
		timeout: 1,
		autostop: 1
	});
}

function fx()
{
	current_fx=parseInt($jq('#transform').val());
	
	switch(current_fx)
	{
		case 1:
			return 'fade';
			
		case 2:
			return 'scrollUp';
			
		case 3:
			return 'scrollLeft';
			
		case 4:
			return 'zoom';
			
		case 5:
			return 'curtainX';
			
		case 6:
			return 'curtainY';
			
		case 7:
			return 'turnDown';
			
		case 8:
			return 'zoom';
	}
	return 'fade';
}
*/
