
Event.observe(window, 'load', setSize);

function setSize(){
	var maxWd = 1280;
   var myScreen = screenInfo();
   if(myScreen[0] > maxWd) myScreen[0] = maxWd; 
   
   var myHeight = myScreen[1];
   screenH=myHeight;
   var myWidth = myScreen[0];
   var leftWd = $('midl').getDimensions().width;
   var menuWd = 0;

   $('midl').style.height = myHeight +'px';
   $('midm').style.height = myHeight +'px';
   $('midm').style.width = myWidth - leftWd +'px';
   $('content').style.height = myHeight +'px';

   var myRubs = document.getElementsByClassName('rubriche');
   for(i=0;i<myRubs.length;i++){
      myRubs[i].style.height = myHeight +'px';
      if(myRubs[i].className != 'rubriche sel') myRubs[i].style.left = (myWidth - leftWd - (30*(i+1))) +'px';
      menuWd+= myRubs[i].getDimensions().width;
   }
   $('content').style.width = myWidth - leftWd - menuWd +'px';
   
   if($('map')){
      $('map').style.height = myHeight +'px';
      $('map').style.width = myWidth - leftWd - menuWd - 2 +'px';
   }  
   if(document.getElementsByClassName('rubriche sel')[0]) $('content').style.left = '31px';

}

function screenInfo(){
   var widthUser;
   var heightUser;

   if(typeof(window.innerWidth) == 'number'){
      widthUser = window.innerWidth;
      heightUser = window.innerHeight;
   }
   else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
      widthUser = document.documentElement.clientWidth;
      heightUser = document.documentElement.clientHeight;
   }
   else if(document.body && (document.body.clientWidth || document.body.clientHeight)){
      widthUser = document.body.clientWidth;
      heightUser = document.body.clientHeight;
   }

   return Array(widthUser,heightUser);
}

function go(type, id){
   $('edit_left').style.visibility = '';
   new Ajax.Request('/?', {
      method : 'post',
      parameters: {ajax:'ajax.html', type: type, id: id},
      onSuccess: function (ret){
         eval(ret.responseText);
      }
   });
}

function closeArtPop(id){ Effect.Fade($(id), { afterFinish: function (){ document.body.removeChild($(id));} }); }

function swapImage(idImage){

var dk=$(idImage).src.indexOf('_r')
if (dk>0) var letter='r';else letter='l'
var ck=$(idImage).src.indexOf(1)
if (ck>0) $(idImage).src='supp/gsexpo_'+letter+'2.png'
else $(idImage).src='supp/gsexpo_'+letter+'1.png'
}



onresize = setSize;
