$().ready(function(){
	$(".b-popup").click(function(){
		var _href = $(this).attr("href");
		var _x = parseInt($(this).attr("x"))+10;
		var _y = parseInt($(this).attr("y"))+10;
		maxImage2(_href,_x,_y);
		return false;
	});
	$(".g-img-preview").click(function(){
		var img = $(this).find("img");
		var rel = $(img).attr("rel");
		var orig = $(img).attr("orig");
		$(".g-img-selected").removeClass("g-img-selected");
		$(this).addClass("g-img-selected");
		$(".g-img-maxi").attr("src",rel);
		$(".g-img-maxi").attr("rel",orig);
		return false;
	});
	if ($.browser.msie){
		$("#b-page-ie-bg").height($("#b-page").height()+1);
	}
	$("input[@name='ism']").val(Math.floor(Math.random()*10000)+1000);
	$(".b-sender").submit(function(){
		if($("input[@name='name']").val() == "" || $("input[@name='theme']").val()  == ""|| $("input[@name='email']").val()  == ""|| $("input[@name='message']").val()  == ""){
			alert('Вы заполнили не все обязательные поля');
			return false;
		}
	});

});


function maxImage(name)
{
var adresses = window.open("","AAAA", "height=600,width=600,top=100,left=300,scrollbars=no,directories=no,dependent=yes,hotkeys=no,menubar=no,personalbar=no,toolbar=no,status=yes","replace");
var k = adresses.document;
k.open("text/html","replace");
k.write("<style>a{font-size: 12px; font-face: verdana; color:#444;} body,html {height:100%;margin:0;padding:0;width:100%}</style>");
k.write("<html><body><table width=100% height=100%><tr><td align=center><a href='javascript:window.close()'><center><img align=center border=0 src='"+name+"' border=0></a></td></tr></table></body></html>");
k.close();
}


function maxImage2(name,x,y)
{
var adresses = window.open("","AAAA", "height="+y+",width="+x+",top=100,left=300,scrollbars=no,directories=no,dependent=yes,hotkeys=no,menubar=no,personalbar=no,toolbar=no,status=yes","replace");
var k = adresses.document;
k.open("text/html","replace");
k.write("<style>a{font-size: 12px; font-face: verdana; color:#444;} body,html {height:100%;margin:0;padding:0;width:100%}</style>");
k.write("<html><body><table width=100% height=100%><tr><td align=center><a href='javascript:window.close()'><center><img align=center border=0 src='"+name+"' border=0></a></td></tr></table></body></html>");
k.close();
}

