// JavaScript Document

$(function() {
	$("#main_menu li").bind('mouseover', function() { $(this).css('background-image','url(images/menu_bg_over.jpg)'); } );
	$("#main_menu li").bind('mouseout', function() { $(this).css('background-image','url(images/menu_bg.jpg)'); } );
} );

function confirmNewsletterSignup() {
	if ( $("#newsletteremail" ).val() != '' ) {
		$( "#newsletterSignupForm input[name='newsletteremail']"  ).val( $("#newsletteremail" ).val() );
		show_popup( '', 'Newsletter Signup', "$('#newsletterSignupForm').submit()" );
		$("#newsletterCaptcha").clone().appendTo( $("#popup_content") ).show();
	//	$("#popup_content").clone().append( $("#newsletterCaptcha") );
	} else {
		alert( "Please fill in your email address to continue." );
	}
}

function show_popup( content, title, callback, ht, wd ) {
	if ( !ht ) ht = 550;
	if ( !wd ) wd = 670;
	if( $('#popup_content') ) { 
		$('#dialog').dialog('destroy');
		$('#dialog').remove();
	}
//	
	$("<div>").attr('id','dialog').appendTo($('body'));
	$("<div>").attr('id','popup_content').appendTo( $('#dialog') ).html( content );
	
	var btns;
	if (callback != 'NONE') { 
		if (callback != 'NULL') { 
			btns = { 
				"Ok": function() { 
					eval( callback ); 
					$(this).dialog('destroy'); 
					$('#dialog').remove(); 
				},  
				"Cancel" : function() { 
					$(this).dialog('destroy'); 
					$('#dialog').remove(); 
				} 
			};
		} else {
			btns = { 
				"Cancel" : function() { 
					$(this).dialog('destroy'); 
					$('#dialog').remove(); 
				} 
			};
		}
	}
	$("#dialog").dialog({
		bgiframe: true,
		width: wd,
		height: ht,
		modal: true,
		title: title,
		buttons: btns,
		close: function() {
			$(this).dialog('destroy');
			$('#dialog').remove();
		}
	});
}

