//DOM Image Rollover II- Available at Dynamic Drive (http://www.dynamicdrive.com)

	// Make Variables----------------------
	var imgMouseOverHolder = new Array();
	var imgMouseDownHolder = new Array();
	//-------------------------------------

function preloader(imgTags){

	// Create Variables------------------
	var newmouseover, newmouseout, newmouseup, newmousedown, oldmouseover, oldmouseout, oldmouseup, oldmousedown
	//-----------------------------------
	
	// Get array length--------------
	var AL = imgMouseOverHolder.length + 1;
	//-------------------------------

	for (var i = 0; i < imgTags.length; i++) {

		if (imgTags[i].getAttribute('srcdown')||imgTags[i].getAttribute('srcover')) {
	
		newmouseover = null; newmouseout = null; newmouseup = null;	newmousedown = null; oldmouseover = null; oldmouseout = null; oldmouseup = null; oldmousedown = null

			// Store src Images------------------
			if (imgTags[i].getAttribute('srcover')) {imgMouseOverHolder[AL] = new Image(); imgMouseOverHolder[AL].src = imgTags[i].getAttribute('srcover');}
			if (imgTags[i].getAttribute('srcdown')) {imgMouseDownHolder[AL] = new Image(); imgMouseDownHolder[AL].src = imgTags[i].getAttribute('srcdown');}
			//-----------------------------------
			
			// Make backups----------------------
			if (imgTags[i].src) {imgTags[i].setAttribute("oldsrc", imgTags[i].src);}
			//-----------------------------------
				
			if (imgTags[i].getAttribute('srcover')) {
			
				// Make Mouse over--------------------
				if (imgTags[i].onmouseover) {imgTags[i].oldmouseover = imgTags[i].onmouseover; newmouseover = function (){this.src=this.getAttribute("srcover"); this.oldmouseover();}}
				else {newmouseover = function (){this.src=this.getAttribute("srcover");}}
				imgTags[i].onmouseover = newmouseover;
				//------------------------------------
			
				// Make Mouse out--------------------
				if (imgTags[i].onmouseout){imgTags[i].oldmouseout = imgTags[i].onmouseout; newmouseout = function (){this.src=this.getAttribute("oldsrc"); this.oldmouseout();}}
				else {newmouseout = function (){this.src=this.getAttribute("oldsrc");}}
				imgTags[i].onmouseout = newmouseout;
				//-----------------------------------
			}
			
			if (imgTags[i].getAttribute('srcdown')) {	
			
			// Make Mouse Down---------------------
			if (imgTags[i].onmousedown) {imgTags[i].oldmousedown = imgTags[i].onmousedown; newmousedown = function (){this.src=this.getAttribute("srcdown"); this.oldmousedown();}}
			else {newmousedown = function (){this.src=this.getAttribute("srcdown");}}
			imgTags[i].onmousedown = newmousedown;
			//-------------------------------------
			
				if (imgTags[i].getAttribute('srcover')) {
						
					// Make Mouse up-----------------------
					if (imgTags[i].onmouseup) {imgTags[i].oldmouseup = imgTags[i].onmouseup; newmouseup = function (){this.src=this.getAttribute("srcover"); this.oldmouseup();}}
					else {newmouseup = function (){this.src=this.getAttribute("srcover");}}
					imgTags[i].onmouseup = newmouseup;
					//-------------------------------------
				
				} else {
								
					//Make Mouse up-------------------------
					if (imgTags[i].onmouseup) {imgTags[i].oldmouseup = imgTags[i].onmouseup; newmouseup = function (){this.src=this.getAttribute("oldsrc"); this.oldmouseup();}}
					else {newmouseup = function (){this.src=this.getAttribute("oldsrc");}}
					imgTags[i].onmouseup = newmouseup;
					//-------------------------------------
					
					// Make Mouse out--------------------
					if (imgTags[i].onmouseout) {imgTags[i].oldmouseout = imgTags[i].onmouseout; newmouseout = function (){this.src=this.getAttribute("oldsrc"); this.oldmouseout();}}
					else {newmouseout = function (){this.src=this.getAttribute("oldsrc");}}
					imgTags[i].onmouseout = newmouseout;
					//-----------------------------------
				
				}
				
			}
		}
	}
}

function preloadimgsrc() {

	// Check to see if document element----
	if (!document.getElementById) return;
	//-------------------------------------
	
	// Declare variables--------------------
	var imgTags = document.getElementsByTagName('IMG'); 
	var imgTags2 = document.getElementsByTagName('INPUT');   // For image type submit buttons 
	//--------------------------------------
	
	// Preload Images-----------------------
	preloader(imgTags);
	preloader(imgTags2);  // For image type submit buttons 
	//--------------------------------------
}

if (window.addEventListener)
window.addEventListener("load", preloadimgsrc, false)
else if (window.attachEvent)
window.attachEvent("onload", preloadimgsrc)
else if (document.getElementById)
window.onload=preloadimgsrc

// PopUp Window
	// Avtorji
	function popupAuthors()
	{
	window.open ('avtorji.html', '', 'width=400,height=240,top=150,left=300,resizable=no,scrollbars=no,toolbar=no,menubar=no');
	}
	// Odlomek
	function popupOdlomek()
	{
	window.open ('prejsnje_knjige_knjigaurokov_odlomek.html', '', 'width=640,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Odlomek2
	function popupOdlomek2()
	{
	window.open ('prejsnje_knjige_kandelar2_odlomek1.html', '', 'width=640,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Odlomek3
	function popupOdlomek3()
	{
	window.open ('prejsnje_knjige_kandelar2_odlomek2.html', '', 'width=640,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Odlomek4
	function popupOdlomek4()
	{
	window.open ('prejsnje_knjige_kandelar2_odlomek3.html', '', 'width=640,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Odlomek5
	function popupOdlomek5()
	{
	window.open ('nove_knjige_nirulan_odlomek.html', '', 'width=640,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Lucija
	function popupLucija()
	{
	window.open ('vila_lucija.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Fand
	function popupFand()
	{
	window.open ('vila_fand.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Vila vetra
	function popupVetra()
	{
	window.open ('vila_vetra.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Megi
	function popupMegi()
	{
	window.open ('vila_megi.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Irnan
	function popupIrnan()
	{
	window.open ('vila_irnan.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Nina
	function popupNina()
	{
	window.open ('vila_nina.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Aimend
	function popupAimend()
	{
	window.open ('vila_aimend.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Almera
	function popupAlmera()
	{
	window.open ('vila_almera.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Zerjav
	function popupZerjav()
	{
	window.open ('vila_zerjav.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Klavdija
	function popupKlavdija()
	{
	window.open ('vila_klavdija.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Deirdre
	function popupDeirdre()
	{
	window.open ('vila_deirdre.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Argante
	function popupArgante()
	{
	window.open ('vila_argante.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Dia
	function popupDia()
	{
	window.open ('vila_dia.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Enid
	function popupEnid()
	{
	window.open ('vila_enid.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Esmeralda
	function popupEsmeralda()
	{
	window.open ('vila_esmeralda.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Vila Veselja
	function popupVeselja()
	{
	window.open ('vila_veselja.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Tana
	function popupTana()
	{
	window.open ('vila_tana.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Zvezda
	function popupZvezda()
	{
	window.open ('vila_zvezda.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Vila povezovanja
	function popupPovezovanja()
	{
	window.open ('vila_povezovanja.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Vodna vila
	function popupVodna()
	{
	window.open ('vila_vodna.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Aneta
	function popupAneta()
	{
	window.open ('vila_aneta.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Iza
	function popupIza()
	{
	window.open ('vila_iza.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Izolda
	function popupIzolda()
	{
	window.open ('vila_izolda.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Vila Sonca
	function popupSonca()
	{
	window.open ('vila_sonca.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	// Lila
	function popupLila()
	{
	window.open ('vila_lila.html', '', 'width=450,height=480,top=150,left=300,resizable=no,scrollbars=yes,toolbar=no,menubar=no');
	}
	
	var ver = navigator.appName;
	var num = parseInt(navigator.appVersion);
	var ie = "Microsoft Internet Explorer";
	if ((ver == ie)&&(num >= 4)){
		scrollBar = "yes";
		}
	else scrollBar = "auto";
	
	function popupSlika(imageName,imageDescription,imageWidth,imageHeight) {
		if (parseInt(imageWidth) > 640) {
			windowWidth = 640;
			scrollIndicator = "za ogled celotne slike premaknite drsnik <b>&raquo;</b>";
			}
		else if ((ver == ie)&&(num >= 4)) {
			windowWidth = parseInt(imageWidth) + 16;
			scrollIndicator = "&nbsp;";
			}
		else {
			windowWidth = parseInt(imageWidth);
			scrollIndicator = "&nbsp;";
			}
		windowHeight = parseInt(imageHeight) + 0;
		window.open("popup_slika.html","image","scrollbars=" +scrollBar+ ",top=50,width=" +windowWidth+ ", height=" +windowHeight+ ", allowresize=yes");
	}
	
	function popupSlikaNews(imageName,imageDescription,imageWidth,imageHeight) {
		if (parseInt(imageWidth) > 400) {
			windowWidth = 400;
			scrollIndicator = "za ogled celotne slike premaknite drsnik <b>&raquo;</b>";
			}
		else if ((ver == ie)&&(num >= 4)) {
			windowWidth = parseInt(imageWidth) + 16;
			scrollIndicator = "&nbsp;";
			}
		else {
			windowWidth = parseInt(imageWidth);
			scrollIndicator = "&nbsp;";
			}
		windowHeight = parseInt(imageHeight) + 0;
		window.open("popup_slika_news.php","image","scrollbars=" +scrollBar+ ",top=50,width=" +windowWidth+ ", height=" +windowHeight+ "");
	}
	



