var url = location.href;
section = url.replace(/http:\/\/([^/]+)\/([^/]+)\/?(.*)/,'$2');

if (section != url){
	mainImgName = section;
}
else {
	mainImgName = 'main';
}

if (section == "photography"){
	var imgFolder = "/images/menu_small/";
}
else {
	var imgFolder = "/images/menu/";
}

var pageImgNum = 9
var timerId = null

function Swap(a) {
	clearTimeout(timerId);
	mainImg.src = imgFolder + a.id + '.jpg';
	a.style.backgroundImage = 'url(/images/dot-on.gif)';
}

function SwapOutImg() {
	mainImg.src = imgFolder + mainImgName + '.jpg';
}

function SwapOut(a) {
	a.style.backgroundImage = 'url(/images/dot.gif)';
	timerId = setTimeout('SwapOutImg()', '500')
}

function get(v) { v = document.getElementById(v); return v; }

window.onload = function() {
	var el = document.createElement("script");
	el.type = "text/javascript";
	el.src = "http://vkontakte.ru/js/api/openapi.js";
	el.async = true;
	document.getElementById('vk-root').appendChild(el);

	mainImg =document.getElementById("main-img");
	var wallpapers = document.getElementById("wallpapers");
	var notes = get('notes');
	var dreams = get('dreams');
	var about = get('about');
	var photography = get('photography');
	var links = get('links');
	var soul = get('soul');
	var music = get('music');
	var radio = get('music');
	wallpapers.onmouseover = function() {Swap(this);}
	wallpapers.onmouseout = function() {SwapOut(this);}
	notes.onmouseover = function() {Swap(this);}
	notes.onmouseout = function() {SwapOut(this);}
	dreams.onmouseover = function() {Swap(this);}
	dreams.onmouseout = function() {SwapOut(this);}
	about.onmouseover = function() {Swap(this);}
	about.onmouseout = function() {SwapOut(this);}
	photography.onmouseover = function() {Swap(this);}
	photography.onmouseout = function() {SwapOut(this);}
	links.onmouseover = function() {Swap(this);}
	links.onmouseout = function() {SwapOut(this);}
	soul.onmouseover = function() {Swap(this);}
	soul.onmouseout = function() {SwapOut(this);}
	music.onmouseover = function() {Swap(this);}
	music.onmouseout = function() {SwapOut(this);}

	$(".img-link").mouseover(function() {
		$(this).css('background-color','#333');
	});

	$(".img-link").mouseout(function() {
		$(this).css('background-color','#222');
	});
}
var allHTMLTags = new Array();


function moreWidgets() {
	$("#more-widgets").css("display","table");
}

function comments(type) {
	if (type == 'vk') {
		$("#facebook").css('display','none');
		$("#vk").css('display','block');
	}
	else {
		$("#facebook").css('display','block');
		$.getScript('http://connect.facebook.net/en_US/all.js', function() {
			FB.init({appId:'171549486200479',status:true,cookie:true,xfbml:true});

			$("#vk").css('display','none');
		});
	}
}



