function fixPngs(){
// Loops through all img tags   
	for (i = 0; i < document.images.length; i++){
		var s = document.images[i].src;
		if (s.indexOf('.png') > 0)  // Checks for the .png extension
			fixPng(s, document.images[i]);
	}
}

function fixPng(u, o){
	// u = url of the image
	// o = image object 
	o.src = '/js/clear.gif';  // Need to give it an image so we don't get the red x
	o.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + u + "', sizingMethod='scale')";
} 

function jQueryfixPng(e){
	// u = url of the image
	// o = image object 
	var src = $(e).attr('title');
	alert('src='+src);
	//$(e).src = '/js/clear.gif';  // Need to give it an image so we don't get the red x
	//e.css('filter',"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')");
} 

$(document).ready(function(){
						   
	// Check if we need to degrade to ie6 version
	var ie6 = false;							
	if (jQuery.browser.msie && (parseInt(jQuery.browser.version) < 7)) {
		ie6 = true;	
	}

	// Progressively enhance menu HTML
	$('<span></span>').appendTo('#navigation a');
	$("#navigation span").css("opacity","0");
	
	if(!ie6) {
		
		$("#navigation a").hover(function(){
			// animate opacity to full
			$('span',this).stop().animate({ opacity: 1 }, 300);
		}, function () {
			// animate opacity to nill
			$('span',this).stop().animate({ opacity: 0 }, 500);
		});
			
	} else {
		$("#navigation span").ifixpng();
		$("#navigation a").hover(function(){
			// animate opacity to full
			$('span',this).css('opacity',1 );
		}, function () {
			// animate opacity to nill
			$('span',this).css('opacity',0 );
		});
		
		//jQueryfixPng('#slideshow-overlay');
		$("img, .pngFix, #content ul li, #cboxClose").ifixpng();
	}
	
	$("#booking-form-note div").css('opacity',0).css('display','block');
	
	// Initial setup
	if($("#payment_method-offline").is(':checked')) {
		$("#booking-form-note div").css('opacity',1);
	}
	
	// Click toggle
	$("#payment_method-element input").click(function(){
		if($("#payment_method-offline").is(':checked')) {
			$("#booking-form-note div").animate({'opacity':1}, 200);		  
		} else {
			$("#booking-form-note div").animate({'opacity':0}, 200);	
		}	
	});
	
});


