	var $stripes = 1;
	var $brow = $.browser.name;
	var $browWidth = getW();
	var $browHeight = getH();
	//var $picwid = 1363;
	//var $pichei = 720;

	$.fn.pause = function (n) {
	    return this.queue(function () {
	    var el = this;
	    setTimeout(function () {
	        return $(el).dequeue();
	    }, n);
			});
		};
	
	function getW($div){
		var $localw;
		if ($brow == 'chrome') {
			$localw = $($div).innerWidth;
		} else {
			$localw = $(window).width();
		}
		return $localw;
	}

	function getH(){
		var $localh;
		if ($brow == 'chrome') {
			$localh = window.innerHeight;
		} else {
			$localh = $(window).height(true);
		}
		return $localh;
	}
	
	function bookmark($level, $id){
		if ($level == 0){
			window.location.hash = '';
			window.location.hash = "area="+$id;
		}
		if ($level == 1){
			var $allHash =  window.location.hash.split(",");
			if ($allHash.length > 1){
				$allHash[1] = ",subarea="+$id;
				$allHash[2] = "";
				window.location.hash = $allHash[0]+$allHash[1];
			} else {
				window.location.hash = window.location.hash + ",subarea="+$id;
			}
		}
		
		if ($level == 2){
			var $allHash =  window.location.hash.split(",");
			if ($allHash.length > 2){
				$allHash[2] = "article="+$id;
				window.location.hash = $allHash[0]+","+$allHash[1]+","+$allHash[2];
			} else {
				window.location.hash = window.location.hash + ",article="+$id;
			}
		}
		
	}
	
	function simulatedClick(target, options) {

        var event = target.ownerDocument.createEvent('MouseEvents'),
            options = options || {};

        //Set your default options to the right of ||
        var opts = {
            type: options.click                     || 'click',
            canBubble:options.canBubble             || true,
            cancelable:options.cancelable           || true,
            view:options.view                       || target.ownerDocument.defaultView, 
            detail:options.detail                   || 1,
            screenX:options.screenX                 || 0, //The coordinates within the entire page
            screenY:options.screenY                 || 0,
            clientX:options.clientX                 || 0, //The coordinates within the viewport
            clientY:options.clientY                 || 0,
            ctrlKey:options.ctrlKey                 || false,
            altKey:options.altKey                   || false,
            shiftKey:options.shiftKey               || false,
            metaKey:options.metaKey                 || false, //I *think* 'meta' is 'Cmd/Apple' on Mac, and 'Windows key' on Win. Not sure, though!
            button:options.button                   || 0, //0 = left, 1 = middle, 2 = right
            relatedTarget:options.relatedTarget     || null
        };

        //Pass in the options
        event.initMouseEvent(
            opts.type,
            opts.canBubble,
            opts.cancelable,
            opts.view, 
            opts.detail,
            opts.screenX,
            opts.screenY,
            opts.clientX,
            opts.clientY,
            opts.ctrlKey,
            opts.altKey,
            opts.shiftKey,
            opts.metaKey,
            opts.button,
            opts.relatedTarget
        );

        //Fire the event
        target.dispatchEvent(event);
    }

	function setDiv($div){
		$d = $($div);
		var $b = $('body');
		$b.hide();
		$d.hide();
		var $width = getW();
		var $height = getH();
		$d.css({'width': $width, 'height': $height - 90, 'overflow': 'hidden', 'position': 'absolute'});
		$b.show();
		$d.show();
	}

	function setBack($div, $pic){
		var $divH = $($div).height();
		var $divW = $($div).width();
		var $picH = $pic.height();
		var $picW = $pic.width();
		var $divKoef = $divH/$divW;
		var $picKoef = $picH/$picW;
		var $dimensions = new Array(4);
		if ($divKoef < $picKoef){
			$koef = $divW/$picW;
			var $hp = $koef * $picH;
			var $ptop = $divH - $hp;
			$dimensions[0] = 0;
			$dimensions[1] = $ptop;
			$dimensions[2] = $divW;
			$dimensions[3] = $hp;
		} else {
			$koef = $divH/$picH;
			$wp = $divKoef * $picW;
			$pleft = ($divW/2) - ($picW/2);
			$dimensions[0] = $pleft;
			$dimensions[1] = 0;
			$dimensions[2] = $wp;
			$dimensions[3] = $divH;
		}
		$($pic).css({'left': $dimensions[0], 'top': $dimensions[1], 'width': $dimensions[2], 'height': $dimensions[3]});
	}

	function setHashParams() {
	    var hashParams = {};
	    var e,
	        a = /\+/g,  // Regex for replacing addition symbol with a space
	        r = /([^&;=]+)=?([^&;]*)/g,
	        d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
	        q = window.location.hash.substring(1);
	        $allHash =  q.split(",");
	        for($one in $allHash){
	        	e = $allHash[$one].split("=");
	        	$("#"+e[1]).trigger("click");
	        }
	}
	
	function loop(){
		var $pause = 5000;
		var $current = $('.logos:visible');
		if ($current.length == 0) {
			$current = $('.logos:first');
			$pause = 0;
		}
		var $next = $('.logos:visible').next();
		if($next.length == 0){
			$next = $('.logos:first');
		}
		
		$q = $({});
		$q.pause($pause)
		.queue(
			function(){
					$current.fadeOut(500, function(){
						$next.fadeIn(500, function(){
								loop();
						})
				});
				$(this).dequeue();
			}
		);
	}
	
$(window).load(function() {	
	setDiv("#top");
	setBack("#top", $('#topPozadina'));
	loop();
});

$(window).bind("resize",function(){
	setDiv("#top");
	setBack("#top", $('#topPozadina'));
});
