$(document).ready(function() {
// Preload Images
 $.preloadCssImages();

Cufon.replace('#nav li a, .navitem , h1, h2');

var shell = $('#shell_outer').height();
var winHeight = $(window).height();
var totalHeight = shell + 86;

if (shell > winHeight) {
 $('#bottomholder').css({
  'position' : 'absolute',
  'top' : totalHeight+'px',
  'left' : '0px'
  });
} else {
  $('#bottomholder').css({
  'position' : 'absolute',
  'bottom' : '0px',
  'left' : '0px'
  });
}

$(window).resize(function() {
var shell = $('#shell_outer').height();
var winHeight = $(window).height();
var totalHeight = shell + 86;

if (shell > winHeight) {
 $('#bottomholder').css({
  'position' : 'absolute',
  'top' : totalHeight+'px',
  'left' : '0px'
  });
} else {
  $('#bottomholder').removeAttr('style');
  $('#bottomholder').css({
  'position' : 'absolute',
  'bottom' : '0px',
  'left' : '0px'
  });
}
});

// Product Line up

 var bver = $.browser.version;
 var bname = $.browser.msie;
 if(bver <= 7.0 && bname == true) {
  $('#p191 .productheading').css('margin','0px 0 18px 0');
  $('#p195 .productheading').css('margin','0px 0 18px 0');
 } else {
  $('#p191 .productheading').css('margin','12px 0 28px 0');
  $('#p195 .productheading').css('margin','12px 0 28px 0');
 }

// Menu Odd and Even Colours
$('.zebra li:even').addClass('stripe-even'); 
$('.zebra li:odd').addClass('stripe-odd'); 

/* Cycle through the Quotes
$('#testimoniallist').cycle({
	fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	speed:  4000
});*/

 $('#featureboxes').innerfade({ 
  speed: 'slow', 
  timeout: 4000, 
  type: 'sequence', 
  containerheight: '160px' 
 }); 

 $('#specialbox').innerfade({ 
  speed: 'slow', 
  timeout: 4000, 
  type: 'sequence', 
  containerheight: '160px' 
 }); 

 $('#quotes').innerfade({ 
  speed: 'slow', 
  timeout: 4000, 
  type: 'sequence', 
  containerheight: '48px' 
 }); 

 $('#testimoniallist').innerfade({ 
  speed: 'slow', 
  timeout: 10000, 
  type: 'sequence', 
  containerheight: '400px' 
 }); 
 
// Set Background of First Sliding Box
  $('.expand:first').css('background-position','0% 100%');
  $('div em:first').css('visibility','hidden');

// Sliding
  $('#homeholder #middlepanel:eq(0)> div.greenbox:gt(0)').hide();
  $('#homeholder  #middlepanel:eq(0)> a.expand').click(function() {
  var currentId = $(this).attr('id');
  $('.expand').css('background-position','0% 0%');
  $(this).css('background-position','0% 100%');
  $('.click').css('visibility','visible');
  $('#click'+currentId).css('visibility','hidden');
  $(this).next('div:hidden').slideDown('fast').siblings('div:visible').slideUp('fast');

switch(currentId) {
case 'b5':
  $('#hero').css('background-image','url(images/adult.jpg)');
break;
case 'b6':
  $('#hero').css('background-image','url(images/child.jpg)');
break;
case 'b7':
  $('#hero').css('background-image','url(images/elderly.jpg)');
break;
case 'b8':
  $('#hero').css('background-image','url(images/pregnant.jpg)');
break;
case 'b9':
  $('#hero').css('background-image','url(images/other.jpg)');
break;
case 'b10':
  $('#hero').css('background-image','url(images/design/spacer.gif)');
break;
}
 });

// Sliding2
  $('homeholder  #middlepanel:eq(0)> div.greenbox:gt(0)').hide();
  $('homeholder  #middlepanel:eq(0)> a.expand').click(function() {
  var currentId = $(this).attr('id');
  $('.expand').css('background-position','0% 0%');
  $(this).css('background-position','0% 100%');
  $('.click').css('visibility','visible');
  $('#click'+currentId).css('visibility','hidden');
  $(this).next('div:hidden').slideDown('fast').siblings('div:visible').slideUp('fast');  
 });

// this one liner handles all the examples on this page 
  $('a.media').media();

    $("#checkoutbttn").attr("disabled", "disabled");

    $("#terms").click(function() {
    var checked_status = this.checked;
    if (checked_status == true) {
    $("#checkoutbttn").removeAttr("disabled");
    }
    else {
    $("#checkoutbttn").attr("disabled", "disabled");
    }
  });


// custom options
$(".filename").jmp3({
 backcolor: "F6F6F6",
 forecolor: "84B816",
 width: "200",
 height: "25",
 repeat: "no",
 volume: "100",
 autoplay: "false",
 showdownload: "false",
 showfilename: "false"
});

 $('#show').click(function() {
  $('.listen').slideDown('slow');
 });



});

var myDate = new Date ();
function getdate() {
document.userInput.name.value=myDate;
}
