/*
	Favorite
*/
	function getBrowserInfo() {
		var t,v = undefined;
		if (window.opera) t = 'Opera';
		else if (document.all) {
			t = 'IE';
			var nv = navigator.appVersion;
			var s = nv.indexOf('MSIE')+5;
			v = nv.substring(s,s+1);
		}
		else if (navigator.appName) t = 'Netscape';
		return {type:t,version:v};
	}
	function bookmark(a){
		var url = window.document.location;
		var title = window.document.title;
		var b = getBrowserInfo();
		if (b.type == 'IE' && 7 > b.version && b.version >= 4) window.external.AddFavorite(url,title);
		else if (b.type == 'IE' && b.version == 7) window.external.AddFavorite(url,title);
		else if (b.type == 'IE' && b.version == 8) window.external.AddFavorite(url,title);
		else if (b.type == 'Opera') {
			a.href = url;
			a.rel = "sidebar";
			a.title = url+','+title;
			return true;
		 }
		else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
		else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
		return false;
	}
/**/

// DOM Ready
$(document).ready(function(){
	/*
		IE6 popup
	*/
	if ( $.browser.msie && $.browser.version == 6){
		$("#main").hide();
		$("#close_caution").click(
			function(){
				$("#caution").remove();
				$("#main").show();
				return false;
			}
		);
	}
	else{
		$("#caution").remove();
	}
	/**/
	/*
		Head animation
	*/
	var change = null;
	var changeTimer = 3000;
	var i = 0;
	var is_first = true;
	var n = $("#visual_top_content li").size();
	function second_passed() {
		// First
		if (i == 0) {
			$("#visual_top_content li").eq(i).animate({opacity:1}, {duration: 900});
			$("#visual_top_content li").eq(i).css("z-index",100);
		}
		if (0 < i < n) {
			$("#visual_top_content li").eq(i-1).animate({opacity:0}, {duration: 600});
			$("#visual_top_content li").eq(i-1).css("z-index",10);
			$("#visual_top_content li").eq(i).animate({opacity:1}, {duration: 900});
			$("#visual_top_content li").eq(i).css("z-index",100);
		}
		// Last
		if (i == n) {
			i = 0;
			$("#visual_top_content li").eq(n).animate({opacity:0}, {duration: 600});
			$("#visual_top_content li").eq(n).css("z-index",10);
			$("#visual_top_content li").eq(0).animate({opacity:1}, {duration: 900});
			$("#visual_top_content li").eq(0).css("z-index",100);
		}
		i++;
	}
	setTimeout(second_passed, 100);
	change = setInterval(second_passed, changeTimer);
	/**/
});
