$(document).ready(function(){
    $('#subscribeForUpdates').submit(function() {

    	$("#ajaxIndicator").show();        
        $(this).ajaxSubmit({            
            dataType: "json",
            success: function(response) {
            	if (response.success)
                	Boxy_green.alert('<strong>Joining Newsletter - One more step...</strong><br><br>Thank you for joining our newsletter!<br><br>We sent you an e-mail with short instructions on how to complete the process and obtain the study notes. Please check your e-mail soon.', null, {title: 'Joining Newsletter - One more step...'});
                else
                	Boxy_error.alert('<strong>Check form completeness</strong><br><br>Please enter first name and valid e-mail.', null, {title: 'Check form completeness'});
                if (response.success) $('#subscribeForUpdates_container').hide();
                $("#ajaxIndicator").hide();
            }
        });
        
        return false;
    });
    $('#subscribeForUpdates_demo').dialog({width:'auto', height:'auto', autoOpen:false});
    $('#subscribeForUpdates_demoLink').click(function(){
    	
            		document.getElementById('TB_iframe').src = '';
            		document.getElementById('TB_iframe').src = $('#subscribeForUpdates_demoLink').attr('href');
            		document.getElementById('TB_overlay').style.display='block';
            		document.getElementById('TB_popup').style.display='block';
    	
    	return false;
    	
    });
});

