/**** jQuery Cycle Lite *****/ 
;(function($){var ver="Lite-1.1";$.fn.cycle=function(options){return this.each(function(){options=options||{};if(this.cycleTimeout){clearTimeout(this.cycleTimeout);}this.cycleTimeout=0;this.cyclePause=0;var $cont=$(this);var $slides=options.slideExpr?$(options.slideExpr,this):$cont.children();var els=$slides.get();if(els.length<2){window.console&&console.log("terminating; too few slides: "+els.length);return ;}var opts=$.extend({},$.fn.cycle.defaults,options||{},$.metadata?$cont.metadata():$.meta?$cont.data():{});opts.before=opts.before?[opts.before]:[];opts.after=opts.after?[opts.after]:[];opts.after.unshift(function(){opts.busy=0;});var cls=this.className;opts.width=parseInt((cls.match(/w:(\d+)/)||[])[1])||opts.width;opts.height=parseInt((cls.match(/h:(\d+)/)||[])[1])||opts.height;opts.timeout=parseInt((cls.match(/t:(\d+)/)||[])[1])||opts.timeout;if($cont.css("position")=="static"){$cont.css("position","relative");}if(opts.width){$cont.width(opts.width);}if(opts.height&&opts.height!="auto"){$cont.height(opts.height);}var first=0;$slides.css({position:"absolute",top:0,left:0}).each(function(i){$(this).css("z-index",els.length-i);});$(els[first]).css("opacity",1).show();if($.browser.msie){els[first].style.removeAttribute("filter");}if(opts.fit&&opts.width){$slides.width(opts.width);}if(opts.fit&&opts.height&&opts.height!="auto"){$slides.height(opts.height);}if(opts.pause){$cont.hover(function(){this.cyclePause=1;},function(){this.cyclePause=0;});}var txFn=$.fn.cycle.transitions[opts.fx];txFn&&txFn($cont,$slides,opts);$slides.each(function(){var $el=$(this);this.cycleH=(opts.fit&&opts.height)?opts.height:$el.height();this.cycleW=(opts.fit&&opts.width)?opts.width:$el.width();});if(opts.cssFirst){$($slides[first]).css(opts.cssFirst);}if(opts.timeout){if(opts.speed.constructor==String){opts.speed={slow:600,fast:200}[opts.speed]||400;}if(!opts.sync){opts.speed=opts.speed/2;}while((opts.timeout-opts.speed)<250){opts.timeout+=opts.speed;}}opts.speedIn=opts.speed;opts.speedOut=opts.speed;opts.slideCount=els.length;opts.currSlide=first;opts.nextSlide=1;var e0=$slides[first];if(opts.before.length){opts.before[0].apply(e0,[e0,e0,opts,true]);}if(opts.after.length>1){opts.after[1].apply(e0,[e0,e0,opts,true]);}if(opts.click&&!opts.next){opts.next=opts.click;}if(opts.next){$(opts.next).bind("click",function(){return advance(els,opts,opts.rev?-1:1);});}if(opts.prev){$(opts.prev).bind("click",function(){return advance(els,opts,opts.rev?1:-1);});}if(opts.timeout){this.cycleTimeout=setTimeout(function(){go(els,opts,0,!opts.rev);},opts.timeout+(opts.delay||0));}});};function go(els,opts,manual,fwd){if(opts.busy){return ;}var p=els[0].parentNode,curr=els[opts.currSlide],next=els[opts.nextSlide];if(p.cycleTimeout===0&&!manual){return ;}if(manual||!p.cyclePause){if(opts.before.length){$.each(opts.before,function(i,o){o.apply(next,[curr,next,opts,fwd]);});}var after=function(){if($.browser.msie){this.style.removeAttribute("filter");}$.each(opts.after,function(i,o){o.apply(next,[curr,next,opts,fwd]);});};if(opts.nextSlide!=opts.currSlide){opts.busy=1;$.fn.cycle.custom(curr,next,opts,after);}var roll=(opts.nextSlide+1)==els.length;opts.nextSlide=roll?0:opts.nextSlide+1;opts.currSlide=roll?els.length-1:opts.nextSlide-1;}if(opts.timeout){p.cycleTimeout=setTimeout(function(){go(els,opts,0,!opts.rev);},opts.timeout);}}function advance(els,opts,val){var p=els[0].parentNode,timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0;}opts.nextSlide=opts.currSlide+val;if(opts.nextSlide<0){opts.nextSlide=els.length-1;}else{if(opts.nextSlide>=els.length){opts.nextSlide=0;}}go(els,opts,1,val>=0);return false;}$.fn.cycle.custom=function(curr,next,opts,cb){var $l=$(curr),$n=$(next);$n.css(opts.cssBefore);var fn=function(){$n.animate(opts.animIn,opts.speedIn,opts.easeIn,cb);};$l.animate(opts.animOut,opts.speedOut,opts.easeOut,function(){$l.css(opts.cssAfter);if(!opts.sync){fn();}});if(opts.sync){fn();}};$.fn.cycle.transitions={fade:function($cont,$slides,opts){opts.cssBefore={opacity:0};opts.animOut={opacity:0};opts.animIn={opacity:1};}};$.fn.cycle.ver=function(){return ver;};$.fn.cycle.defaults={fx:"fade",timeout:4000,speed:1000,next:null,prev:null,before:null,after:null,height:"auto",sync:1,fit:0,pause:0,delay:0,slideExpr:null,cssBefore:{},cssAfter:{},animIn:{},animOut:{}};})(jQuery);
                    
function jqsub() {

  var $form = jQuery('#contact-form'); // set your form ID
  var $messagebox = jQuery('#message'); // set your message box ID
  var $successmessage = "Thank You For Your Submission!"; // replace with your own success message in HTML format
  var $errormessage = "Error - Please Try Again"; // replace with your own error message in HTML format

  jQuery.ajax({
    type: 'POST',
    url: $form.attr('action'),
    data: $form.serialize(), 
    success: function (msg) { 
                      if (msg.FormProcessV2Response.success) {
                            jQuery('#contact-form').fadeOut('slow', function(){
                              jQuery(this).html('<div class="box success"><h2>'+$successmessage+'</h2><p>One of our team members will contact you shortly.</p></div>').fadeIn(500);
                            });
                          }
                          else {
                            jQuery('#contact-form').before('<div class="box error" style="display: none"><h3>'+$errormessage+'</h3></div>');
                            jQuery('.error').fadeIn(2000, function(){ 
                                jQuery(this).fadeOut(1000);
                            });
                          }    
              },
    error: function (msg) {
                            jQuery('#contact-form').before('<div class="box error" style="display: none"><h3>'+$errormessage+'</h3></div>');
                            jQuery('.error').fadeIn(2000, function(){ 
                                jQuery(this).fadeOut(1000);
                            });
                          }
       });
}

jQuery.noConflict();
jQuery(document).ready(function($){

  $('#content h1').appendTo('#promo .container').fadeIn(250).css('z-index', '1');
 
  //$('#snoverview').addClass('mega');  
    $('#navsub_761572_398813').prependTo('#cat_761572_divs');
  $('#nav_761572').sprites({
		allowClick: true,
		show: {height: 'show'},
		hide: {height: 'hide'},
		active: 'selected',
		dropdown: 'mega',
		click: 'click'
	});
	
		
$('#menu_list li').hover(
function () {
$('ul', this).slideDown(100);
$(this).children('a').addClass('active_menu');
}, 
function () {
$('ul', this).slideUp(100);
$(this).children('a').removeClass('active_menu');
});
	
	
	
	
	//$('.dropdowner a').hover(
    //    function () {
    //      $(this).next('.dropdown_list').css('display','block');
 //
  //      },
  //      function () {
  //          //hide its submenu
  //          $(this).next('.dropdown_list').hide();
//
 //       }
  //  );



	
	//$('#navsub_761572_398813').prependTo('#cat_761572_divs');

	//$('#snoverview a').hover( function() {
    //  $(this).addClass('snhover');
    //  $('#navsub_761572_398813').show();
	//}, function(){
    //  $(this).addClass('snleft');
	//});
	
	//$('#navsub_761572_398813').bind( 'mouseover', function() {	
    //  $(this).addClass('over');
	//});
	
	//$('#navsub_761572_398813').bind( 'mouseleave', function() {
    // if( $('.snhover').length == 0 ) {
    //  $(this).removeClass('over');
    // }
     
    // $('#snoverview a').removeClass('snhover');
    // $('#navsub_761572_398813').hide();
	//});
	
	//setInterval( function() {
    //  if(!$('.over').length && $('.snleft').length && $('.snhover').length ){
    //    $('#snoverview a').removeClass('snhover');
   //    $('#snoverview a').removeClass('snleft');
    //    $('#navsub_761572_398813').hide();
    //  }
	//},500);
	
	
	
// E-mail defuscator

  $('a[href^="mailto:"]').addClass('email');
  if ($('a.email').length > 0) { $('a.email').defuscate(); }

// External links auto-styler

  $('p a').filter(function() {
    return this.hostname && this.hostname !== location.hostname;
  }).addClass('external');

  $('a.external').click(function(){
    window.open(this.href);
    return false;
  });

// Button styling

  $('button').hover( function() { $(this).css ('cursor', 'pointer') })

	$('.submitBtn').hover(
		function(){ $(this).addClass('submitBtnHover'); },
		function(){ $(this).removeClass('submitBtnHover'); }
	);	

// Addthis button

	$('#addthis').hover(
		function(){ return addthis_open(this, '', '[URL]', '[TITLE]'); },
		function(){ addthis_close();  }
	);	
  $('#addthis').click(function(){ return addthis_sendto(); });

// Swap value text form

    swapValues = [];
    $(".swap-value").each(function(i){
        swapValues[i] = $(this).val();
        $(this).focus(function(){
            if ($(this).val() == swapValues[i]) {
                $(this).val("");
            }
        }).blur(function(){
            if ($.trim($(this).val()) == "") {
                $(this).val(swapValues[i]);
            }
        });
    });  
  
	$('.opacity50').hover(
		function(){ $(this).fadeTo('fast', 1); },
		function(){ $(this).fadeTo('fast', 0.8);  }
	);	

	$('.opacity75').hover(
		function(){ $(this).fadeTo('fast', 1); },
		function(){ $(this).fadeTo('fast', 0.75);  }
	);	
  
  $(".tooltip").tooltip({
    tipClass: 'tooltip-window',
    tip: '#tooltip-window',
    fadeInSpeed: 250, 
    fadeOutSpeed: 250, 
    predelay: 100
  }); 

  if ($('#landing').length) {
    $('.landing-panel').click( function() {
      window.location = $(this).find('a').attr('href');
    });
  }

  if ($('#sidebar-gallery').length) {
    $('#sidebar-gallery').appendTo('#sidebar').fadeIn('fast');
  }


  if( $('#homepage #content').length ) {
  
  
    
     $('#promo-module').cycle({ 
            pause: true, 
            fx:     'fade', 
            speed:  'fast', 
            timeout: 10000,
            pager:  '#nav',
            next: '#next-link',
            prev: '#prev-link',
            after: function(){
              $('#nav a').addClass('btn');      
            }
        });

    /*    $('#promo-module').hover ( function() {
          $('#promo-module').cycle('pause');    
          $('#promo-module').before('<img class="tmppause" src="/img/pause_btn.png"/>');
          $('.tmppause').fadeOut(2000, function() {
            $(this).remove()
          });
        }, function() {
          //$('.tmppause').remove();
          $('#promo-module').cycle('resume');    
          //$('#promo-module').before('<img class="tmpplay" src="/img/play_btn.png"/>');    
          //$('.tmpplay').fadeOut('slow', function() {
    //        $(this).remove()
          });
    });*/
  }

});
