jQuery(document).ready(function()
{
	jQuery('#top-tease-ticker').marquee({yScroll:'bottom'});
	jQuery('#breaking-news').marquee({yScroll:'bottom'});

	jQuery('#hl-scoop-form').fancybox({hideOnContentClick:false, callbackOnShow: setupContact7Form});
	jQuery('#hl-brit-form').fancybox({hideOnContentClick:false, callbackOnShow: setupContact7Form});
	jQuery('#hollywood-signup-link').fancybox({hideOnContentClick:false, callbackOnShow: setupSignupForm, frameHeight: 500});
	

	jQuery('.contest_form').submit(function()
	{
		jQuery(this).ajaxSubmit({
			dataType: 'json',
			success: function(result)
			{
				var formWrapper = jQuery('.contest_form').parent();
				if(result.success)
				{
					formWrapper.html("<p>Thank you for your submission!</p>");
				}
				else
				{
					formWrapper.find('ul.errors').html(result.error_html);
				}
			}
		});
		return false;
	});
});

var setupSignupForm = function()
{
	jQuery('.su_form').submit(function()
	{
		jQuery(this).ajaxSubmit({
			dataType: 'json',
			success: function(result)
			{
				var formWrapper = jQuery('.su_form').parent();
				if(result.success)
				{
					formWrapper.html("<p>Thank you for signing up!</p>");
				}
				else
				{
					formWrapper.find('ul.errors').html(result.error_html);
				}
			}
		});
		return false;
	});
};

var setupContact7Form = function()
{
	try {
		jQuery('#fancy_div div.wpcf7 > form').ajaxForm({
			beforeSubmit: wpcf7BeforeSubmit,
			dataType: 'json',
			success: wpcf7ProcessJson
		})
		
		var tag = jQuery("#fancy_div div.wpcf7 > form input[name='_wpcf7_unit_tag']");
		jQuery("'#fancy_div div.wpcf7").attr("id", jQuery("'#fancy_div div.wpcf7").attr('id') + '-fancy');
		tag.val(tag.val() + '-fancy');
	} catch (e) {
	}

	try {
		jQuery('#fancy_div div.wpcf7 > form').each(function(i, n) {
			wpcf7ToggleSubmit(jQuery(n));
		});
	} catch (e) {
	}
};

var setupContestForm = function()
{

};