function w(url,type){
	switch(type){
        case 1:
			var posWidth = 1044;
			var posHeight = 1044;
			wname = 'galerie-full';
		break
        case 2:
			var posWidth = 900;
			var posHeight = 640;
			wname = 'cizi-okno';
		break
        default:
			var posWidth = 740;
			var posHeight = 720;
			wname = 'galerie';
	}
	if(window.screen.availHeight < posHeight){posHeight = window.screen.availHeight;} 
	if(window.screen.availWidth < posWidth){posWidth = window.screen.availWidth;}
	var posLeft = (window.screen.availWidth - posWidth)/2;
	var posTop = (window.screen.availHeight - posHeight)/2;
	var args='scrollbars=yes,location=no,resizable=yes,'; 
	args += 'width=' + posWidth + ',height=' + posHeight + ',left=' + posLeft + ',top=' + posTop;

	var win = window.open(url,wname,args);
	if(win){
		win.focus;
		return false;
	} else return true;
}
var timerID = null
var delay = 5000
var active = false

function StopTheClock()
{
    if(timerRunning){
        clearTimeout(timerID);
    }
    timerRunning = false;
}

function StartTimer()
{
   timerID = self.setTimeout("Refresh()",delay);
}

function Refresh(){
   StartTimer();
   frames['msgs'].location.href = '../messages/';   
}

function ChangeTimer(newdelay) {
   if(timerID) {
      clearTimeout(timerID);
   }
   delay=newdelay;
   StartTimer();
}





function StartWaitTimer()
{
   timerID = self.setTimeout("RefreshWait()",5000);

}

function RefreshWait(){
   timerID = self.setTimeout("RefreshWait()",5000);
   history.go();   
   
}


function init(){
	 if (frames['msgs']!=null){
		StartTimer();
	  }
	  
	 if (frames['wait']!=null){
	 	
		StartWaitTimer();
	  }
	  
}
window.onload = init;

