function placeWin(){
	
}

var text = {
		'ru':['Имя*','E-mail*','Телефон','Сообщение*'],
	    'en':['Name*','E-mail*','Phone','Message*','Send']
};

$(function() {
	var win = new my_window(500, 0, "WINDOW", "", $("body"));
	
	// Карусель на главной
    $(".carousel").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
        visible: 3,
        auto: 5000,
        speed: 1000
    });
    
    // Кнопка оставить отзыв
    $(".button_review").click(function(){
    	$(".button_review").addClass('active');
    	$("#add_review").show();
    });
    
    // Обработка формы
    $("#add_review input[name=name]").focus(function(){if ($(this).val()== text[lang][0]) $(this).val("");});
    $("#add_review input[name=email]").focus(function(){if ($(this).val()==text[lang][1]) $(this).val("");});
    $("#add_review input[name=phone]").focus(function(){if ($(this).val()==text[lang][2]) $(this).val("");});
    $("#add_review textarea").focus(function(){if ($(this).val()==text[lang][3]) $(this).val("");});
    $("#add_review input[name=name]").blur(function(){if ($(this).val()=="") $(this).val(text[lang][0]);});
    $("#add_review input[name=email]").blur(function(){if ($(this).val()=="") $(this).val(text[lang][1]);});
    $("#add_review input[name=phone]").blur(function(){if ($(this).val()=="") $(this).val(text[lang][2]);});
    $("#add_review textarea").blur(function(){if ($(this).val()=="") $(this).val(text[lang][3]);});
    
    // Проверка формы
    $("#add_review input[name=submit]").click(function(){
    	name = $("#add_review input[name=name]").val();
    	email = $("#add_review input[name=email]").val();     	
    	message = $("#add_review textarea").val();    	
    	    	
    	var error = '';
    	if (name == text[lang][0] || name == ''){
    		error += "Имя<br/>";    		
    	}
    	if (email == text[lang][1] || email == ''){
    		error += "E-mail<br/>";
    	}
    	if (message == text[lang][3] || message == ''){
    		error += "Сообщение<br/>";
    	}
    	
    	if (error) { 
    		
    		win.contentObj.html("");
    		win.contentObj.append($("<h3></h3>").text('Не заполнены поля'));
			win.contentObj.append(error);
			
			clientHeight = document.documentElement.clientHeight;
			clientWidth = document.documentElement.clientWidth;
			$(win.container).css({left:(clientWidth-$(win.container[0]).innerWidth())/2});
			$(win.container).css({top:(clientHeight-$(win.container[0]).innerHeight())/2});
			
			win.show();	
			
			win.setTitle("Отправка запроса");
			return false;			
    	}
    });
});
