var intID = '';

rld = function(){
	document.location.href = document.location.href;
};

function setIntv(){
	if (intID != '') window.clearInterval(intID);
	intID = setInterval("rld()", 60000*1000);
}

//setIntv();
var limit_cur = 0;
var limits = {'down' : 10, 'up' : 14};

function updateFontSize(vector){

	var currentFontSizeNum = parseFloat(getStyle('content', 'font-size'), 10);
	
	if (vector == 'down' && limit_cur>limits[vector]) {
		limit_cur = limit_cur -1;
		var newFontSize = currentFontSizeNum-1;
		$_('content').style.fontSize = newFontSize+'px';
	} else if (vector == 'up' && limit_cur<limits[vector]){
		limit_cur = limit_cur+1;
		var newFontSize = currentFontSizeNum+1;
		$_('content').style.fontSize = newFontSize+'px';
	}
	return false;
}

function showLayer(e){

	if ($_('lyr_about')){

		var ev = window.event ? window.event : e;
		var cX = ev.clientX;
		var cY = ev.clientY;
		var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
		var alpha = 10;
			
		// make lightbox
		var el = elem('div', {'class' : 'loader-abs'});
		// for fucking IE add empty image
		var el_img = elem('img', {'src' : '/skin/img/share/0.gif'});
		el.appendChild(el_img);
		
		el.style.opacity = el.style["-khtml-opacity"] = el.style["-moz-opacity"] = alpha;
		if (/MSIE/.test(navigator.userAgent)) {
			el.style.filter = alpha === '' ? '' : "alpha(opacity=" + (alpha * 100) + ")";
			if (!el.currentStyle || !el.currentStyle.hasLayout)
				el.style.display = 'inline-block';
		}	
		
		var el_out = elem('div', {'class' : 'outer'}, {'left' : (cX - 100)+'px', 'top' : (scrollTop+cY+5)+'px'});
		var el_close = elem('div', {'class': 'close'}, false, portal.mess.close);
		
		// making new sub layer and attaching to it event
		portal.events.attach(el, "mousedown", function (evt){
			if (el){				
				el.parentNode.removeChild(el);
				el = null;
				el_out.parentNode.removeChild(el_out);
				el_out = null;
			}
		});
		portal.events.attach(el_close, "mousedown", function (evt){
			if (el){
				el.parentNode.removeChild(el);
				el = null;
				el_out.parentNode.removeChild(el_out);
				el_out = null;
			}
		});
		el_out.innerHTML = $_('lyr_about').innerHTML;
		el_out.appendChild(el_close);
		
		el.style.width = el_img.style.width = document.body.scrollWidth + 'px';
		el.style.height = el_img.style.height = document.body.scrollHeight + 'px';

		document.body.appendChild(el);

		document.body.appendChild(el);
		document.body.appendChild(el_out);
	}

}

/* function added phrase to the page */
function showPhrase(){

	if (oPhrases != undefined && $_('phCont') != undefined){
		var elem_id = Math.floor(Math.random()*oPhrases.length);
		
		$_('phCont').innerHTML = oPhrases[elem_id].title+'<img src="/skin/img/h_quote_end.gif" /><div>'+oPhrases[elem_id].author+'</div>';
		
	}
}

/* specified function for bclub */
function langDrop(dropid) {
	if (typeof(dropid) == "undefined" || typeof(dropid) == "null")
		dropid = 'langDrop';
		
	if ($_(dropid).className == '') {
		$_(dropid).className = 'show';
	} else {
		$_(dropid).className = ''; 
	}
}


portal.ready(function (){
	if ($_('smallerfont'))
		portal.events.attach($_('smallerfont'), 'click', function (e){return updateFontSize('down')});
	if ($_('largerfont'))
		portal.events.attach($_('largerfont'), 'click', function (e){return updateFontSize('up')});
	if ($_('content'))
		limit_cur = parseFloat(getStyle('content', 'font-size'), 10);
	$('.b-promo').css('height' , $(document).height()+'px');
		
	});


