// JavaScript Document.

function target_blank() { // Функция делает все ссылки на сайте, rel которых равен target_blank, открываемыми в новом окне (target="blank" не проходит валидацию).
	if (!document.getElementsByTagName) return
	
	var anchors = document.getElementsByTagName("a")
	
	for (var i = 0; i < anchors.length; i++) {
		if (anchors[i].getAttribute("href") && anchors[i].getAttribute("rel") == "target_blank") {
			anchors[i].target = "_blank"
		}
	}
}


function go_to_url(url) { // Открывает ссылку.
	window.location = url
}

function go_to_url_blank(url) { // Открывает ссылку в новом окне.
	window.open(url)
}

$(document).ready(function(){
	target_blank();
	project_show_speed = 0;
	
	$("#mask").css("display", "block");
	$("#mask").fadeOut(project_show_speed);
	
	$("a.smooth").click(function(event){
		event.preventDefault();
		linkLocation = this.href;
		$("#mask").fadeIn(project_show_speed, redirectPage);
	});
	
	$(".button_block").click(function(event){
		event.preventDefault();
		linkLocation = url;
		$("#mask").fadeIn(project_show_speed, redirectPage);
	});
	
	function redirectPage() {
		if (navigator.userAgent.indexOf('Opera') != -1 ) $("#mask").css("display", "none");
		window.location = linkLocation;
	}
	
	/*$(".button_block").mouseover(function(){
		this.style.backgroundColor = "white";
		this.style.color = "white";
	});
	
	$(".button_block").mouseout(function(){
		this.style.backgroundColor = "transparent";
		this.style.color = "black";
	});*/
});

