/* jquery funkcije */
$(document).ready(function() { 
    //jCorners
    $('#wrap').corners("70px bottom-left");
	//jFancybox
	$("a.fancybox").fancybox({ 
        'zoomOpacity' : false,
        'overlayShow' : true,
		'overlayOpacity' : 0.8,
        'hideOnContentClick': false,
        'frameWidth': 425,  
        'frameHeight': 355,
        'callbackOnClose': function() { $("#fancy_content").empty();} 
    });

}); 


/* on load */
window.onload=function()
{	
	if(document.all) addOverState("menu");	
}

/********* STANDARDNE FUNKCIJE **************/
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 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 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()
{
	window.open(URL_prefix+"Print.aspx",'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 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();
}

