
var CoverFlow={coverIndex:2,coverSpeed:600,coverEasing:'easeOutBack',coverFull:{width:200,height:300,marginLeft:200*0.5,top:0},coverMedium:{width:150,height:225,marginLeft:150*2,top:30},coverSmall:{width:100,height:150,marginLeft:100*4.4,top:50},coverOff:{width:0,height:0,marginLeft:100*5.4,top:150},applyStyle:function(index,object,direction){if(direction=='lt'){marginLeft='-'+object.marginLeft+'px';}else{marginLeft=parseInt(object.marginLeft-object.width)+'px';}
$('li.coverflowitem:eq('+index+')').css({top:object.top,marginLeft:marginLeft});$('li.coverflowitem:eq('+index+') img').css({width:object.width,height:object.height});},applyAnimation:function(index,object,direction){if(direction=='lt'){marginLeft='-'+object.marginLeft+'px';}else{marginLeft=parseInt(object.marginLeft-object.width)+'px';}
$('li.coverflowitem:eq('+index+')').animate({top:object.top,marginLeft:marginLeft},CoverFlow.coverSpeed,CoverFlow.coverEasing);$('li.coverflowitem:eq('+index+') img').animate({width:object.width,height:object.height},CoverFlow.coverSpeed,CoverFlow.coverEasing);},init:function(){$('li.coverflowitem:gt(4)').css({top:CoverFlow.coverOff.top,marginLeft:CoverFlow.coverOff.marginLeft});$('li.coverflowitem:gt(4) img').css({width:CoverFlow.coverOff.width,height:CoverFlow.coverOff.height});index=CoverFlow.coverIndex-2;CoverFlow.applyStyle(index,CoverFlow.coverSmall,'lt');index++;CoverFlow.applyStyle(index,CoverFlow.coverMedium,'lt');index++;CoverFlow.applyStyle(index,CoverFlow.coverFull,'lt');index++;CoverFlow.applyStyle(index,CoverFlow.coverMedium,'gt');index++;CoverFlow.applyStyle(index,CoverFlow.coverSmall,'gt');},goLeft:function(){if(CoverFlow.coverIndex<($('li.coverflowitem').length-1)){index=CoverFlow.coverIndex-2;CoverFlow.applyAnimation(index,CoverFlow.coverOff,'lt');index++;CoverFlow.applyAnimation(index,CoverFlow.coverSmall,'lt');index++;CoverFlow.applyAnimation(index,CoverFlow.coverMedium,'lt');index++;CoverFlow.applyAnimation(index,CoverFlow.coverFull,'lt');index++;CoverFlow.applyAnimation(index,CoverFlow.coverMedium,'gt');index++;CoverFlow.applyAnimation(index,CoverFlow.coverSmall,'gt');CoverFlow.coverIndex++;}},goRight:function(){if(CoverFlow.coverIndex>0){index=parseInt(CoverFlow.coverIndex+2);CoverFlow.applyAnimation(index,CoverFlow.coverOff,'gt');index--;CoverFlow.applyAnimation(index,CoverFlow.coverSmall,'gt');index--;CoverFlow.applyAnimation(index,CoverFlow.coverMedium,'gt');index--;CoverFlow.applyAnimation(index,CoverFlow.coverFull,'lt');index--;CoverFlow.applyAnimation(index,CoverFlow.coverMedium,'lt');index--;CoverFlow.applyAnimation(index,CoverFlow.coverSmall,'lt');CoverFlow.coverIndex--;}}};$(document).ready(function(){$('#container').addClass('container_12');$('#header').addClass('grid_12').after($(document.createElement('div')).addClass('clear'));$('#shortnav').addClass('grid_12');$('#spotlight').addClass('grid_7');$('#presents').addClass('grid_5').after($(document.createElement('div')).addClass('clear'));$('#portfolio').addClass('grid_12').after($(document.createElement('div')).addClass('clear'));$('#footer').addClass('grid_12').after($(document.createElement('div')).addClass('clear'));$('#container').prepend($('<div></div>').addClass('glow-lft')).prepend($('<div></div>').addClass('glow-rgt'));$('#shortnav').wrapInner($('<div></div>').addClass('shortnav-block')).prepend($('<div></div>').addClass('shortnav-lft')).prepend($('<div></div>').addClass('shortnav-rgt'));$('.button').wrapInner($('<div></div>').addClass('button-block')).prepend($('<div></div>').addClass('button-lft')).prepend($('<div></div>').addClass('button-rgt'));$('#nav-1 > li, #nav-2 > li').addClass('button-wrapper');$('.button-wrapper ul').append('<li>&nbsp;</li>');$('#nav-2').insertBefore('#nav-1');$('#nav-1, #nav-2').superfish();$('#spotlight dl').mouseenter(function(){var top=290-($('#spotlight dd p').height()+45)+'px';$('#spotlight dd').animate({top:top,},600,'easeOutBounce');}).mouseleave(function(){$('#spotlight dd').animate({top:'255px'},400);});$('#portfolio > ul > li').addClass('coverflowitem');CoverFlow.init();$('#portfolio h2').after($(document.createElement('div')).append($(document.createElement('span')).attr('id','cmd-left').text('left').bind('click',CoverFlow.goRight)).append($(document.createElement('span')).attr('id','cmd-right').text('right').bind('click',CoverFlow.goLeft)));$('#portfolio dt').each(function(){$(this).qtip({content:{title:$(this).next().find('h3').text(),text:$(this).next().find('p').text()},show:{delay:300,},hide:'mouseout',position:{corner:{target:'topMiddle',tooltip:'bottomMiddle'},adjust:{y:5}},style:{background:'transparent url(/madsgraphics.com/themes/fantasy/img/qtip-bg.png)',color:'#ffffff',fontSize:'10px',tip:'bottomMiddle',border:{radius:8,color:'#111111'},title:{background:'transparent url(/madsgraphics.com/themes/fantasy/img/qtip-title-bg.png)',color:'#ffffff'}}});});$('.preview dt').css('cursor','pointer').click(function() {$(this).next().find('ul').lightbox();});});