$(function(){
	//$.fx.interval = 44;
	
	$('#loginform, .clickFields').clickFields();
	$('.popupform form').ajaxForm({ 
		dataType:	'json',
		url:        '/www/index.php/ajax/signupForm',
		success:    function(data) { 
			if(data.success==true){
				alert('Thank you!'); 
				$("a.leanModalclose").trigger('click');
			} else {
				alert(data.message);
			}
		} 
	});
	
	$dropdowns = $('li.dropdown');
	var delayInt = 0;
	$dropdowns.hover(
		function(){
			$('ul', this).css({'zIndex':'2'}).stop(true,false).delay(delayInt).slideDown(450,function(){
				$(this).css({'height':'auto','padding':'30px'});
				delayInt = 450;
			});
		},
		function(){
			$('ul', this).css({'zIndex':'1'}).stop(true,false).slideUp(250,function(){
				$(this).css({'height':'auto','padding':'30px'});
				delayInt = 0;
			});
		}
	);
	
	$('.dropdown_menu').hover(
		function(){ $(this).addClass('hover') },
		function(){ $(this).removeClass('hover') }
	);
	
	$("a[rel*=leanModal]").leanModal();
	
	$("a.leanModalclose").click(function(e){
		$("#lean_overlay").fadeOut(200);
		$($(this).attr("href")).css({ 'display' : 'none' });		
	});
	
});
