$(document).ready(function() { 
	/*
	 * DOM and Event selectors go here....just like CSS
	 * First you select an object and/or event...
	 * Then you specify jquery properties for that object/event...
	 * Or a function you'd like to execute...
	 */ 
	
	// Validate cm subscribe form
	$("form#cm-subscribe").each(function() {
        
        $("div#notifier").hide();
	    $("form#cm-subscribe").removeClass();
	    $("div.button").show();
	    $("div.loader").hide();
	    
        $(this).submit(function() {
    	    $("div#notifier").empty();
    	    $("form#cm-subscribe").removeClass();

    	    var error_code = false;
    	    var validation_message = '';
    	    var validation_error_class = '';

    	    if ($("input#l213346-213346").val() == '') {
    	        error_code = true;
    	        validation_message = validation_message + '<p>Your email address is required to proceed.</p>';
    	        validation_error_class = validation_error_class + 'subscriber-email-error ';
    	    }
    	    if ($("input#name").val() == '') {
    	        error_code = true;
    	        validation_message = validation_message + '<p>Your name is required to proceed.</p>';
    	        validation_error_class = validation_error_class + 'subscriber-name-error ';
    	    }
    	    if ($("input#PostalCode").val() == '') {
    	        error_code = true;
    	        validation_message = validation_message + '<p>Your postal code is required to proceed.</p>';
    	        validation_error_class = validation_error_class + 'subscriber-postal-code-error ';
    	    }
    	    if ($("input#Company").val() == '') {
    	        error_code = true;
    	        validation_message = validation_message + '<p>Your company is required to proceed.</p>';
    	        validation_error_class = validation_error_class + 'subscriber-company-error ';
    	    }
    	    if ($("select#company-type-dropdown").val() == '') {
    	        error_code = true;
    	        validation_message = validation_message + '<p>Your company type is required to proceed.</p>';
    	        validation_error_class = validation_error_class + 'subscriber-company-type-error ';
    	    }
    	    if ($("select#department-dropdown").val() == '' || ($("select#department-dropdown option:selected").text() == 'other' && $("input#JobFunction").val() == '')) {
    	        error_code = true;
    	        validation_message = validation_message + '<p>Your department is required to proceed.</p>';
    	        validation_error_class = validation_error_class + 'subscriber-department-error ';
    	    }
    	    if ($("select#job-title-dropdown").val() == '' || ($("select#job-title-dropdown option:selected").text() == 'other' && $("input#JobTitleOther").val() == '')) {
    	        error_code = true;
    	        validation_message = validation_message + '<p>Your job title is required to proceed.</p>';
    	        validation_error_class = validation_error_class + 'subscriber-job-title-error ';
    	    }
    	    if (error_code == true) {
    	        $("form#cm-subscribe").addClass(validation_error_class);
    	        $("div#notifier").prepend(validation_message);
    	        $("div#notifier").show();
    	        $("div#notifier").Highlight(500, '#900');
    	        return false;
    	    } else {
    	        $("div#notifier").hide();
        	    $("form#cm-subscribe").removeClass();
        	    $("div.button").hide();
        	    $("div.loader").show();
    	        return true;
    	    }
    	});
	});
});   