function showOneMore(containerId){
	$("#"+containerId+"  .borderSeparator:hidden:first").show();
}

function hideOneMore(containerId){
	$("#"+containerId+"  .borderSeparator:visible:last").hide();
}

function showLoginForm(){
	$("#loginFormContainer").slideToggle();
}

function getPosition(obj){
    var curleft = curtop = 0;
    var position = new Array();
    if (obj.offsetParent) {
        do {
    		curleft += obj.offsetLeft;
    		curtop += obj.offsetTop;
        } while (obj = obj.offsetParent);
        position['left'] = curleft;        
        position['top'] = curtop;     
        return position;
    }
}

function emailFriend (formId){
	var url = window.location;
	$.post(MAIN_URL+'scripts/emailFriend.php?ajax&url='+url,$("#"+formId).serialize(),  
         function(data){
            $("#emailFriendContentWindow .contentArea").empty().html(data); 
         }  
     );
}

function emailNewsletter (formId){
	var url = window.location;
	$.post(MAIN_URL+'preview/posaljiMail.php?ajax&url='+url,$("#"+formId).serialize(),  
         function(data){
            $("#emailFriendContentWindow .contentArea").empty().html(data); 
         }  
     );
}

function sendComment (formId){
	var url = window.location;
	$.post(MAIN_URL+'scripts/sendComment.php?ajax&url='+url,$("#"+formId).serialize(),  
         function(data){
         	if (data == '1') {
         		window.location.reload();
         	} else {
            	$("#sendCommentContentWindow .contentArea").empty().html(data); 
         	}
         } 
     );
}

function showTabs (id,containerId) {
    $('#'+containerId+' .tab_content_active').hide();        
    $('#'+containerId+' .tab').removeClass('tab_active');
    $("#"+id).addClass('tab_active');
    $("#"+id+"_content").show().addClass('tab_content_active');
}

var tickerIdentifier = 0;
function showTicker(id) 
{
	switch (id) {
		case '1' : var berza = '../flash/berze/belex.htm'; break;
		case '3' : var berza = '../flash/berze/montenegro.htm'; break;
		case '5' : var berza = '../flash/berze/banjaluka.htm'; break;
		default: var berza = '../flash/berze/belex.htm';
	}
	$('#ifrmBerza').attr('src', berza);
}

var tooltipTimeout = null;
function showTooltip(data,e) {

	if (tooltipTimeout) {
		clearTimeout(tooltipTimeout);
	}
	var leftOffset = $("#container").offset().left
	var topOffset = $("#container").offset().top
	$("#tooltipContainer").css({top:e.pageY+20+'px',left:e.pageX - leftOffset-80  +'px'});
	$("#tooltipContainer").html(data).show('fast');
	$("#tooltipContainer").hover(function(){
		clearTimeout(tooltipTimeout);
	},function () {
		tooltipTimeout = setTimeout('hideTooltip()',250);
	});
}


function hideTooltip() {
	$("#tooltipContainer").empty().hide('fast');
}


function bubbleTooltip() {
	alert('asdf')
	        var distance = 10;
            var time = 250;
            var hideDelay = 500;

            var hideDelayTimer = null;

            var beingShown = false;
            var shown = false;
            var info = $('.popup', this).css('opacity', 0);

            	if (hideDelayTimer) clearTimeout(hideDelayTimer);
                if (beingShown || shown) {
                    // don't trigger the animation again
                    return;
                } else {
                    // reset position of info box
                    beingShown = true;

                    info.css({
                        top: -90,
                        left: -33,
                        display: 'block'
                    }).animate({
                        top: '-=' + distance + 'px',
                        opacity: 1
                    }, time, 'swing', function() {
                        beingShown = false;
                        shown = true;
                    });
                }

                return false;
}
            
            /*.mouseout(function () {
                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                hideDelayTimer = setTimeout(function () {
                    hideDelayTimer = null;
                    info.animate({
                        top: '-=' + distance + 'px',
                        opacity: 0
                    }, time, 'swing', function () {
                        shown = false;
                        info.css('display', 'none');
                    });

                }, hideDelay);

                return false;
            });
        });
}*/
            
            
function setCookie(c_name,value,expiredays,path,domain,secure){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	var cookie_string = c_name+ "=" +escape(value);
	cookie_string += (expiredays==null) ? "" : ";expires="+exdate.toGMTString();
	if (path) {
        cookie_string += "; path=" + escape ( path );
	}
	if ( domain ) {
        cookie_string += "; domain=" + escape ( domain );
	}
	if ( secure ) {
        cookie_string += "; secure";
	}
	
	document.cookie=cookie_string;
}




function get_cookie ( cookie_name ) {
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}