var $devel = jQuery.noConflict();

$devel(window).load(function() {
		$devel('ul.menu').superfish({ 
      hoverClass:    'sfHover',          // the class applied to hovered list items 
      pathClass:     'overideThisToUse', // the class you have applied to list items that lead to the current page 
      pathLevels:    1,                  // the number of levels of submenus that remain open or are restored using pathClass 
      delay:         200,                // the delay in milliseconds that the mouse can remain outside a submenu without it closing 
      animation:     {opacity:'show'},   // an object equivalent to first parameter of jQuery’s .animate() method 
      speed:         'fast',           // speed of the animation. Equivalent to second parameter of jQuery’s .animate() method 
      autoArrows:    true,               // if true, arrow mark-up generated automatically = cleaner source code at expense of initialisation performance 
      dropShadows:   true,               // completely disable drop shadows by setting this to false 
      disableHI:     false,              // set to true to disable hoverIntent detection 
      onInit:        function(){},       // callback function fires once Superfish is initialised – 'this' is the containing ul 
      onBeforeShow:  function(){},       // callback function fires just before reveal animation begins – 'this' is the ul about to open 
      onShow:        function(){},       // callback function fires once reveal animation completed – 'this' is the opened ul 
      onHide:        function(){}        // callback function fires after a sub-menu has closed – 'this' is the ul that just closed 
    });
    
    $devel('ul.amenu').superfish({ 
      hoverClass:    'sfHover',          // the class applied to hovered list items 
      pathClass:     'overideThisToUse', // the class you have applied to list items that lead to the current page 
      pathLevels:    1,                  // the number of levels of submenus that remain open or are restored using pathClass 
      delay:         200,                // the delay in milliseconds that the mouse can remain outside a submenu without it closing 
      animation:     {opacity:'show'},   // an object equivalent to first parameter of jQuery’s .animate() method 
      speed:         'fast',           // speed of the animation. Equivalent to second parameter of jQuery’s .animate() method 
      autoArrows:    true,               // if true, arrow mark-up generated automatically = cleaner source code at expense of initialisation performance 
      dropShadows:   true,               // completely disable drop shadows by setting this to false 
      disableHI:     false,              // set to true to disable hoverIntent detection 
      onInit:        function(){},       // callback function fires once Superfish is initialised – 'this' is the containing ul 
      onBeforeShow:  function(){},       // callback function fires just before reveal animation begins – 'this' is the ul about to open 
      onShow:        function(){},       // callback function fires once reveal animation completed – 'this' is the opened ul 
      onHide:        function(){}        // callback function fires after a sub-menu has closed – 'this' is the ul that just closed 
    });
    
    $devel('#clientscarousel').carouFredSel({
			prev: '#clientsprev',
			next: '#clientsnext',
			auto: false
		});
		
		$devel('#showcasecarousel').carouFredSel({
			prev: '#showcaseprev',
			next: '#showcasenext',
			auto: false
		});
		
		$devel("a.showcase").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});
			
		$devel("a.overlay").fancybox({
		  'titleShow': false,
		  'padding': 0
		});
		$devel("a.iframeFancybox1").fancybox({
		'width'		      :	495,
		'height'		      :	560,
		'overlayOpacity'	 :	'0.4',
		'overlayColor'		 :	'#000',
		'hideOnContentClick' :   false,
		'autoScale'     	 :   false,
   		'transitionIn'		 :   'elastic',
		'transitionOut'	 :   'elastic',
		'type'			 :   'iframe'
	});
		// clear input text on focus
    $devel('input').focus(function() {
      if($devel(this).val() == $devel(this).attr('defaultValue')) {
         $devel(this).val('');
    }
    })
    .blur(function() {
      if($devel(this).val().length == 0) {
         $devel(this).val($devel(this).attr('defaultValue'));
      }
    });
    
    $devel('textarea').focus(function() {
      if($devel(this).val() == $devel(this).attr('defaultValue')) {
         $devel(this).val('');
    }
    })
    .blur(function() {
      if($devel(this).val().length == 0) {
         $devel(this).val($devel(this).attr('defaultValue'));
      }
    });
    
   /* $devel('#footerreload').click(function() {
      wpcf7RefillCaptcha('#footerform', 'captcha-902');
      wpcf7RefillQuiz('#footerform', 'captcha-902');
    });*/

});

/*function wpcf7RefillCaptcha(form, captcha) {
	$devel.each(captcha, function(i, n) {
	   i = captcha;
		$devel(form).find(':input[name="' + i + '"]').clearFields();
		$devel(form).find('img.wpcf7-captcha-' + i).attr('src', n);
		var match = /([0-9]+)\.(png|gif|jpeg)$/.exec(n);
		$devel(form).find('input:hidden[name="_wpcf7_captcha_challenge_' + i + '"]').attr('value', match[1]);
	});
}

function wpcf7RefillQuiz(form, quiz) {
	$devel.each(quiz, function(i, n) {
		$devel(form).find(':input[name="' + i + '"]').clearFields();
		$devel(form).find(':input[name="' + i + '"]').siblings('span.wpcf7-quiz-label').text(n[0]);
		$devel(form).find('input:hidden[name="_wpcf7_quiz_answer_' + i + '"]').attr('value', n[1]);
	});
}*/
