/*
Phil Renaud the mad scientist behind this.
phil@rhinointernet.com
http://rhinointernet.com
*/



$(document).ready(function(){

   if ($('body').is('.home')) {
   slider();
   } else {
//      tallworld();
//      $(window).resize(function(){
//         tallworld();
//      }); //resize
   } //if home

   $(window).resize(function(){
      setwidths();
   }); //resize
   movepromos();
   if ($('.contentproper').find('table').length || $('.contentproper').find('form').length){
      } else {
   //	$('.contentproper').columnize({width:400});
   }; //if
      
   $('a.launch-vd').click(function(){
      window.open($(this).attr('href'), 'videoplayer',
         'width=1242, height=775, innerHeight=825, location=no, menubar=no, status=no, titlebar=no, scrollbars=no'
      );
      
      return false;
   });

});






/*==( Homepage Animated Slider )======================================================*/

function slider() {
$('.slider').append('<a href="#" class="goright">Next</a>');
setwidths();
theloops();
}; //slider


function setwidths(){
//$('.panelcontainer li').css({'width': $(document).width()-260});
}; //setwidths


/*==( Homepage Slider )======================================================*/

function theloops() {
$('.panelcontainer li:first-child').addClass('active');

      $('.slider').hover(function(){
         clearInterval(looper);
      }, function(){
         clearInterval(looper);
         looper = setInterval(function() {
            $('a.goright').click();
         }, 8000);
      }); //hover

      $('.goright').hover(function(){
         clearInterval(looper);
      }, function(){
         clearInterval(looper);
         looper = setInterval(function() {
            $('a.goright').click();
         }, 8000);
      }); //hover

	

sliderinteraction();
	
}; //theloops



function sliderinteraction(){
   $('a.goright').click(function(){
      if ($('.panelcontainer').children('li.active').is(':last-child')) {
         $('.panelcontainer').children('li.active').removeClass('active');
         $('.panelcontainer').children('li:first-child').addClass('active');
      } else {
         $('.panelcontainer').children('li.active').removeClass('active').next('li').addClass('active');
      }; //if last
      $('.panelcontainer').animate({'left': -$('.panelcontainer').children('li.active').position().left}, {duration: 1000, easing: 'expoinout'});
      return false;
   }); //right click


   looper = setInterval(function() {
      $('a.goright').click();
   }, 8000);
}; //sliderinteraction













/*==( Lengthen the #worldcontainer element )======================================================*/

function tallworld() {
if ($(window).height() >= $('.major').height()+200) {
$('#worldcontainer').css({'height': $(window).height()});
} else {
$('#worldcontainer').css({'height': $(document).height()});
}
}; //tallminor




/*==( Promos )======================================================*/

function movepromos() {
$('a.promo').each(function(){
   $(this).appendTo('.promotions');
}); //each
}; //movepromos







