$(document).ready(function(){
	$(window).load(function(){mmwidth();})
	$(window).resize(function(){mmwidth();})
});
function mmwidth(){
	document.getElementById('top2').style.width = ((document.documentElement.clientWidth || document.body.clientWidth) < 990) ? '990px' : ((document.body.clientWidth > 1210) ? '1210px' : '100%');
};

function ShowMessage(messageText){ 
if(messageText!=''){
	messageText = messageText.split("\|");	
	switch(messageText[1]){
		case "info": ico="65.png"; title="Информация"; break;
		case "confirm": ico="25.png"; title="Вопрос"; break;
		case "alert": ico="25.png"; title="Внимание"; break;
		case "ok": ico="100.png"; title="Сообщение"; break;
		case "err": ico="116.png"; title="Внимание"; /*$("#messageWindow #messageText").css("color","red");*/ break;
		default: ico="25.png"; title=""; break;		
	}	
/*	$("#messageWindow #massageIco img").attr("src","/admin/img/pics2/"+ico);
	$("#messageWindow #massageIco img").load(function(){
		$("#messageWindow #massageIco img").show();
	});*/

	$("#messageWindow #messageText").html(messageText[0]);
	$("#messageWindow").attr("title",title);
	$("#messageWindow").dialog({
			bgiframe: true,
			resizable: false,
			height:200,
			modal: true,
			overlay: {
				backgroundColor: '#000',
				opacity: 0.5
			},
			buttons: {
				'Закрыть': function(){
					$(this).dialog('destroy');					
				}
			}
	});
}
return false;
}

function setRadingFormOrder(){
	$("#sendform").validate({
               rules : {
                	fio : {required : true},
	                phone : {required : true},
			sender_mail : {required: true, email: true},
	                info : {required : true},

               },
               messages : {
                       	fio : {
                               required : "Введите ваше имя"
	                      },
               	       	phone : {
                               required : "Введите телефон"
	                      },
               	      	sender_mail : {
                                required : "Введите адрес электронной почты",
				email: "Нужен корректный email адрес"
	                      },
               	      	info: {
                                required : "Введите текст сообщения"
	                      }
	       }

       });

}
