$(document).ready(function() {
	
	var midHeight = $('div#content').height();
	var gbTop = $('div.grey_back').attr('offsetTop');
	$('div.grey_back').height( midHeight - gbTop + 8 );
	
  $('#pay-now').click(function() {
    $("input[name='payment_action']").val("pay-now");
    $('form#register-confirmation-submit').submit();
  });

  $('#pay-later').click(function() {
    $("input[name='payment_action']").val("pay-later");
    $('form#register-confirmation-submit').submit();
  });
  
  // openPayPal = function() {
  //   // alert("gonna open it!");
  //   window.open( $('a#pay-pal.auto-open').attr('href') );
  // }
  // 
  // if ( $('a#pay-pal.auto-open').length ) {
  //   // setTimeout( "alert('working!');", 3000);
  //   setTimeout( "openPayPal();", 3000);
  // };

  // if ( $('form#paypal_buynow').length ) {
  //   // setTimeout( "alert('working!');", 3000);
  //   setTimeout( "$('form#paypal_buynow').submit();", 3000);
  // };
  
  
  

	$(function(){
		jQuery('ul.sf-menu').superfish({ 
			animation: {height:'show'},   // slide-down effect without fade-in
			speed: 'fast',
			dropShadows: false,
			disableHI: true
		 });
	});
	
	
	$('#mycarousel').jcarousel({
        vertical: false
    });


	$('.jcarousel-item a').click(function() { 
		var largePath = $(this).attr("href");
		var largeTitle = $(this).attr("title");
		var image1 = new Image();
		image1.src = largePath;
		// var image1 = $('<img />').attr('src', largePath);
		
		// alert(largePath);
		// $('#display_image img').fadeTo("slow", 0.01, function() {
		// 			// $(this).addClass("hidden");
		// 			$(this).attr("title", largeTitle);
		// 			$(this).attr("src", largePath);
		// 			// $(this).removeClass("hidden");
		// 			$(this).fadeTo("fast", 0);
		// 			$(this).fadeTo("slow", 1.0);
		// 			$('#display_image_title').html(largeTitle);
		// 			}
		// 		);
				
		$('#display_image img').fadeOut("slow", function() {
			$(this).attr("title", largeTitle);
			$(this).attr("src", largePath);
			$(this).fadeIn("slow");
			$('#display_image_title').html(largeTitle);
			}
		);
		return false;
	});
	
});
