function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

function hide ( obj ){
	$(obj).animate({
		opacity: 0.6
	}, 6000, "swing");

	$(obj).animate({
		opacity: 0
	}, 1000, "swing");

	$(obj).hide(1000, function () {
		$(this).remove();
	});
}

function hideFlash(){

	for (i = 0; i < 10; i++) {
		obj = document.getElementById('flashmessage'+i);
		if(obj != null){
			hide(obj);
		}
	}

}

function lbox() {
	setting = {
		overlayBgColor:'#000',
		overlayOpacity:0.8,
		fixedNavigation:false,
		imageLoading: '/images/lightbox-ico-loading.gif',
		imageBtnClose: '/images/lightbox-btn-close.gif',
		imageBtnPrev: '/images/lightbox-btn-prev.gif',
		imageBtnNext: '/images/lightbox-btn-next.gif',
		imageBlank: '/images/lightbox-blank.gif',
		containerBorderSize:10,
		containerResizeSpeed: 600,
		txtImage:'Image',
		txtOf:'of',
		keyToClose:'c',
		keyToPrev:'p',
		keyToNext:'n'
	};

	// Use this example, or...
	$('a[rel=lightbox]').lightBox(setting); // Select all links that contains lightbox in the attribute rel
	// This, or...
	$('#lbgallery a').lightBox(setting); // Select all links in object with gallery ID
	// This, or...
	$('a.lightbox').lightBox(setting); // Select all links with lightbox class
}

function redirect( url ){
	//$.get(url);
	window.location.href = url;
	return false;
}

addLoadEvent(hideFlash);
addLoadEvent(lbox);


$(document).ready(function() {
	$(this).bind('keypress', function(e) {

		var lightbox = document.getElementById('jquery-lightbox');

		if((lightbox == null) && (e.target.tagName == 'HTML')){

			// keyCode 39  ->
			// keyCode 37  <-

			var href = '';

			if(e.keyCode == 39){
				href = document.getElementById('nextarticlebutton').href;
			}

			if(e.keyCode == 37){
				href = document.getElementById('previousarticlebutton').href;
			}

			if(href != ''){
				if(href != null){
				//	$.get(href);
				window.location.href = href;
				return false;
				}
			}
					
		}

	});
});



/*

function ref(){
	$.get("http://ad.aumojekoule.cz/googlead.html", "", function(data){
		//alert(data);
		$("#googlead").html(data);
	});
	
	setTimeout("ref()", 10000);
}

$(document).ready(function() {
	ref();
	//var ad = $("#googlead").html();
	//ref(ad);
});

*/



