

var xcontent='';
var old_content='';

  window.onload = function() {   

      $('navx').style.visibility='visible';  
     
    var ax=window.setInterval(center,5);
    
   new Effect.Opacity('a1', { from: 1, to: 0.3 });
new Effect.Opacity('a2', { from: 1, to: 0.3 });
new Effect.Opacity('a3', { from: 1, to: 0.3 });

    setTimeout(_after,1000);  
    //center();  
}  



  function _after(){ 
   new Effect.Opacity('div_center', { from: 0, to: 1, duration: 0.5 });   
  };
  
   //  window.onresize=function(){
         
    //   center();  
   //  }
  
function center(){ 
    _h=getWindowSize()[1];
    _h1=$('HomePage').scrollHeight;
    _top=(_h-_h1)/2;
     //_top=_top-80;
    if (_top<10)
        _top=10;
//if ($('HomePage').style.top != _top) 
      $('HomePage').style.top = _top+"px";     
   
   //alert(_top);   
}

function search(aa)
 {
     location.replace(aa);
 };   
 



 function ajaxSwitch(url) {
     
   new Ajax.Request(url, {
        parameters: {
        },
        onSuccess: function(response) {
            
            temp = document.getElementById("ajaxcontent");
            temp.innerHTML =response.responseText;
            setTimeout(afterContentsLoaded,10);
            
        },
        onFailure: function(response) {
            alert("bannerClick Failure");
        },
        onException: function(request, ex) {
            alert("bannerClick Exception");
        }
    });
}



function afterContentsLoaded(){ 
    Effect.BlindDown('ajaxcontent', { duration: 1.0 });

}

function isExpanded(element){
    el=$(element); 
     return(el.style.display !='none');
}

function afterFx(){ 
           
  if ((!(isExpanded("ajaxcontent"))) && (old_content != xcontent)) {
      ajaxSwitch(xcontent,false);
  }
   old_content=xcontent;    

}

function switchContents(content){  
   // alert(xcontent);
  xcontent=(AjaxPageUrl+"/call-" +content);   //escape
 // alert(xcontent);  
      if  (isExpanded("ajaxcontent"))    
         Effect.BlindUp('ajaxcontent', { duration: 1.0, beforeStart:function(){ },afterFinish:function(){ afterFx(); }} )     ;
      
      else{
           old_content=xcontent; 
        ajaxSwitch(xcontent,false);
      }
}  

function setContent(content,nav){
      
       if (nav != '')
          xcontent=(AjaxPageUrl+"/call-" +content+"/nav-" +nav);
       else
          xcontent=(AjaxPageUrl+"/call-" +content); 
          
     if  (isExpanded("ajaxcontent"))
         Effect.BlindUp('ajaxcontent', { duration: 1.0}); 
      else
        ajaxSwitch(xcontent,false);
}
    
function exec(content){   
   
    if (content=="search"){

         url=(SearchPageUrl+"/query-akcija/save-true");  //escape                 
        location.href =url;
    }
    else if (content=="LoginUser"){
               url=escape(AjaxPageUrl+"/call-" +content);  
    }
}





