$(function() {
        function go_feed () {
     $("#feedback").dialog({ 
		title: 'Обратная связь',
		width: 360,
		
		
	    resizable: false,
           buttons: {
				'Отмена': function()  { 
				$(this).dialog('close');
								},
				'Отправить': function()  { 
						var uname = document.getElementById("name_feedback").value,
						 email = document.getElementById("email_feedback").value,
						 message = document.getElementById("message_feedback").value;
						$.post("http://netstroi.ru/contact", {
						  op:"ajax", sender_name:uname,    sender_email:email,	 message:message, opi:'ds'
						  			},  function(data){
   
   														   $("#feedback").html(data).effect("highlight",{},1500);
   
            											   });
   
 				}
								  
		    	  } 
					
    });
    
    }
 
	
	
		
		$(' #button_feedback, #button_feedback_2').click(function() {
				
		$.getScript("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js", function(){
		
       loadOurCss('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css');
		
		
		
	 	go_form();	
	 	
	 	go_feed();
 if (isIE()) 	 $('#feedback').focus();	
	 	
 
 																							});
		
			})

function go_form() {

$.post("http://netstroi.ru/contact", { op:"ajax"},  function(data){
   			$("#feedback").html(data);
   			
		               });
		               
		               
}


 function loadOurCss(source){
    var head = document.getElementsByTagName("head")[0];
    Css=document.createElement('link');
    Css.rel='stylesheet';
    Css.type='text/css';
    Css.href=source;
    head.appendChild(Css);
   }



$("#load_div, #load_img").ajaxStart(function(){
	$(this).show();
})
.ajaxComplete(function(){
	$(this).hide();
});

var heigh = $(document).height();
document.getElementById("load_div").style.height = heigh+"px";

 	});
 	
 	function isIE(){
var browser=navigator.appName;
var b_version=navigator.appVersion;
var version=parseFloat(b_version);
if (browser=='Microsoft Internet Explorer'){
return true;
}else{
return false;
}
}  

   	
