
function showDiv(show,hide1,hide2){

  $(show).style.display='';
  $(hide1).style.display='none';
  $(hide2).style.display='none';
  if(show=='ind'){
    $('t1').className='techActive';
    $('t2').className='techDisactive';
    $('t3').className='techDisactive';
  }
  if(show=='cat'){
    $('t2').className='techActive';
    $('t1').className='techDisactive';
    $('t3').className='techDisactive';
  }
  if(show=='tech'){
    $('t3').className='techActive';
    $('t2').className='techDisactive';
    $('t1').className='techDisactive';
  }


  //var myRequest = new Request({url: '/fileadmin/templates/ajax/action.php'}).send('action=showDiv&show='+show);


  var ajaxRequest;
  var postBody = 'action=showDiv&show='+show;
  new Ajax.Request('/fileadmin/templates/ajax/action.php', {
    method:'post',
    postBody:postBody,
    onSuccess:
    function(t){
    //$('center3').innerHTML=t.responseText;
    //alert(t.responseText);
  
    }
  });
 
}

function resizePlayer(){
  var wid=$('window').getDimensions().width;
  $('width').value=wid-1000;
  if($('movie2'))
    addflash('movie2',$('movie').value,$('vars').value,$('width').value,'212');
}

function addflash(idcont,movie,flashvars,width,height) {
  $(idcont).innerHTML=AC_FL_RunContent(
    'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
    'width', width,
    'height', height,
    'src', movie,
    'quality', 'high',
    'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
    'align', 'middle',
    'play', 'true',
    'loop', 'true',
    'scale', 'showall',
    'wmode', 'transparent',
    'devicefont', 'false',
    'id', idcont+'_flash',
    'bgcolor', '#ffffff',
    'name', idcont+'_flash',
    'menu', 'true',
    'allowFullScreen', 'true',
    'allowScriptAccess','sameDomain',
    'movie', movie,
    'salign', '',
    'flashvars', flashvars
    );
}

var active = 1 ;
var activearray= [];
activearray['proj'] = 1;
activearray['p'] = 1;
activearray['n'] = 1;
function changeImageInnerHtml(divId , html)
{
  var div = document.getElementById(divId);
  div.innerHTML = html ;
  return true ;
}
//search js
function Result(divId,base,pdiv,markFiled)
{
  var mField = document.getElementById(markFiled);
  var div = document.getElementById(divId) ;
  var pdiv = document.getElementById(pdiv);
  if(div != null)
  {
    if(div.style.visibility == "visible")
    { 
      div.style.visibility = "hidden" ;
      if(pdiv)
      { 
        pdiv.style.visibility = "hidden" ;
        pdiv.style.display = "none" ;
      }
      if(mField)
      {
        mField.innerHTML = "[+]"; 
      }
    }
    else
    {
      div.style.visibility = "visible" ;
      if(pdiv)
      { 
        pdiv.style.visibility = "visible" ;
        pdiv.style.display = "block" ;
      }
      if(mField)
      {
        mField.innerHTML = "[-]"; 
      }
    }
  }
  else
  {
    alert("div not found");                            
  }
  var fdiv = document.getElementById(base+activearray[base+""]) ;
  if(fdiv)
  {
    if(fdiv.style.visibility == "hidden")
    {
      fdiv.style.visibility = "visible" ;
      fdiv.style.display = "block" ;
    }
    else
    {
      fdiv.style.visibility = "hidden" ;
      fdiv.style.display = "none" ;
    }
  }
  else
  {
    alert("fdiv not found : "+base+  " : active : " +activearray[base+""]);                            
  }
  // disable link
  return false ;
}



function ResultPagging(divBaseId , numPage , baseNameIdPagefLink)
{
  //divBaseId - base id-name (without page number)
  //numPage - number of page

  var divToHide = document.getElementById(divBaseId + activearray[divBaseId+""]);
   

  if(divToHide)
  {
    divToHide.style.visibility = "hidden" ;
    divToHide.style.display='none';
      
    var oldLink = document.getElementById(baseNameIdPagefLink+activearray[divBaseId+""]) ;
    if(oldLink)
    {
      oldLink.style.fontWeight  ="Normal" ;
    //alert(baseNameIdPagefLink+activearray[divBaseId+""]);
    }
  }
  //show div
  var divToShow = document.getElementById(divBaseId + numPage);
  if(divToShow)
  {
    divToShow.style.visibility = "visible" ;
    activearray[divBaseId+""] = numPage ;
    divToShow.style.display='block';
    var newLink = document.getElementById(baseNameIdPagefLink+ numPage) ;
    if(newLink)
    {
      newLink.style.fontWeight  ='Bold' ;
    //alert(baseNameIdPagefLink+ numPage);
    }
  }
 
  
  
  //disable link
  return false ;
  
  
}

function checkFlash(sess){
  var w=screen.width;
  var h=screen.height;
  var os=navigator.platform;
  var flashversion=GetSwfVer();
  //var myRequest = new Request({url: '/fileadmin/templates/ajax/action.php'}).send('action=checkFlash&flash='+flashversion+'&sess='+sess+'&width='+w+'&height='+h+'&os='+os);
  var ajaxRequest;
  var postBody = 'action=checkFlash&flash='+flashversion+'&sess='+sess+'&width='+w+'&height='+h+'&os='+os;
  new Ajax.Request('/fileadmin/templates/ajax/action.php', {
    method:'post',
    postBody:postBody,
    onSuccess:
    function(t){}
  });
}


function selectDate(date){
  if(date){
    var ajaxRequest;
    var postBody = 'action=selectDate&date='+date;
    new Ajax.Request('/fileadmin/templates/ajax/action.php', {
      method:'post',
      postBody:postBody,
      onSuccess:
      function(t){
        $('date2').innerHTML=t.responseText;
      }
    });

  }
}

function changeView(type){
  //var myRequest = new Request({url: '/fileadmin/templates/ajax/action.php'}).send('action=changeView&type='+type);
  var ajaxRequest;
  var postBody = 'action=changeView&type='+type;
  new Ajax.Request('/fileadmin/templates/ajax/action.php', {
    method:'post',
    postBody:postBody,
    onSuccess:
    function(t){
      location=window.location.href;
    }
  });


}

function changePager(num){
  var ajaxRequest;
  var postBody = 'action=changePager&num='+num;
  new Ajax.Request('/fileadmin/templates/ajax/action.php', {
    method:'post',
    postBody:postBody,
    onSuccess:
    function(t){
      location=window.location.href;
    }
  });

}

function checkPlatform(){
  var ua = navigator.platform.toLowerCase();
  if (ua.indexOf("mobile") != -1) {
    location='wm/';
  }
  if (ua.indexOf("ipod") != -1 || ua.indexOf("iphone") != -1) {
    location='iphone/';
  }
}

function toggleMenu(id){
  var el=document.getElementById(id);
  if(el.style.display=='none')el.style.display='';
  else el.style.display='none';

}
function toggleSearchParam(name,value,l){
 var url;
 var pars;
 var myAjax;
  if($('projects_browse_page_id').value!=4){
    url='/index.php';
    pars='id=4&'+name+'='+value+'&isajax=project_list&mode=redirect&no_cache=1&L='+l;
    myAjax=new Ajax.Request(url,{
      method: 'get',
      parameters: pars,
      onSuccess: function(t)  {
        //redirect
        eval(t.responseText);
      }
    });
    
  }
  else {
    url='/index.php';
    pars='id=4&'+name+'='+value+'&isajax=project_list&no_cache=1&L='+l;
    $('center3').innerHTML='<div align="center" style="padding-top:30px;"><img src="fileadmin/templates/images/ajax-loader.gif"/></div>';
      
    myAjax=new Ajax.Request(url,{
      method: 'get',
      parameters: pars,
      onSuccess: function(t)  {
        //update list
        $('center3').innerHTML=t.responseText;
     
     
        var url='/index.php';
        var pars='id=4&'+name+'='+value+'&isajax=project_menu&no_cache=1&L='+l;
    
        var myAjax=new Ajax.Request(url,{
          method: 'get',
          parameters: pars,
          onSuccess: function(t)  {
            //update list
            $('projects_browse_type').innerHTML=t.responseText;
          }
        });
      }
    });
  }
 

}
function addSearchParam(name,value,l){
  var url='/index.php';
  var pars='id=4&'+name+'='+value+'&isajax=project_list&no_cache=1&L='+l;
  $('center3').innerHTML='<div align="center" style="padding-top:30px;"><img src="fileadmin/templates/images/ajax-loader.gif"/></div>';
  var myAjax=new Ajax.Request(url,{
    method: 'get',
    parameters: pars,
    onSuccess: function(t)  {
      //update list
      $('center3').innerHTML=t.responseText;
      var url='/index.php';
      var pars='id=4&'+name+'='+value+'&isajax=project_menu&no_cache=1&L='+l;
  
      var myAjax=new Ajax.Request(url,{
        method: 'get',
        parameters: pars,
        onSuccess: function(t)  {
          //update list
          $('projects_browse_type').innerHTML=t.responseText;
        }
      });
    }
  });

}
function delSearchParam(name,value,l){
  var url='/index.php';
  var pars='id=4&'+name+'='+value+'&isajax=project_list&no_cache=1&delparam=1&L='+l;
  $('center3').innerHTML='<div align="center" style="padding-top:30px;"><img src="fileadmin/templates/images/ajax-loader.gif"/></div>';
  var myAjax=new Ajax.Request(url,{
    method: 'get',
    parameters: pars,
    onSuccess: function(t)  {
      //update list
      $('center3').innerHTML=t.responseText;
      var url='/index.php';
      var pars='id=4&'+name+'='+value+'&isajax=project_menu&no_cache=1&delparam=1&L='+l;
  
      var myAjax=new Ajax.Request(url,{
        method: 'get',
        parameters: pars,
        onSuccess: function(t)  {
          //update list
          $('projects_browse_type').innerHTML=t.responseText;
        }
      });
    }
  });

}
function delAllSearchParam(l,project_id){
  var url;
  var myAjax;
  var pars;
  if($('projects_browse_page_id').value!=4){
    url='/index.php';
    pars='id=4&isajax=project_list&no_cache=1&mode=redirect&&delallparam=1&L='+l;
    myAjax=new Ajax.Request(url,{
      method: 'get',
      parameters: pars,
      onSuccess: function(t)  {
        //redirect
        eval(t.responseText);
      }
    });
    
  }
  else {
    url='/index.php';
    if(project_id>0)addP='&project='+project_id;
    else addP='';
    pars='id=4&isajax=project_list&no_cache=1&delallparam=1&L='+l+addP;
    $('center3').innerHTML='<div align="center" style="padding-top:30px;"><img src="fileadmin/templates/images/ajax-loader.gif"/></div>';
    myAjax=new Ajax.Request(url,{
      method: 'get',
      parameters: pars,
      onSuccess: function(t)  {
        //update list
        $('center3').innerHTML=t.responseText;
        var url='/index.php';
        var pars='id=4&isajax=project_menu&no_cache=1&delallparam=1&L='+l+addP;
    
        var myAjax=new Ajax.Request(url,{
          method: 'get',
          parameters: pars,
          onSuccess: function(t)  {
            //update list
            $('projects_browse_type').innerHTML=t.responseText;
          }
        });
      }
    });
  }

}
function delCatSearchParam(name,l,project_id){
  var url;
  var myAjax;
  var pars;
  if($('projects_browse_page_id').value!=4){
    url='/index.php';
    pars='id=4&isajax=project_list&no_cache=1&mode=redirect&delcatparam='+name+'&L='+l;
    myAjax=new Ajax.Request(url,{
      method: 'get',
      parameters: pars,
      onSuccess: function(t)  {
        //redirect
        eval(t.responseText);
      }
    });
    
  }
  else {
    url='/index.php';
    if(project_id>0)addP='&project='+project_id;
    else addP='';
    pars='id=4&isajax=project_list&no_cache=1&delcatparam='+name+'&L='+l+addP;
      
    $('center3').innerHTML='<div align="center" style="padding-top:30px;"><img src="fileadmin/templates/images/ajax-loader.gif"/></div>';
    myAjax=new Ajax.Request(url,{
      method: 'get',
      parameters: pars,
      onSuccess: function(t)  {
        //update list
        $('center3').innerHTML=t.responseText;
        var url='/index.php';
        var pars='id=4&isajax=project_menu&no_cache=1&delcatparam='+name+'&L='+l+addP;
      
        var myAjax=new Ajax.Request(url,{
          method: 'get',
          parameters: pars,
          onSuccess: function(t)  {
            //update list
            $('projects_browse_type').innerHTML=t.responseText;
          }
        });
      }
    });
  }

}
function logosNoFlash(id){
  var url='/index.php';
  var pars='id='+id+'&noFlash=getGallery&no_cache=1';
  var myAjax=new Ajax.Request(url,{
    method: 'get',
    parameters: pars,
    onSuccess: function(t)  {
      //redirect
      $('flashcontent').innerHTML=t.responseText;
    }
  });
    
}

function show_newsletter(){
  if(document.getElementById('newsletter_info').style.display=='none')
    document.getElementById('newsletter_info').style.display='';
  else
    document.getElementById('newsletter_info').style.display='none';
}
 
var newsTab=0;
var timer=0;
var num=1;
var time=6000;
var prev=0;

function logoChange(ltime){
  if(timer!=0) clearTimeout(timer);
  timer=setTimeout(logo,ltime);
}

function logo(){
  if(newsTab>=num)
    newsTab=0;
  newsTab=newsTab+1;
  var i;
  for(i=1;i<(num+1);i++){
    if(newsTab==i)
      document.getElementById('work_'+i).style.display='';
    else
      document.getElementById('work_'+i).style.display='none';
  }
  /*
  if(newsTab<=num){
    var ajaxRequest;
    var postBody = 'action=logo&start='+prev;
    new Ajax.Request('/fileadmin/templates/ajax/action.php', {
      method:'post',
      postBody:postBody,
      onSuccess:
      function(t){
      }
    });
  }
  */
  prev=newsTab;
  logoChange(time);
}

function logoSet(id){
  newsTab=id;
  logo();
}

function logoPause(){
  clearTimeout(timer);
  timer=0;
}

function logoResume(){
  logoChange(time);
}

function logoPrev(){
  newsTab=newsTab-2;
  if(newsTab<0)
	newsTab=num-1;
  logo();
}

function logoNext(){
  newsTab=newsTab;
  logo();
}

var offerImg='';
var t=0;
function changeOffer(){
	if(offerImg==''){
		$('offerImg').className="offerWhite";
		offerImg='a';
	}
	else{
		$('offerImg').className="offerBlue";
		offerImg='';
	}
	changeOfferStart();
}
function changeOfferStart(){
	t=setTimeout("changeOffer()",1000);
}

