$(document).ready(function(){
	$("#sendcontact-submit").click(function(){
		var str = $("#sendcontact-form").serialize();
		$.post("/tools/sendme.php", str, function(data){$("#ajax_div").html(data);});
		return false;
	});
	
	$("a#video-window, a#panorama-window, .colorbox").colorbox({
		close:"Закрыть",
		next:"Дальше »",
		previous: "« Назад",
		current:"{current} из {total}"
	});
	$("a.sms-votez").colorbox({width:'520px'});
	$("#auth-new-link").colorbox({width:"356px", inline:true, href:"#login-form-window"});
	$(".colorbox-content").colorbox({inline:true, href:"#colorbox-content-window"});
	$(".colorbox-content-2").colorbox({width:"500px", inline:true, href:"#colorbox-content-uslovie"});


	$("a.tab").click(function(){
		$(".tab-content").hide();
		$("#"+$(this).attr("r")).attr("checked","checked");
		$("#"+$(this).attr("rel")).show();
		return false;
	});
	
	$('.warning-account-blocked').cluetip({width: '300',splitTitle: '|', cluetipClass:'jtip'});
	$('.showprotip').cluetip({width: '400',splitTitle: '|', cluetipClass:'jtip'});
	$('.shop-cost').cluetip({width:'150', splitTitle: '|', cluetipClass:'jtip'});
	//$('img[title], a[title]').cluetip({splitTitle: '|', dropShadow: false, showTitle: false, tracking: true});
	
	setTimeout(function() { $("#chknewmessdiv").load('/tools/soc_messages.php') }, 180000);
	$(".blog-comment-content img").removeAttr("height").removeAttr("width");
	
	/*
	$("a#video-window, a#panorama-window, .colorbox").colorbox({
	close:"Закрыть",
	next:"Дальше »",
	previous: "« Назад",
	current:"{current} из {total}"
	});
*/
	/*
	$("#nav ul").tabs("#panes > div", {effect: 'fade', fadeOutSpeed: 0});
	*/
	/*
hs.registerOverlay({
	overlayId: 'closebutton',
	position: 'top right',
	fade: 2 // fading the semi-transparent overlay looks bad in IE
});

hs.showCredits = false; 
hs.graphicsDir = '/js/highslide/graphics/';
hs.wrapperClassName = 'borderless';*/
});

function isValidEmailAddress(emailAddress) {
	var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
	return pattern.test(emailAddress);
}
