$(document).ready( function(){

    $(".showtime_toggle").click(function()
    {
        //alert($(this).parent().parent().parent().parent().attr("tagName"));
        $(this).parent().parent().parent().parent().nextAll('.screen_showtimes').toggle(200);
    });
    
        
    
	$('img[@src$=.png]').ifixpng();

	//roll over function
	$(".roll-image").hover(
		function () {
			var img_orig = $(this).attr("src");
			var img_replace = img_orig.replace("_off.gif", "_on.gif");
			$(this).attr( "src", img_replace )
		},
		function () {
			var img_orig = $(this).attr("src");
			var img_replace = img_orig.replace("_on.gif", "_off.gif");
			$(this).attr( "src", img_replace )
		}
	);

	//Used to clear a form
	//eg $('#FormIdHere').clearForm();
	$.fn.clearForm = function() {
		this.each(function() {
			var type = this.type, tag = this.tagName.toLowerCase();

			if (tag == 'form')
				return $(':input',this).clearForm();
			if (type == 'text' || type == 'password' || tag == 'textarea')
				this.value = '';
			else if (type == 'checkbox' || type == 'radio')
				this.checked = false;
			else if (tag == 'select')
				this.selectedIndex = '';
		});
	};
});

function submitEnter(myfield,e){
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;

	if (keycode == 13){
	   myfield.form.submit();
	   return false;
	}else{
	   return true;
	}
}

function post_mailing_list(){

	var parametri1 = $("input").serialize();

	$("#AJ_mailing_list").html("<h2>JOIN MAILING LIST</h2><br/><img src='/images/loading2.gif' alt='Loading...' />");

	$.post("/ajax_mailing_list/?"+parametri1, {},
	  function(data){
	    	$("#AJ_mailing_list").html(data);
	  }
	);
}

