$(document).ready(function(){
  $('.navi .nB:eq(0)').mouseover(function(){
    $('#sub1').css('display','block');
  });
  $('.navi .nB:eq(0)').mouseout(function(){
    $('#sub1').css('display','none');
  });
  $('.navi .nB:eq(2)').mouseover(function(){
    $('#sub2').css('display','block');
  });
  $('.navi .nB:eq(2)').mouseout(function(){
    $('#sub2').css('display','none');
  });

  $('.cas1').jCarouselLite({
      vertical: true,
      btnPrev: ".prevx",
      btnNext: ".nextx"
  });
  $('.cas2').jCarouselLite({
      vertical: true,
      btnPrev: ".prevy",
      btnNext: ".nexty"
  });
  $(".carousel").jCarouselLite({
      auto: 6000
  });

	$('a.show-popup').simpleLightbox({
		lightboxContentBlock: '.popup2',
		faderOpacity: 0.6,
		faderBackground: '#000000',
		closeLink:'a.close',
		href:true,
		onClick: null
  });


});


//////////////////////////////////////////////////////////////////////////////////////////////////

function isEmail(s) {
    if (s.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
        return true;
    else
        return false;
}

function isDecimal(s) {
    return !isNaN(s);
}

function submitNewsletter() {
    var E = $('#txtNewsletter').val();

    if (E == '' || E == 'email address') {
        alert('Email Address is required.');
        $('#txtNewsletter').focus();
    }
    else if (!isEmail(E)) {
        alert('Email Address is not valid.');
        $('#txtNewsletter').focus();
    }
    else {
        $.get('AJAX/Newsletter.ashx?E=' + escape(E), function() {

            alert('Thanks for joining us.');
            $('#txtNewsletter').val('');

        });
    }

    return false;
}
