var Refresh = false

function removeOverlay()
{
	_holder = document.getElementById("flashoverlay")
	_holder.innerHTML = ""
	_holder.style.display ="none"
	if(Refresh){location.reload()}
	//location.reload()
}
function fm_setHeight(fH)
{
	var wH = $(window).height();
	var bH = $(document).height();
	
	$('#file_manager').height(0);
	
	if(bH>wH && bH>fH){
		$('#flash1').height(bH);
	} else if(bH<=wH && fH<wH){
		$('#flash1').height(wH);	
	} else {
		$('#flash1').height(fH);
	}
}


function getDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}
/* izbornik */
function menuInit(){
	var speed = 150
	$('div#header div#meni ul li.level-0').children('ul').fadeTo(0 , 0.95);
	$('div#header div#meni ul li.level-0').mouseenter(function(){
		//$(this).addClass('show-ul');
		
		$(this).children('ul').not(':animated').slideDown(speed)
	}).mouseleave(function(){
		if($(this).children('ul'))
		
		$(this).children('ul').slideUp(speed)
	})
}
/* search */
function searchInit(hint_str)
{
	$(document).ready(function(){
		if($('#search_field').val()==""){$('#search_field').val(hint_str) ; $('#search_field').css( "color" , 'rgb(150,150,150)' )}
		$('#search_field').focus( function(){
			if($(this).val()==hint_str){ $(this).val("") ; $(this).css("color" , 'rgb(0,0,0)') }
		})
		$('#search_field').blur( function(){
			if($(this).val()==""){ $(this).val(hint_str) ; $(this).css("color" , 'rgb(150,150,150)' )}
		})
	});
}
/* current location*/
function currentLocation()
{
	return location.href
}
/* send link flash forma */
function sendLink(LANGUAGEID)
{
	str='<div id="flash1"></div>';
	_holder = document.getElementById("flashoverlay");
	_holder.innerHTML = str;
	_holder.style.display ="block";
	var H = getDocHeight()
	var flashvars = {};
	flashvars.langid = LANGUAGEID
	var params = {};
	params.allowscriptaccess = "always";
	params.wmode = "transparent";
	var attributes = {};
	attributes.id = "flash1";
	_holder.style.height = H + "px"
	swfobject.embedSWF("flash/forma.swf", "flash1" , "100%", "100%" , "9.0.0", "flash/expressInstall.swf", flashvars, params, attributes);	
}
/* anketa */
function vote(id , langid)
{
	var odg = $("input[@name='anketa']:checked").val()
	$.get("include/ankete.asp", { pollid:id, answer:odg , action:"vote" , LanguageID:langid} , function(data){
    	$('#anketa').fadeOut('fast' , function(){ $('#anketa').html(data).fadeIn('fast') } )
  	});
}
function results(id , langid)
{
	$.get("include/ankete.asp", { pollid:id, action:"results" , LanguageID:langid } , function(data){
    	$('#anketa').fadeOut('fast' , function(){ $('#anketa').html(data).fadeIn('fast') } )
  	});
}
/* Panorama */
/*
function showPanorama(url)
{
	var panorama = "<div id=\"panorama-holder\"><div id=\"panoramaHead\"><a href=\"javascript:closePanorama()\">close [x]</a></div><div id=\"panorama\"></div></div>"

	_holder = document.getElementById("flashoverlay")
	_holder.innerHTML = panorama
	//_holder.style.display ="block"
	var h
	var bh = $('body').height()
	var wh = $(window).height()
	if(wh>bh){h=wh}else{h=bh}
	
	 var flashvars = {};

     var params = {};
  	 params.allowscriptaccess = "always";
	 params.allowfullscreen = "true";
     params.wmode = "opaque";
     var attributes = {};
   	 attributes.id = "panorama";
     swfobject.embedSWF(url, "panorama", "640", "480" , "9.0.0", "flash/expressInstall.swf", flashvars, params, attributes);
	 
	// overlay
	$(document.body).prepend('<div class="modalOverLay"></div>');
    $('.modalOverLay').css({ opacity: 0.8, width: '100%', height: h+'px' });
    
	$('.modalOverLay').fadeIn('slow' , function (){
												
		$('#flashoverlay').fadeIn(500);
	});
}
function showPanoVideo(url)
{
	
}
function closePanorama()
{
	$('#flashoverlay').fadeOut(500);	
	$('.modalOverLay').fadeOut('slow' , function(){  $(this).remove() });
}*/
function scrollPos()
{
	var scrollPos = $(window).height()/2 + $(window).scrollTop()
	return scrollPos
}
/* tablice */
$(document).ready( function() {
	$('table tr:even').addClass('even'); 
	$('table tr:odd').addClass('odd'); 
})
