// JavaScript Document

var ids=new Array();
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_CheckFlashVersion(reqVerStr,msg){
  with(navigator){
    var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
    var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
    if (!isIE || !isWin){  
      var flashVer = -1;
      if (plugins && plugins.length > 0){
        var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
        desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
        if (desc == "") flashVer = -1;
        else{
          var descArr = desc.split(" ");
          var tempArrMajor = descArr[2].split(".");
          var verMajor = tempArrMajor[0];
          var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
          var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
          flashVer =  parseFloat(verMajor + "." + verMinor);
        }
      }
      // WebTV has Flash Player 4 or lower -- too low for video
      else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;

      var verArr = reqVerStr.split(",");
      var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
  
      if (flashVer < reqVer){
        if (confirm(msg))
          window.location = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
      }
    }
  } 
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
} 
	
 

function switchid(id){	
	hideallids();
	showdiv(id);
}
function switchidx(id){	
	hideallidsx();
	showdiv(id);
}
function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}		  
}
function hideallidsx(){
	//loop through the array and hide each element by id
	for (var i=0;i<idsx.length;i++){
		hidediv(idsx[i]);
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}
function clear_div(){
	hideallids();
	}
	
function fill_div(id){
	animatedcollapse.show(id)
	
	}
	
		function startLytebox(href, title, rel) {
				var el   = document.getElementById('lytebox_misc');
				el.href  = href;
				el.title = title;
				el.rel	 = rel;
				
				myLytebox.start(el);
			}
			
			var theme = '';
			var slide = false;
			var nav = 1;
			var border = false;
			
			function changeTheme(arg) {
				theme = arg;
				restartLytebox('Lytebox is now using the "' + theme + '" theme!');
			}
			
			function changeNav(arg) {
				nav = (arg == "1" ? 1 : 2);
				restartLytebox('Lytebox is now using the "' + (nav == 1 ? 'top' : 'bottom') + '" navigation!');
			}
			
			function changeSlide(arg) {
				slide = (arg == "true" ? true : false);
				restartLytebox('Lytebox "Prev/Next" navigation ' + (slide ? 'enabled' : 'disabled') + ' for the slideshow!');
			}
			
			function showBorder(arg) {
				border = arg;
				restartLytebox('Lytebox is now using a border: "' + border + '"!');
			}
			
			function restartLytebox(sWhat) {				
				// Update configuration in the parent window Lytebox object			
				myLytebox = null;
				myLytebox = new LyteBox(theme, nav, slide, border);
				
				// Update configuration in the iframe window Lytebox object.
				frames['read'].myLytebox = null;
				frames['read'].myLytebox = new frames['read'].LyteBox(theme, nav, slide, border);
			}

function SWFDelegate(url,width,height,caption) {
 
 var objLink = document.createElement('a');
   objLink.setAttribute('href',url);
   objLink.setAttribute('rel','lytebox');
   objLink.setAttribute('title',caption);
  		//	alert( objLink.getAttribute('href'));	 
				
				myLytebox.start(objLink);
}
 
 function SWFDelegate2(url,width,height,caption) {
 
 var objLink = document.createElement('a');
   objLink.setAttribute('href',url);
   objLink.setAttribute('rel','lyteframe');
   objLink.setAttribute('title',caption);
  			alert( objLink.getAttribute('href'));	 
				
				myLytebox.start(objLink);
}
 
function restartLytebox(sWhat) {				
				// Update configuration in the parent window Lytebox object			
				myLytebox = null;
				myLytebox = new LyteBox(theme, nav, slide, border);
				
				// Update configuration in the iframe window Lytebox object.
				frames['read'].myLytebox = null;
				frames['read'].myLytebox = new frames['read'].LyteBox(theme, nav, slide, border);
			}
			



var movieName = "gsbTest";
var movieNamex = "gsbTestx";
function thisMovie(movieName) {
  if(navigator.appName.indexOf ("Microsoft") !=-1) return window[movieName];
  else return document[movieName];
}

function movieIsLoaded (theMovie) {
  if(typeof(theMovie) != "undefined") return theMovie.PercentLoaded() == 100;
  else return false;
}

function getSwishField(name) {
  if(movieIsLoaded(thisMovie(movieName)))
    return thisMovie(movieName).GetVariable("/:"+name);
}

function setSwishField(name, value) {
  if(movieIsLoaded(thisMovie(movieName)))
    thisMovie(movieName).SetVariable("/:"+name,value);
}

function getFromSwish() {
 	document.theonlyForm.htmlField.value=getSwishField("swishField");
}

function setIntoSwish() {
 	setSwishField("swishField",document.theonlyForm.htmlField.value);
}
function SwishGoTo(label) {
  if(movieIsLoaded(thisMovie(movieName)))
    thisMovie(movieName).TCallFrame( "/", 100 );
}
function EmbedFlash(movie, id, flashvars, width, height) {
 html  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
 html += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"';
 html += ' id="' + id + '" width="' + width + '" height="' + height + '">';
 html += '<param name="movie" value="' + movie + '">';
 html += '<param name="bgcolor" value="#FFFFFF">';
 html += '<param name="quality" value="high">';
 html += '<param name="loop" value="false">';
 html += '<param name="flashvars" value="'+ flashvars + '">';
 html += '<param name="menu" value="false">';
 html += '<param name="wmode" value="transparent">';
 html += '<param name="allowscriptaccess" value="samedomain">';
 if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) {
   html += '<embed name="' + id + '" src="' + movie + '"';
   html += 'quality="high" bgcolor="#FFFFFF" menu="false" swLiveConnect="true" allowScriptAccess="sameDomain"';
   html += 'width="' + width + '" height="' + height + '" wmode="transparent"';
   html += 'type="application/x-shockwave-flash"';
   html += 'flashvars="' + flashvars + '"';
   html += 'pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>'; 
 }
 html += '</object>';
 return html;
}
function createRichText(name, flashvars, width, height) {
 document.writeln( EmbedFlash('images/nove/header0.swf', name, 'width=' + width + '&' + 'height=' + height + '&' + flashvars, width, height));
}
function flash_slika(name, flashvars, width, height) {
 document.writeln( EmbedFlash('data/slika_i.swf', name, 'width=' + width + '&' + 'height=' + height + '&' + flashvars, width, height));
}
function maliprozor(url){
var rndURL = (1000*Math.random());
w=800;
h=600;
newWindow = window.open(url,'','width='+w+',height='+h+',top='+(screen.height-h)/2+',left='+(screen.width-w)/2+',location=0,directories=0,status=no,menuBar=no,scrollBars=YES');
newWindow.focus(); 
}

	
	
function potvrda(pitanje,url) {
//	alert(url);
	var answer = confirm(pitanje)
	if (answer){
	 
		window.location =url; 
	}
	else{
		 
	}
}
	function changeBg(img){
       
   document.getElementsByTagName('body')[0].style.background='url('+img+')'; 
   
  // document.getElementsByTagName('body')[0].style.backgroundAttachment='fixed'; 
   document.getElementById('ibg').value=img;
    }
	    function changeSkin(skin){
       
   document.getElementById('css1').href ='skins/'+skin+'/panonia.com.hr.css'; 
   document.getElementById('iskin').value=skin;
    }
	
	
	function test(){
$("#data").load("Scripts/loading.html");
  $("#lista2").load("Scripts/mysql_to_options.php?where_key=id&where_value="+$("#lista1").attr("value")); 
};

function test2(){
$("#data").load("Scripts/loading.html");
  $("#lista4").load("Scripts/mysql_to_options.php?what=ime,uid&where_key=status&where_value="+$("#lista3").attr("value")); 
};
function test3(){
$("#data").load("Scripts/loading.html");
   $("#lista5").load("Scripts/mysql_to_options.php?where_key=uid&where_value="+$("#lista4").attr("value")); 
};
function test4(){
$("#data").load("Scripts/loading.html");
   $("#lista7").load("Scripts/mysql_to_options.php?what="+$("#lista6").attr("value")); 
};

function polasci_load(){
$("#search-loading").load("Scripts/loading.html");
hidediv('search-results');

$("#search-results").load("Scripts/ajax_php_polasci_bk.php?p="+$("#p").attr("value")+"&o="+$("#o").attr("value")); 
};

function polasci_test_load(){
	showdiv('search-results');
$("#search-loading").load("Scripts/loading.html");
 var iframe = document.getElementById('search-results');

var url_string = "Scripts/polasci.php?p="+$("#p").attr("value")+"&o="+$("#o").attr("value");
iframe.src = url_string;


};
function rezervacija(a,b,c,d){
	 	$("#search-loading",top.document).load("Scripts/loading.html"); 
		//var iframe = document.getElementById('polje'); ; 
		
	 	showdiv('polje');
		parent.resizeCaller()
		//iframe.src = "Scripts/rezervacija.php?a="+a+"&b="+b+"&c="+c+"&d="+d;
	 //   $("#polje").load("Scripts/rezervacija.php?a="+a+"&b="+b+"&c="+c+"&d="+d); 
 
	
	};
	
function demo_karta(){
showdiv('karta-box');
$("#karta").load("Scripts/karta.html");	
	};
	
	
function del_gall(folder){
var yes = confirm("Zelite li obrisatu galeriju: "+ folder +" ?");
location.replace("?folder="+folder+"&gdelete=true");
} 
