function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

function clearElem(elem){

	//empty any existing 'clear' items in the queue
	$(elem).stop(true,false);
	
     //add new fade with a 5 second delay to the queue and restart it.
	$(elem).queue(function(){
	    $(this).animate({opacity: 1.0}, 5000);
 	    $(this).slideUp('slow');
 	    $(this).dequeue();
     });
}

function online_contact(){
	var url = '/contact/submit';
	$.post(
		url,
		$('#fmContact').serialize(),
		function (data){
			rData = jQuery.parseJSON(data);
			$('#info').html(rData.msg);
			$('#info').slideDown('slow');
			if(rData.flag===1){
				$('#submit').attr('disabled','disabled');
			}
			//$('#submit').removeAttr('disabled');
			clearElem($('#info'));
		});
}
