function openImagePopup( link )
{
	link = URL_prefix+"ImagePopup.aspx?imagetag=" + link;
	screenPozW=screen.width/2
	sereenPozH=screen.height/2
	var param = "Width=8px, Height=8px, left="+screenPozW+", top="+sereenPozH+", dependent=no, directories=no, fullscreen=no, location=no, menubar=no, resizable=no, scrollbars=no, status=yes, toolbar=no";	
	window.open(link, "slika", param);
}
function openPanoPopup( file, x, y )
{
	link = "Home.aspx?PageName=FlashPanoPopup&panoSRC=" + file + "&x=" + x + "&y=" + y;
	var param = "Width=" + x + "px, Height=" + y + "px, left=300, top=200, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no";
	var p = window.open(link, "panorama", param );
	p.focus();
}

function otvoriProzor(mylink, sirina, visina) { 
	window.open(mylink,'','toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=' + sirina + ',height=' + visina ); 	
}

function fotoOpen(mylink, name, w, h)
{
  wleft = (screen.width - w) / 2;
  wtop = (screen.height - h) / 2;
  var win = window.open(mylink, name,
    'width=' + w + ', height=' + h + ', ' +
    'left=' + wleft + ', top=' + wtop + ', ' +
    'location=no, menubar=no, ' +
    'status=no, toolbar=no, scrollbars=no, resizable=no');
  // Just in case left and top are ignored
  win.moveTo(wleft, wtop);
  win.focus();
}

function ShowHide(pID,pStatus)
{   
    document.getElementById(pID).style.visibility = pStatus;
}

function ShowFotoGaleryZoom(pID, pNaziv, pPozition, pUK)
{
   // preload  
   var newimage = new Image(); 
   newimage.src = "docs/maistra2008HR/FotoGalerija/"+pID+"/Original.jpg";            
   // prikaži      
   document.getElementById("FotoZoomImg").src = newimage.src;        
   document.getElementById("FotoZoomImg").alt = pNaziv;   
   //document.getElementById("FotoZoomTitle").innerHTML = pNaziv;   
   for (var i = 1; i < pUK; i++)
   {
    document.getElementById("position_"+i).style.display = "none";   
   }
   document.getElementById("position_"+pPozition).style.display = "block";

}

function ShowFotoGaleryZoomPress(pID, pNaziv, pPozition, pUK) {
    // preload  
    var newimage = new Image();
    newimage.src = "../docs/maistra2008HR/pressslike/" + pID + "/Original.jpg";
    // prikaži      
    document.getElementById("FotoZoomImg").src = newimage.src;
    document.getElementById("FotoZoomImg").alt = pNaziv;
    //document.getElementById("FotoZoomTitle").innerHTML = pNaziv;   
    for (var i = 1; i < pUK; i++) {
        document.getElementById("position_" + i).style.display = "none";
    }
    document.getElementById("position_" + pPozition).style.display = "block";
}

function newPopup(URL, WIDTH, HEIGHT) {
	properties = "left=50,top=50,width=" + (WIDTH) + ",height=" + (HEIGHT);
	text = "<html><body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'><a href='javascript:window.close();'><img src='" + URL + "' border='0'></a></body></html>";
	preview = window.open("", "preview", properties);
	preview.document.open();
	preview.document.write(text);
}

function otvori_prozor(stranica, sirina, visina) { 
	window.open("home.aspx?PageID="+stranica,'','toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=' + sirina + ',height=' + visina ); 
}

function BookFromTekst(pType, pParams)
{    
    var nowLocation = "";   
    
    if(pType == "Green")    
       nowLocation  = URL_prefix + "Home.aspx?PageName=CampBooking"
    else
       nowLocation = URL_prefix + "Home.aspx?PageName=HotelBooking"
    
    if(pParams != "") nowLocation = nowLocation + "&" + pParams;
    window.location = nowLocation;
}
//
function addOverState(id) {
	if ( !document.getElementById(id) ) return false;

	var arrLi = document.getElementById(id).getElementsByTagName("LI");
	for (var i=0; i<arrLi.length; i++) {
		arrLi[i].onmouseover=function() {
			if( this.className != 'exli' )
				this.className +="over";			
		}
		arrLi[i].onmouseout=function() {
			if( this.className != 'exli' )
				this.className="";
		}
	}
}
function print_content(pType)
{
	window.open(URL_prefix+"Print.aspx?Type="+pType,'mweb_print','top=100,left=100,width=524,height=600,scrollbars=1,toolbar=1,menubar=1');
}

function goKalendardogadjanja(str, box, qsName){    
	var destination = URL_prefix + str + "&" + qsName + "=" + box.options[box.selectedIndex].value;		
	if (destination) location.href = destination;
}

function setBorderToFlash()
{
	/* ne koristi se više od kada su flash datoteke pozvane sa Js skriptom AC_RunActiveContent.js
	
	theObjects = document.getElementsByTagName("object");
	for (var i = 0; i < theObjects.length; i++)
	{
		theObjects[i].outerHTML = theObjects[i].outerHTML;				
	}*/	
}

function calendar( formid ) 
{
	var val = document.getElementById( formid ).value;		
	var prozor = window.open(URL_prefix+"Calendar.aspx?formid=" + formid + "&val=" + val, "win", "Width=320px, Height=240px, left=400, top=300, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no", true); 
	prozor.focus();
}

function switchIntroAnimImg() 
{        
   // preload
   newimage[n] = new Image(); 
   //newimage[n].src = "docs/maistra2008HR/pictures/"+src[n]+"/original.jpg"; 
   newimage[n].src = src[n]; 
   
   // prikaži
   //document.getElementById("introAnim").src = "docs/maistra2008HR/pictures/"+src[n]+"/original.jpg";        
   document.getElementById("introAnim").src = src[n];  
   document.getElementById("introAnim").alt = srcTekst[n];    
   document.getElementById("introAnimLink").title = srcTekst[n];  
   
   if(srcLink[n]=='')               
   {
        document.getElementById("introAnimLink").href="javascript:void(0);";        
        document.getElementById("introAnimLink").style.cursor = "default"; 
        document.getElementById("introAnimLink").attributes['onclick'].value = "";
        document.getElementById("textIntroAnim").innerHTML = srcTekst[n];
        document.getElementById("textIntroAnim").style.cursor = "default";
   }
   else 
   {  
        document.getElementById("introAnimLink").href = srcLink[n];  
        document.getElementById("introAnimLink").style.cursor = "pointer"; 
        document.getElementById("introAnimLink").attributes['onclick'].value = tracker[n];
        document.getElementById("textIntroAnim").innerHTML = "<a id='aTextIntroAnim' href='"+srcLink[n]+"' title='"+srcTekst[n]+"' onclick=''>"+srcTekst[n]+"</a>";
        document.getElementById("aTextIntroAnim").attributes['onclick'].value = tracker[n];
   }   
   //alert(document.getElementById("divIntroAnim").innerHTML);         
   //alert(document.getElementById("textIntroAnim").innerHTML);         
   
   n=n+1;   
   if (n==uk) n=0;        
   setTimeout("switchIntroAnimImg()",duration*1000);        
}

/* on load */
window.onload=function()
{	
	if(document.all) addOverState("menu");	
	
	/* ne koristi se više od kada su flash datoteke pozvane sa Js skriptom AC_RunActiveContent.js
	setBorderToFlash()
	*/
	
}

function fixPNG(myImage) 
{
    var arVersion = navigator.appVersion.split("MSIE")
    var version = parseFloat(arVersion[1])
    
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='crop');\"></span>"
	   myImage.outerHTML = strNewHTML	  
    }
}

/* Poruka kod Booking IFRAME */
function ShowHideMessage(pDiv)
{
    document.getElementById(pDiv).style.display = "none";
}	


function divFlip(div_name, button_name)
{
	var i=document.getElementById(div_name);	
	var j=document.getElementById(button_name);	
	if(i.style.display!='block') 
	{
		i.style.display='block';						
		j.value = document.getElementById("txtZatvori").value;
	}
	else
	{ 
		i.style.display='none';			
		j.value = document.getElementById("txtOtvori").value;		
	}		
}


/******************** Acessibility option **************/
var textsize = 12;
var lineHeight = 16;

function SetirajVelicinuFonta()
{
    if (readCookie("TextFontSize") != null && readCookie("TextLineHeight") != null)
    {   
        textsize = readCookie("TextFontSize");
        lineHeight = readCookie("TextLineHeight");
        
        /*alert("ucitavanje postavki");
        alert("textsize: " + textsize);
        alert("lineHeight: " + lineHeight);        */
        
        fsize(textsize,lineHeight,'px','text',false);         
    }
}

function fsize(size,line,unit,id,postaviCookie)
{  
    var vfontsize = document.getElementById(id);  
    if(vfontsize && (size < 19) && (size > 11) ) 
    {
        vfontsize.style.fontSize = size + unit;         
        vfontsize.style.lineHeight = line + unit; 
        
        // zapisivanje vrijednosti u cookie
        if(postaviCookie)
        {
            if(readCookie("TextFontSize")==null && readCookie("TextLineHeight") == null)
            {
	            createCookie("TextFontSize",size,180);	    
	            createCookie("TextLineHeight",line,180);
            }
            else
            {
                eraseCookie("TextFontSize");
                eraseCookie("TextLineHeight");
                
                createCookie("TextFontSize",size,180);            
	            createCookie("TextLineHeight",line,180);
            }
            
           /* alert("nakon setiranja");
            alert("size: " + size);
            alert("line: " + line);*/
        }
        
    }
}

function changetextsize(up){         
    if(up)       
    {
        if (textsize < 18) 
        {
            textsize = parseFloat(textsize)+1;   
            lineHeight = parseFloat(lineHeight)+1;
        }
    }
    else  
    {
        if (textsize > 12) 
        {
            textsize =parseFloat(textsize)-1;  
            lineHeight = parseFloat(lineHeight)-1;
        }
    }      
}
/*******************************************/

/*********** Rad sa Cookie-ima *************/
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function createCookieMin(name,value,minutes) {
	if (minutes) {
		var date = new Date();
		date.setTime(date.getTime()+(minutes*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}


function eraseCookie(name) {
	createCookie(name,"",-1);
}
/**********************************************************/
