// JavaScript Document
jQuery.noConflict();

// marketing channel drop down
var channel_timer = 0;
var channel_slideup = function () {
	jQuery(".choose-channel").removeClass("choose-channel-open");
	jQuery(".choose-channel ul").slideUp('normal');
};
var channel_slidedown = function () {
	jQuery(".choose-channel").addClass("choose-channel-open");
	jQuery(".choose-channel ul").slideDown('normal');
};
var news_slider_stop=0;
var font_size = 62.5;

jQuery('.dropdown').click(function (){
	jQuery(this).find('ul:first').slideToggle('normal');
});

jQuery(document).ready(function(){
	
	jQuery(".choose-channel").hover(function () {
		clearTimeout(channel_timer);
		channel_timer = setTimeout("channel_slidedown()", 400);
	},function () {
		clearTimeout(channel_timer);
		channel_timer = setTimeout("channel_slideup()", 400);	
	});

    // slider
	jQuery(".news-slider").scrollable({
    	size: 3,
	   	speed:500,
		prev: '.slider-prev',
		next: '.slider-next',
        circular: true
	});

    // slider for splash screens
	jQuery("#promo").easySlider({
		speed: 500,
		controlsShow: true,
        controlsFade: false,
		numeric: true,
		numericId: 'slide_navi',
		pause: 5000,
		auto: true,
		continuous: true,
        callback: showText,
        precallback: hideText
	});
});

function hideText() {
    //jQuery('#home_banner ul.slides li.active').next('li').children('span').slideLeftHide();
    jQuery("#home_banner ul.slides li span").animate({ marginTop: '325px'}, 'fast');
}
function showText() {
    //jQuery('#home_banner ul.slides li.active span').slideRightShow();
    jQuery("#home_banner ul.slides li span").animate({ marginTop: '225px'});
}

// lavalamp menu
jQuery(function() {
   jQuery("#nav").lavaLamp({
      fx: "backout",
      speed: 600,
      click: function(event, menuItem) {
         return true;
      }
   });
   
   jQuery(".item:odd").addClass("odd");
   
});


jQuery(function() {
   jQuery('#footer ul#footernav li:last-child a').css({ 'border' : 'none', 'padding-right' : '0' });
   jQuery('#authors .column .column-top dl:last-child').css('margin', '0');
   
   
   var maxR = jQuery('#range').height();
   jQuery('#services').css('height', maxR);
   
   var maxC = jQuery('#contact').height();
   jQuery('#form').css('height', maxC);
});







jQuery.fn.extend({
  slideRightShow: function(callback) {
    return this.each(function() {
      jQuery(this).animate({marginLeft: -18 + 'px'}, 'fast', 'linear', callback);
    });
  },
  slideLeftHide: function(callback) {
    return this.each(function() {
      jQuery(this).animate({marginLeft: '-' + (jQuery(this).outerWidth(true)+1) + 'px'}, 500, 'swing', callback);
    });
  },
  slideDownHide: function(movePixels) {
     return this.each(function() {
         jQuery(this).animate({marginTop: ''})
     })
  },
  slideUpShow: function(callback) {

  }
});

