$(document).ready(function() {

	// IE Dropdown menu resize
    if ($.browser.msie) $('select.GrowList')
        .bind('focus mouseover', function() { $(this).addClass('expand').removeClass('clicked'); })
        .bind('click', function() { $(this).toggleClass('clicked'); })
        .bind('mouseout', function() { if (!$(this).hasClass('clicked')) { $(this).removeClass('expand'); }})
        .bind('blur', function() { $(this).removeClass('expand clicked');
    });


	// Optional message for form fields
    // --------------------------------
    $(".OptionalInput").each(function() {
        $(this).val($(this).attr("title"));
        $(this).css({ color: "#cccccc" });
    });

    $(".OptionalInput").focus(function() {
        if ($(this).val() == $(this).attr("title")) {
            $(this).val("");
            $(this).css({ color: "#666666" });
        }

    }).blur(function() {
        if ($(this).val() == "") {
            $(this).val($(this).attr("title"));
            $(this).css({ color: "#cccccc" });
        }
    });
    
    
    // Payment online selector
    // --------------------------------
	jQuery('a.Selector').toggle(function() {
		jQuery('#Payees').fadeIn('fast');
  	}, function() {
		jQuery('#Payees').fadeOut('fast');
	});
	
	
	// Write a review button
	// --------------------------------
	$("#WriteReview").change(function(){
		var selectedOption = $("#WriteReview option:selected").val();
            		
		if (selectedOption != "") {
			$("#ReviewButton").attr("href",selectedOption);
			$("#ReviewButton").removeClass("Disabled");
			$("#ReviewButton").addClass("Orange");
		} else {
			$("#ReviewButton").removeAttr("href")
			$("#ReviewButton").removeClass("Orange");
			$("#ReviewButton").addClass("Disabled");
		}
				
	});

});
