////////ROUNDABOUT PLUGIN

/**
 * jQuery Roundabout - v1.1
 * http://fredhq.com/projects/roundabout/
 *
 * Moves list-items of enabled ordered and unordered lists long
 * a chosen path. Includes the default "lazySusan" path, that
 * moves items long a spinning turntable.
 *
 * Terms of Use // jQuery Roundabout
 * 
 * Open source under the BSD license
 *
 * Copyright (c) 2010, Fred LeBlanc
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without 
 * modification, are permitted provided that the following conditions are met:
 * 
 *   - Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *   - Redistributions in binary form must reproduce the above 
 *     copyright notice, this list of conditions and the following 
 *     disclaimer in the documentation and/or other materials provided 
 *     with the distribution.
 *   - Neither the name of the author nor the names of its contributors 
 *     may be used to endorse or promote products derived from this 
 *     software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 * POSSIBILITY OF SUCH DAMAGE.
 */

jQuery.extend({roundabout_shape:{def:'lazySusan',lazySusan:function(r,a,t){return{x:Math.sin(r+a),y:(Math.sin(r+3*Math.PI/2+a)/8)*t,z:(Math.cos(r+a)+1)/2,scale:(Math.sin(r+Math.PI/2+a)/2)+0.5}}}});jQuery.fn.roundabout=function(){var options=(typeof arguments[0]!='object')?{}:arguments[0];options={bearing:(typeof options.bearing=='undefined')?0.0:jQuery.roundabout_toFloat(options.bearing%360.0),tilt:(typeof options.tilt=='undefined')?0.0:jQuery.roundabout_toFloat(options.tilt),minZ:(typeof options.minZ=='undefined')?100:parseInt(options.minZ,10),maxZ:(typeof options.maxZ=='undefined')?400:parseInt(options.maxZ,10),minOpacity:(typeof options.minOpacity=='undefined')?0.40:jQuery.roundabout_toFloat(options.minOpacity),maxOpacity:(typeof options.maxOpacity=='undefined')?1.00:jQuery.roundabout_toFloat(options.maxOpacity),minScale:(typeof options.minScale=='undefined')?0.40:jQuery.roundabout_toFloat(options.minScale),maxScale:(typeof options.maxScale=='undefined')?1.00:jQuery.roundabout_toFloat(options.maxScale),duration:(typeof options.duration=='undefined')?600:parseInt(options.duration,10),btnNext:options.btnNext||null,btnPrev:options.btnPrev||null,easing:options.easing||'swing',clickToFocus:(options.clickToFocus!==false),focusBearing:(typeof options.focusBearing=='undefined')?0.0:jQuery.roundabout_toFloat(options.focusBearing%360.0),shape:options.shape||'lazySusan',debug:options.debug||false,childSelector:options.childSelector||'li',startingChild:(typeof options.startingChild=='undefined')?null:parseInt(options.startingChild,10),reflect:(typeof options.reflect=='undefined'||options.reflect===false)?false:true};this.each(function(i){var ref=jQuery(this);var period=jQuery.roundabout_toFloat(360.0/ref.children(options.childSelector).length);var startingBearing=(options.startingChild===null)?options.bearing:options.startingChild*period;ref.addClass('roundabout-holder').css('padding',0).css('position','relative').css('z-index',options.minZ);ref.data('roundabout',{'bearing':startingBearing,'tilt':options.tilt,'minZ':options.minZ,'maxZ':options.maxZ,'minOpacity':options.minOpacity,'maxOpacity':options.maxOpacity,'minScale':options.minScale,'maxScale':options.maxScale,'duration':options.duration,'easing':options.easing,'clickToFocus':options.clickToFocus,'focusBearing':options.focusBearing,'animating':0,'childInFocus':-1,'shape':options.shape,'period':period,'debug':options.debug,'childSelector':options.childSelector,'reflect':options.reflect});if(options.clickToFocus===true){ref.children(options.childSelector).each(function(i){jQuery(this).click(function(e){var degrees=(options.reflect===true)?360.0-(period*i):period*i;degrees=jQuery.roundabout_toFloat(degrees);if(!jQuery.roundabout_isInFocus(ref,degrees)){e.preventDefault();if(ref.data('roundabout').animating===0){ref.roundabout_animateAngleToFocus(degrees)}return false}})})}if(options.btnNext){jQuery(options.btnNext).bind('click.roundabout',function(e){e.preventDefault();if(ref.data('roundabout').animating===0){ref.roundabout_animateToNextChild()}return false})}if(options.btnPrev){jQuery(options.btnPrev).bind('click.roundabout',function(e){e.preventDefault();if(ref.data('roundabout').animating===0){ref.roundabout_animateToPreviousChild()}return false})}});this.roundabout_startChildren();if(typeof arguments[1]==='function'){var callback=arguments[1],ref=this;setTimeout(function(){callback(ref)},0)}return this};jQuery.fn.roundabout_startChildren=function(){this.each(function(i){var ref=jQuery(this);var data=ref.data('roundabout');var children=ref.children(data.childSelector);children.each(function(i){var degrees=(data.reflect===true)?360.0-(data.period*i):data.period*i;jQuery(this).addClass('roundabout-moveable-item').css('position','absolute');jQuery(this).data('roundabout',{'startWidth':jQuery(this).width(),'startHeight':jQuery(this).height(),'startFontSize':parseInt(jQuery(this).css('font-size'),10),'degrees':degrees})});ref.roundabout_updateChildPositions()});return this};jQuery.fn.roundabout_setTilt=function(newTilt){this.each(function(i){jQuery(this).data('roundabout').tilt=newTilt;jQuery(this).roundabout_updateChildPositions()});if(typeof arguments[1]==='function'){var callback=arguments[1],ref=this;setTimeout(function(){callback(ref)},0)}return this};jQuery.fn.roundabout_setBearing=function(newBearing){this.each(function(i){jQuery(this).data('roundabout').bearing=jQuery.roundabout_toFloat(newBearing%360,2);jQuery(this).roundabout_updateChildPositions()});if(typeof arguments[1]==='function'){var callback=arguments[1],ref=this;setTimeout(function(){callback(ref)},0)}return this};jQuery.fn.roundabout_adjustBearing=function(delta){delta=jQuery.roundabout_toFloat(delta);if(delta!==0){this.each(function(i){jQuery(this).data('roundabout').bearing=jQuery.roundabout_getBearing(jQuery(this))+delta;jQuery(this).roundabout_updateChildPositions()})}if(typeof arguments[1]==='function'){var callback=arguments[1],ref=this;setTimeout(function(){callback(ref)},0)}return this};jQuery.fn.roundabout_adjustTilt=function(delta){delta=jQuery.roundabout_toFloat(delta);if(delta!==0){this.each(function(i){jQuery(this).data('roundabout').tilt=jQuery.roundabout_toFloat(jQuery(this).roundabout_get('tilt')+delta);jQuery(this).roundabout_updateChildPositions()})}if(typeof arguments[1]==='function'){var callback=arguments[1],ref=this;setTimeout(function(){callback(ref)},0)}return this};jQuery.fn.roundabout_animateToBearing=function(bearing){bearing=jQuery.roundabout_toFloat(bearing);var currentTime=new Date();var duration=(typeof arguments[1]=='undefined')?null:arguments[1];var easingType=(typeof arguments[2]=='undefined')?null:arguments[2];var passedData=(typeof arguments[3]!=='object')?null:arguments[3];this.each(function(i){var ref=jQuery(this),data=ref.data('roundabout'),timer,easingFn,newBearing;var thisDuration=(duration===null)?data.duration:duration;var thisEasingType=(easingType!==null)?easingType:data.easing||'swing';if(passedData===null){passedData={timerStart:currentTime,start:jQuery.roundabout_getBearing(ref),totalTime:thisDuration}}timer=currentTime-passedData.timerStart;if(timer<thisDuration){data.animating=1;if(typeof jQuery.easing.def=='string'){easingFn=jQuery.easing[thisEasingType]||jQuery.easing[jQuery.easing.def];newBearing=easingFn(null,timer,passedData.start,bearing-passedData.start,passedData.totalTime)}else{newBearing=jQuery.easing[thisEasingType]((timer/passedData.totalTime),timer,passedData.start,bearing-passedData.start,passedData.totalTime)}ref.roundabout_setBearing(newBearing,function(){ref.roundabout_animateToBearing(bearing,thisDuration,thisEasingType,passedData)})}else{bearing=(bearing<0)?bearing+360:bearing%360;data.animating=0;ref.roundabout_setBearing(bearing)}});return this};jQuery.fn.roundabout_animateToDelta=function(delta){var duration=arguments[1],easing=arguments[2];this.each(function(i){delta=jQuery.roundabout_getBearing(jQuery(this))+jQuery.roundabout_toFloat(delta);jQuery(this).roundabout_animateToBearing(delta,duration,easing)});return this};jQuery.fn.roundabout_animateToChild=function(childPos){var duration=arguments[1],easing=arguments[2];this.each(function(i){var ref=jQuery(this),data=ref.data('roundabout');if(data.childInFocus!==childPos&&data.animating===0){var child=jQuery(ref.children(data.childSelector)[childPos]);ref.roundabout_animateAngleToFocus(child.data('roundabout').degrees,duration,easing)}});return this};jQuery.fn.roundabout_animateToNearbyChild=function(passedArgs,which){var duration=passedArgs[0],easing=passedArgs[1];this.each(function(i){var data=jQuery(this).data('roundabout');var bearing=jQuery.roundabout_toFloat(360.0-jQuery.roundabout_getBearing(jQuery(this)));var period=data.period,j=0,range;var reflect=data.reflect;var length=jQuery(this).children(data.childSelector).length;bearing=(reflect===true)?bearing%360.0:bearing;if(data.animating===0){if((reflect===false&&which==='next')||(reflect===true&&which!=='next')){bearing=(bearing===0)?360:bearing;while(true&&j<length){range={lower:jQuery.roundabout_toFloat(period*j),upper:jQuery.roundabout_toFloat(period*(j+1))};range.upper=(j==length-1)?360.0:range.upper;if(bearing<=range.upper&&bearing>range.lower){jQuery(this).roundabout_animateToDelta(bearing-range.lower,duration,easing);break}j++}}else{while(true){range={lower:jQuery.roundabout_toFloat(period*j),upper:jQuery.roundabout_toFloat(period*(j+1))};range.upper=(j==length-1)?360.0:range.upper;if(bearing>=range.lower&&bearing<range.upper){jQuery(this).roundabout_animateToDelta(bearing-range.upper,duration,easing);break}j++}}}});return this};jQuery.fn.roundabout_animateToNextChild=function(){return this.roundabout_animateToNearbyChild(arguments,'next')};jQuery.fn.roundabout_animateToPreviousChild=function(){return this.roundabout_animateToNearbyChild(arguments,'previous')};jQuery.fn.roundabout_animateAngleToFocus=function(target){var duration=arguments[1],easing=arguments[2];this.each(function(i){var delta=jQuery.roundabout_getBearing(jQuery(this))-target;delta=(Math.abs(360.0-delta)<Math.abs(0.0-delta))?360.0-delta:0.0-delta;delta=(delta>180)?-(360.0-delta):delta;if(delta!==0){jQuery(this).roundabout_animateToDelta(delta,duration,easing)}});return this};jQuery.fn.roundabout_updateChildPositions=function(){this.each(function(i){var ref=jQuery(this),data=ref.data('roundabout');var inFocus=-1;var info={bearing:jQuery.roundabout_getBearing(ref),tilt:data.tilt,stage:{width:Math.floor(ref.width()*0.9),height:Math.floor(ref.height()*0.9)},animating:data.animating,inFocus:data.childInFocus,focusBearingRad:jQuery.roundabout_degToRad(data.focusBearing),shape:jQuery.roundabout_shape[data.shape]||jQuery.roundabout_shape[jQuery.roundabout_shape.def]};info.midStage={width:info.stage.width/2,height:info.stage.height/2};info.nudge={width:info.midStage.width+info.stage.width*0.05,height:info.midStage.height+info.stage.height*0.05};info.zValues={min:data.minZ,max:data.maxZ,diff:data.maxZ-data.minZ};info.opacity={min:data.minOpacity,max:data.maxOpacity,diff:data.maxOpacity-data.minOpacity};info.scale={min:data.minScale,max:data.maxScale,diff:data.maxScale-data.minScale};ref.children(data.childSelector).each(function(i){if(jQuery.roundabout_updateChildPosition(jQuery(this),ref,info,i)&&info.animating===0){inFocus=i;jQuery(this).addClass('roundabout-in-focus')}else{jQuery(this).removeClass('roundabout-in-focus')}});if(inFocus!==info.inFocus){jQuery.roundabout_triggerEvent(ref,info.inFocus,'blur');if(inFocus!==-1){jQuery.roundabout_triggerEvent(ref,inFocus,'focus')}data.childInFocus=inFocus}});return this};jQuery.roundabout_getBearing=function(el){return jQuery.roundabout_toFloat(el.data('roundabout').bearing)%360};jQuery.roundabout_degToRad=function(degrees){return(degrees%360.0)*Math.PI/180.0};jQuery.roundabout_isInFocus=function(el,target){return(jQuery.roundabout_getBearing(el)%360===(target%360))};jQuery.roundabout_triggerEvent=function(el,child,eventType){return(child<0)?this:jQuery(el.children(el.data('roundabout').childSelector)[child]).trigger(eventType)};jQuery.roundabout_toFloat=function(number){number=Math.round(parseFloat(number)*1000)/1000;return parseFloat(number.toFixed(2))};jQuery.roundabout_updateChildPosition=function(child,container,info,childPos){var ref=jQuery(child),data=ref.data('roundabout'),out=[];var rad=jQuery.roundabout_degToRad((360.0-ref.data('roundabout').degrees)+info.bearing);while(rad<0){rad=rad+Math.PI*2}while(rad>Math.PI*2){rad=rad-Math.PI*2}var factors=info.shape(rad,info.focusBearingRad,info.tilt);factors.scale=(factors.scale>1)?1:factors.scale;factors.adjustedScale=(info.scale.min+(info.scale.diff*factors.scale)).toFixed(4);factors.width=(factors.adjustedScale*data.startWidth).toFixed(4);factors.height=(factors.adjustedScale*data.startHeight).toFixed(4);ref.css('left',((factors.x*info.midStage.width+info.nudge.width)-factors.width/2.0).toFixed(1)+'px').css('top',((factors.y*info.midStage.height+info.nudge.height)-factors.height/2.0).toFixed(1)+'px').css('width',factors.width+'px').css('height',factors.height+'px').css('opacity',(info.opacity.min+(info.opacity.diff*factors.scale)).toFixed(2)).css('z-index',Math.round(info.zValues.min+(info.zValues.diff*factors.z))).css('font-size',(factors.adjustedScale*data.startFontSize).toFixed(2)+'px').attr('current-scale',factors.adjustedScale);if(container.data('roundabout').debug===true){out.push('<div style="font-weight: normal; font-size: 10px; padding: 2px; width: '+ref.css('width')+'; background-color: #ffc;">');out.push('<strong style="font-size: 12px; white-space: nowrap;">Child '+childPos+'</strong><br />');out.push('<strong>left:</strong> '+ref.css('left')+'<br /><strong>top:</strong> '+ref.css('top')+'<br />');out.push('<strong>width:</strong> '+ref.css('width')+'<br /><strong>opacity:</strong> '+ref.css('opacity')+'<br />');out.push('<strong>z-index:</strong> '+ref.css('z-index')+'<br /><strong>font-size:</strong> '+ref.css('font-size')+'<br />');out.push('<strong>scale:</strong> '+ref.attr('current-scale'));out.push('</div>');ref.html(out.join(''))}return jQuery.roundabout_isInFocus(container,ref.data('roundabout').degrees)};

//////END OF roundabout

//////superfish

/*
 * Superfish v1.4.8 - jQuery menu widget
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 *
 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
 */
;(function($){$.fn.superfish=function(op){var sf=$.fn.superfish,c=sf.c,$arrow=$(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),over=function(){var $$=$(this),menu=getMenu($$);clearTimeout(menu.sfTimer);$$.showSuperfishUl().siblings().hideSuperfishUl()},out=function(){var $$=$(this),menu=getMenu($$),o=sf.op;clearTimeout(menu.sfTimer);menu.sfTimer=setTimeout(function(){o.retainPath=($.inArray($$[0],o.$path)>-1);$$.hideSuperfishUl();if(o.$path.length&&$$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path)}},o.delay)},getMenu=function($menu){var menu=$menu.parents(['ul.',c.menuClass,':first'].join(''))[0];sf.op=sf.o[menu.serial];return menu},addArrow=function($a){$a.addClass(c.anchorClass).append($arrow.clone())};return this.each(function(){var s=this.serial=sf.o.length;var o=$.extend({},sf.defaults,op);o.$path=$('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){$(this).addClass([o.hoverClass,c.bcClass].join(' ')).filter('li:has(ul)').removeClass(o.pathClass)});sf.o[s]=sf.op=o;$('li:has(ul)',this)[($.fn.hoverIntent&&!o.disableHI)?'hoverIntent':'hover'](over,out).each(function(){if(o.autoArrows)addArrow($('>a:first-child',this))}).not('.'+c.bcClass).hideSuperfishUl();var $a=$('a',this);$a.each(function(i){var $li=$a.eq(i).parents('li');$a.eq(i).focus(function(){over.call($li)}).blur(function(){out.call($li)})});o.onInit.call(this)}).each(function(){var menuClasses=[c.menuClass];if(sf.op.dropShadows&&!($.browser.msie&&$.browser.version<7))menuClasses.push(c.shadowClass);$(this).addClass(menuClasses.join(' '))})};var sf=$.fn.superfish;sf.o=[];sf.op={};sf.IE7fix=function(){var o=sf.op;if($.browser.msie&&$.browser.version>6&&o.dropShadows&&o.animation.opacity!=undefined)this.toggleClass(sf.c.shadowClass+'-off')};sf.c={bcClass:'sf-breadcrumb',menuClass:'sf-js-enabled',anchorClass:'sf-with-ul',arrowClass:'sf-sub-indicator',shadowClass:'sf-shadow'};sf.defaults={hoverClass:'sfHover',pathClass:'overideThisToUse',pathLevels:1,delay:800,animation:{opacity:'show'},speed:'normal',autoArrows:true,dropShadows:true,disableHI:false,onInit:function(){},onBeforeShow:function(){},onShow:function(){},onHide:function(){}};$.fn.extend({hideSuperfishUl:function(){var o=sf.op,not=(o.retainPath===true)?o.$path:'';o.retainPath=false;var $ul=$(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass).find('>ul').hide().css('visibility','hidden');o.onHide.call($ul);return this},showSuperfishUl:function(){var o=sf.op,sh=sf.c.shadowClass+'-off',$ul=this.addClass(o.hoverClass).find('>ul:hidden').css('visibility','visible');sf.IE7fix.call($ul);o.onBeforeShow.call($ul);$ul.animate(o.animation,o.speed,function(){sf.IE7fix.call($ul);o.onShow.call($ul)});return this}})})(jQuery);


///////end of superfish




jQuery(document).ready(function($){



////////////////////////////// Home slider

	
var duration = "1000";
var delay = "3500";
var autoplay = "on";
var click_to_focus = "on";
	
	var	wizy = {
		global: function()
		{
						
			// align the slogan and the search bar with the logo
			$('#logo-searchbar #slogan, #logo-searchbar .searchbar').each(function() {
				var	height = $(this).outerHeight(),
					logoH = $('#logo-searchbar #logo img').outerHeight();
				 
				$(this).css({ marginTop: (logoH-height)/2 })
			});
			
			var	buttonsMarginLeft = (($('#slider-buttons-container').outerWidth()-$('#slider-buttons-container > ul').outerWidth())/2);
			
			// align the slider buttons in the center of the page
			$('#slider-buttons-container #slider-buttons').css({
				marginLeft: buttonsMarginLeft
			});
			
			
			
			
		},
		projects: function()
		{
			if( $('ul#project-images.slider').size() != 0 )
			{
				$('ul#project-images.slider').cycle({
					fx: 'scrollLeft',
					speed: 300,
					timeout: 8000,
					containerResize: false,
					before: function( curElem, nxtElem, opts, flag )
					{
						var	slider = $(this).parent(),
							curElem = $(curElem),
							nxtElem = $(nxtElem),
							curIndex = $('ul#project-images li').index( curElem ),
							nxtIndex = $('ul#project-images li').index( nxtElem ),
							firstSlideEver = ( ( curIndex == 0 && nxtIndex == 0 ) ? true : false );

						// adjust the slider height depending on the next slide height
						slider.animate({ height: $('img', nxtElem).outerHeight()+19 }, 300);
				
						// control nav vars
						var	liCount = $('li', slider).size(),
							controlNav = '';
			
						// create the control nav
						if( firstSlideEver )
						{
							// prepares the control nav
							for( i = 1; i <= liCount; i++ )
							{
								controlNav = controlNav+'<li'+( (i==1) ? ' class="current"' : '' )+'><a href="#"></a></li>';
							}

							// adds the control nav
							controlNav = '<div id="control-nav"><ul style="width: '+(35*liCount)+'px;" class="reset">'+controlNav+'</ul></div>';
							slider.parent().append( controlNav );
						}
						else
						{
							// change .current class when slides switch
							$('#control-nav li').removeClass('current');							
							$('#control-nav ul li:nth-child('+(nxtIndex+1)+')').addClass('current');	
						}
					}
				})
				.hide()
				.animate({ height: 'show', opacity: 'show' });
		
				// handles the control nav slide getting
				$('#control-nav ul li a').live( 'click', function() {
					var li = $(this).parent(),
						index = $('#control-nav ul li').index( li );
				
					$('ul#project-images').cycle( index );
					return false;
				});	
			}
			

		},
		slider3d: function()
		{
			$('ul#slider._3d').each(function() {
				var interval;
				
				// call roundabout plugin
				$(this).roundabout({
					minScale: 0.5,
					mixScale: 0.5,
					minOpacity: 1.0,
					btnNext: '#next-slide',
					btnPrev: '#prev-slide',
					easing: 'easeInOutBack',
					duration: duration
				});
				
				$('#prev-slide, #next-slide, ul#slider._3d')
				.hover(
					function() {
						// oh no, it's the cops!
						clearInterval(interval);
					},
					function() {
						// false alarm: PARTY!
						interval = startAutoPlay();
					}
				);
				
				// let's get this party started
				interval = startAutoPlay();
				
				// count and prepare few stuff
				var	liCount = $('.roundabout-moveable-item', this).size(),
					controlNav = '';
				
				// prepares the control nav
				for( i = 1; i <= liCount; i++ )
				{
					controlNav = controlNav+'<li'+((i==1) ? ' class="current"' : '')+'><a href="#"></a></li>';
				}
				
				// adds the control nav
				controlNav = '<div id="control-nav"><ul style="width: '+(35*liCount)+'px;" class="reset">'+controlNav+'</ul></div>';
				$(this).parent().append( controlNav );
			});
			
			// handles the control nav current class
			$('ul#slider._3d > li.roundabout-moveable-item').focus(function() {
				var slide = $(this),
					index = $('li.roundabout-moveable-item').index( slide );
				
				// removes current class from the li
				$('#control-nav ul > li').removeClass('current');
				
				// adds a current class to the current li
				$('#control-nav ul > li::nth-child('+(index+1)+')').addClass('current');
			});
			
			// handles the control nav slide getting
			$('#control-nav ul li a').click(function() {
				var li = $(this).parent(),
					index = $('#control-nav ul li').index( li );
				
				$('ul#slider._3d').roundabout_animateToChild( index );
				return false;
			});
			
			// the slide autoplay thing
			function startAutoPlay()
			{
				return setInterval(function() {
					$('ul#slider._3d').roundabout_animateToNextChild();
				}, delay);
			}
		},
		sliderContent: function()
		{
			$('ul#slider._content').cycle({
				fx: effect,
				prev: '#prev-slide',
				next: '#next-slide',
				pause: true,
				speed: speed,
				timeout: delay,
				containerResize: false,
				before: function( curElem, nxtElem, opts, flag )
				{
					var	slider = $(this).parent(),
						curElem = $(curElem),
						nxtElem = $(nxtElem),
						curIndex = $('ul#slider._content li.slide').index( curElem ),
						nxtIndex = $('ul#slider._content li.slide').index( nxtElem ),
						firstSlideEver = ( ( curIndex == 0 && nxtIndex == 0 ) ? true : false );
					
					// adjust the slider height depending on the next slide height
					slider.animate({ height: nxtElem.outerHeight() }, speed);
					
					// do the on change slide animation if its not the first slide on load
					if( ! firstSlideEver )
					{
						switch( effect )
						{
							case 'scrollLeft' :
								curElem.animate({ opacity: 'hide', left: -(curElem.outerWidth()) }, speed);
								break;
							case 'scrollRight' :
								curElem.animate({ opacity: 'hide', left: (curElem.outerWidth()) }, speed);
								break;
							case 'scrollUp' :
								curElem.animate({ opacity: 'hide', top: -(curElem.outerHeight()) }, speed);
								break;
							case 'scrollDown' :
								curElem.animate({ opacity: 'hide', top: (curElem.outerHeight()) }, speed);
								break;
						}
					}
					
					// control nav vars
					var	liCount = $('li.slide', slider).size(),
						controlNav = '';
					
					// create the control nav
					if( firstSlideEver )
					{
						// prepares the control nav
						for( i = 1; i <= liCount; i++ )
						{
							controlNav = controlNav+'<li'+( (i==1) ? ' class="current"' : '' )+'><a href="#"></a></li>';
						}

						// adds the control nav
						controlNav = '<div id="control-nav"><ul style="width: '+(35*liCount)+'px;" class="reset">'+controlNav+'</ul></div>';
						slider.parent().append( controlNav );
					}
					else
					{
						// change .current class when slides switch
						$('#control-nav li').removeClass('current');
						$('#control-nav ul li:nth-child('+(nxtIndex+1)+')').addClass('current');	
					}
				}
			})
			.hide()
			.animate({ height: 'show', opacity: 'show' });
			
			// handles the control nav slide getting
			$('#control-nav ul li a').live( 'click', function() {
				var li = $(this).parent(),
					index = $('#control-nav ul li').index( li );
				
				$('ul#slider._content').cycle( index );
				return false;
			});
		},
		shortcodes: function()
		{
	
			/* TABBED CONTENT
			-------------------------------------- */
			
			$('.wizy_tabbed').each(function() {
				$(this).tabs(".pane", { tabs: 'a.tab' });
			});
	
			/* COLLAPSIBL CONTENT
			-------------------------------------- */
			$('.wizy_collapsible').each(function() {
				console.log( this )
				
				if($('dt', this).hasClass('expanded')) {
					$('dd', this).show();
				} else {
					$('dd', this).hide();			
				}
		
				$('dt', this).live('click', function() {
					var dt = $(this),
						dl = dt.parent(),
						dd = $('dd', dl);
			
					if(dt.hasClass('expanded')) {
						dd.slideUp(300, function() {
							dt.removeClass('expanded');
						});
					} else {
						dt.addClass('expanded');
						dd.slideDown(300);
					}
					return false;
				});
			});
	
			/* MESSAGES
			-------------------------------------- */
			$('.success_notice, .error_notice, .info_notice, .warning_notice').click(function() {
				$(this).animate({
					height: 'hide',
					opacity: 'hide'
				}, function() {
					$(this).remove();
				});	
			});
	
			/* CONTACT FORM
			-------------------------------------- */
			$('#contactform').submit(function() {
				$('.required', this).removeClass('error')
				$('em.error').remove();
		
				var error = false,
					submittedForm = $(this);
			
				submiting = window.setInterval(function(){
					var button = $('#submit').val();
					if (button.length < 10){
						$('#submit').val(button + '.');				
					} else {
						$('#submit').val('Submit ');				
					}
				}, 300);
		
				$('.required', this).each(function() {	
					var fieldName = $(this).attr('name'),
						fieldLabel = $(this).prev().text();
				
					if( $.trim($(this).val()) == '' ) {
						$(this).addClass('error');
						error = true;
					} else if( $(this).hasClass('email') ) {	
						if( !$.trim( $(this).val() ).match(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/) ) {
							$(this).addClass('error');
							error = true;
						}
					}
				});
		
				if( error )
				{
					window.clearInterval(submiting);	
				}			
				else if(!error)
				{
					var fieldsVal = $(this).serialize();
							
					$.ajax({
						type: "POST",
						url: ajaxurl,
						data: fieldsVal,
						success: function( result ){
							submittedForm.before(result);
							submittedForm.animate({
								height: 'hide',
								opacity: 'hide'
							}, 1000, function(){
								$(this).remove();
								window.clearInterval(submiting);	
							});
						}
					});
				}
		
				return false;
			});
		}
	};
	

jQuery('li.slide').hover(function(){

											if(this.className.indexOf('in-focus')>-1){
												jQuery('.roundabout-in-focus .slide-image-container .homeBlurb').fadeIn(500);
												}
												 
												  },function(){
													  jQuery('.roundabout-in-focus .slide-image-container .homeBlurb').fadeOut(500);
													  });

	// call
	wizy.global();
	wizy.projects();
	wizy.shortcodes();
	if( $('ul#slider._3d').size() !== 0 ) wizy.slider3d();
	if( $('ul#slider._content').size() !== 0 ) wizy.sliderContent();


//////////////////////////// end home slider
});
