sfHover = function() {
		var isIE = !window.opera && navigator.userAgent.indexOf('MSIE') != -1;
		if(!isIE) return;
		if(!document.getElementById("info-menu")) return;
		var sfEls = document.getElementById("info-menu").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}

catHover = function() {
		var isIE = !window.opera && navigator.userAgent.indexOf('MSIE') != -1;
		if(!isIE) return;
		if(!document.getElementById("catalog-menu")) return;
		var sfEls = document.getElementById("catalog-menu").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}

var NewWin = {
	init: function() {
		var arrA = document.getElementsByTagName('a');
		for( var i=0; i<arrA.length; i++ ) {
			if(arrA[i].className=='newWin') arrA[i].onclick = function() { 
				window.open(this, ''); 
				return false;
			}
		}
	}
};

/**
 * Class: Marquee
 *
 * Element on page with ID 'marquee' becomes vertical marquee box.
 * 
 * @access    public
 * @author    Ivan Maros
 * @package   Medianet.Rochi.JSONLibrary
 * @since     22.10.2006
 * @todo      Should make all elements with className="verticalMarquee" a marquee.
 * @var       int slideSpeed Speed of slide in miliseconds.
 * @var       real numScreensOnEnd When all text passes, how many screens to delay.
 * @version   0.9a
 */
var Marquee = {
	slideSpeed: 30,
	numScreensOnEnd: 1, // Can be any number >= 1
	
	outerDiv: null,
	innerDiv: null,
	outerDivSize: null, // Can be 'width' or 'height'
	innerDivSize: null, // Can be 'width' or 'height'
	scrollPos: 0,
	timeoutHandler: null,

	init: function() {
		if(!document.getElementById || !document.getElementById('marquee')) return;
		
		Marquee.buildMarqueeText();
		Marquee.setDivsSize();
		Marquee.startSlide();
	},
	
	buildMarqueeText: function() {
		Marquee.outerDiv = document.getElementById('marquee');
		Marquee.innerDiv = document.createElement('div');
		Marquee.innerDiv.style.backgroundColor = 'transparent'; // For succesfull pausing method
		Marquee.innerDiv.onmouseover = Marquee.pauseSlide;
		Marquee.innerDiv.onmouseout = Marquee.startSlide;
		Marquee.innerDiv.innerHTML = (Marquee.outerDiv.innerHTML); // Move text from outer to inner div
		while(Marquee.outerDiv.firstChild) Marquee.outerDiv.removeChild(Marquee.outerDiv.firstChild);
		Marquee.outerDiv.appendChild(Marquee.innerDiv);
	},
	
	setDivsSize: function() {
		Marquee.outerDivSize = Marquee.outerDiv.offsetHeight;
		Marquee.innerDivSize = Marquee.innerDiv.offsetHeight;
		Marquee.scrollPos = Marquee.outerDivSize;
		
		// alert("Visina vanjskog: "+ Marquee.outerDivSize +"\nVisina unutarnjeg: "+ Marquee.innerDivSize +"");
	},

	startSlide: function() {
		if( (Marquee.scrollPos)<=((Marquee.outerDivSize - Marquee.numScreensOnEnd*Marquee.outerDivSize) - Marquee.innerDivSize) ) {
			Marquee.scrollPos = Marquee.outerDivSize;
		}
		
		Marquee.innerDiv.style.marginTop = Marquee.scrollPos +'px';
		// Marquee.innerDiv.style.marginLeft = Marquee.scrollPos +'px';
		Marquee.scrollPos--;
		
		Marquee.timeoutHandler = setTimeout( Marquee.startSlide, Marquee.slideSpeed );
	}, 
	
	pauseSlide: function() {
		clearTimeout(Marquee.timeoutHandler);
	}
	
}

var facHover = function() {
		var isIE = !window.opera && navigator.userAgent.indexOf('MSIE') != -1;
		if(!isIE) return;
		if(!document.getElementById("vrste-skola")) return;
		var sfEls = document.getElementById("vrste-skola").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" fachover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" fachover\\b"), "");
			}
		}
	}
	
function newWin(url) {
	window.open(url, '_blank');
	return false;
}

function mOpen(image_url, width, height) {
	var ajmo = window.open(image_url, 'popup_win', 'width='+width+',height='+height+',top='+(screen.height/2-(height/2))+',left='+(screen.width/2-(width/2)));
	ajmo.document.write('<html>\n<head>\n<title>Preview</title>\n</head>\n');
	ajmo.document.write('<body marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 onBlur="window.close()">\n<img src="'+image_url+'" width='+width+' height'+height+' border=0>\n</body>\n');
	ajmo.document.write('</html>\n');
	ajmo.document.close();
}

// Otvara sliku u popup-u veličine slike
function showPopup(path, width, height) {
	var ajmo = window.open('', 'banner_preview', 'width='+width+',height='+height+',top='+(screen.height/2-(height/2))+',left='+(screen.width/2-(width/2)));
	ajmo.document.write('<html>\n<head>\n<title>Preview</title>\n</head>\n');
	ajmo.document.write('<body marginwidth=0 marginheight=0 topmargin=0 leftmargin=0 onblur="window.close()">\n');

	if( path.substring( (path.length-3),path.length )=='swf' ) {
		ajmo.document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH='+width+' HEIGHT='+height+'><PARAM NAME=movie VALUE="'+path+'"> <PARAM NAME=quality VALUE=high> <EMBED src="'+path+'" quality=high WIDTH='+width+' HEIGHT='+height+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=Shockwav eFlash"></EMBED> </OBJECT>');
	} else {
		ajmo.document.write('<img src="'+path+'" width='+width+' height='+height+' border=0>');
	}

	ajmo.document.write('</body>\n');
	ajmo.document.write('</html>\n');
	ajmo.document.close();

}


window.addEvent('domready', function() {
	if($('uname') && $('pwd')) {
		if($('uname').getValue()=='') {
			$('uname').focus();
		} else {
			$('pwd').focus();
		}
	}
});

window.addEvent('domready', sfHover);
window.addEvent('domready', catHover);
window.addEvent('domready', facHover);
window.addEvent('domready', NewWin.init);
window.addEvent('domready', Marquee.init);
