// JavaScript Document
$(document).ready(init);
function init(){
	$("#dialog").dialog({
		modal: true,
		autoOpen: false,
		draggable: false,
		resizable: false,
		width: 550,
		height: 350, 
		closeOnEscape: true,
		buttons: { 
			'Send': function () { 
			var name = $("#form_name").val(); 
			var mail = $("#form_email").val(); 
            var msg  = $("#form_comment").val();  
            if (name =='')  
            {  
                alert ("Enter your name!");  
                return false;  
            }  
			if (mail =='')  
            {  
                alert ("Enter your e-mail!");  
                return false;  
            }  
            if (msg =='')  
             {  
                 alert ("Enter your message!");  
                 return false;  
             }
			$.ajax({  
                 type: "POST",  
                 url: "send.php",  
                 data: "name="+name+"&mail="+mail+"&msg="+msg,  
                 success: function(){  
                     alert ("Thank you!"); 
					 $("#dialog").dialog('close')
					 $('#contactForm').clearForm()
                }  
             });
			},
			'Cancel': function () { $("#dialog").dialog('close')}
		},
		show: 'blind',
		hide: 'blind'
//		show: 'highlight'
	});
	$(".windowOpen").click(function() {
		$("#dialog").dialog('open');
	});	
};

//$("div.ui-widget-overlay").fadeIn("slow");
