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



$(document).ready(function(){

   if ($('body').is('.home')) {
      slider();
      videocover();
   } //if home
   clientlogin();
   if ($('.reliabilityconcernstower').length) {
   reliabilityconcernstower();
   }; //if reliability concerns

$('li.hideme').remove();

});






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

function slider() {

$('#hero').append('<div class="panelnav"></div>');
$('.panelnav').append('<a href="#" class="goleft">Previous</a><a href="#" class="goright">Next</a>');

$('.panel').each(function(){
$(this).css({'width': $(window).width()});
   $(this).append('<div class="textshadow"></div>');
}); //each panel

$('.panelcontainer').children('li:first-child').addClass('active');



looper = setInterval (function(){
   $('.goright').click();
}, 5000); //bigpromotionloop




      $('#hero').hover(function(){
         clearInterval(looper);
      }, function(){
         clearInterval(looper);
         looper = setInterval(function() {
            $('a.goright').click();
         }, 5000);
      }); //hover
      
$('.panel').find('img').css({'left': '50%'});





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


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


}; //slider






/*==( Video Cover )======================================================*/


function videocover() {
		flashvars = {
   		file: "/video/PLP_Main_724_1.5Mbs.flv",
   		autostart: 'false',
   		repeat: 'single',
   		image: '/images/holder.jpg',
   		smoothing: 'false',
   		allowfullscreen: 'true'
		};

		flashwidth = 620;
		flashheight = 370;

		var attributes = {};
		attributes.id = "ppsvideo";
		attributes.name = "ppsvideo";

		var params = {};
		params.allowscriptaccess = "always";
		params.allowfullscreen = "true";
		params.wmode = "transparent";

		swfobject.embedSWF("/video/player.swf", "ppsvideo", flashwidth, flashheight, "9.0.0", "/javascript/expressInstall.swf", flashvars, params, attributes);
}; //videocover



/*==( Client Login )======================================================*/


function clientlogin(){
$('a.clientlogin').click(function(){
$(this).after('<form class="inlineform hideme" method="post" action="/wp-login.php"><div><p><label>Username<input type="text" tabindex="10" size="20" value="" class="input" id="user_login" name="log"></label></p><p><label>Password<input type="password" tabindex="20" size="20" value="" class="input" id="user_pass" name="pwd"></label></p><p class="submit"><input type="submit" tabindex="100" value="Log In" class="button-primary" id="wp-submit" name="wp-submit"><input type="hidden" value="/" name="redirect_to"><input type="hidden" value="1" name="testcookie"></p></div></form>');
if (($.browser.msie && $.browser.version.substr(0,1)<8)) {
$(this).animate({'marginRight': '120px'}, {duration: 1000, easing: 'expoinout'});
		} else {
$(this).animate({'right': '630px'}, {duration: 1000, easing: 'expoinout'});
}; //if
$('form.inlineform').show(1500);
return false;
}); //click
}; //clientlogin




/*==( Reliability Concerns Tower )======================================================*/

function reliabilityconcernstower() {
$('.reliabilityconcernstower').wrap('<div class="reliabilityconcernscontainer"></div>');
$('.reliabilityconcernstower').children('li:first-child').show();

		if ($.browser.msie) {

$('.reliabilityconcernstower').toggle(function(){
   $('.reliabilityconcernstower').children('li:eq(0)').hide().parent('ul').children('li:eq(1)').show();
}, function(){
   $('.reliabilityconcernstower').children('li:eq(1)').hide().parent('ul').children('li:eq(2)').show();
}, function(){
   $('.reliabilityconcernstower').children('li:eq(2)').hide().parent('ul').children('li:eq(0)').show();
}); //toggle

} else {

$('.reliabilityconcernstower').toggle(function(){
   $('.reliabilityconcernstower').children('li:eq(0)').hide(500).parent('ul').children('li:eq(1)').show(500);
}, function(){
   $('.reliabilityconcernstower').children('li:eq(1)').hide(500).parent('ul').children('li:eq(2)').show(500);
}, function(){
   $('.reliabilityconcernstower').children('li:eq(2)').hide(500).parent('ul').children('li:eq(0)').show(500);
}); //toggle

}; //if ie

}; //reliabilityconcernstower









