menuManagerC=function(){
  this.positionParams=navigationConf.l2Pos
	  this.u=new utils()
	  this.fps=24;
	  this.waitTimer=2000;
	  window.topMenuTimerId=null;
	  window.topMenuClipTimerId=null;
	  this.bSw=true;
	  document.ondblclick=function() { 
	  menuManager.hideContener(); 
	  }
	    this.showSection=function(id){
		      this.resetTimer();
		      if(this.curId!=null)this.hideContener();
		      if(id!=='')this.showContener(id);
								try{document.getElementById('dPanoAll').style.display='none'}catch(e){};
		      };
	  this.hideSection=function(id){
		    this.resetTimer();
		    window.topMenuTimerId=setInterval('menuManager.hideContener()',this.waitTimer);
		    };
	  this.resetTimer=function(){
		    this.bSw=true;
		    clearInterval(window.topMenuTimerId);
		    window.topMenuTimerId=null;
		    clearInterval(window.topMenuClipTimerId);
		    window.topMenuClipTimerId=null;
						
		    };
	  /**
	  *Tu miejsce na animacje 
	  */
	  this.switchSection=function(id){
		    window.event.cancelBubble=true;
		    //alert(this.bSw)
		    if(this.bSw){
			    this.showSection(id);
			    this.bSw= !this.bSw;
			    }else
			    {
			    this.hideContener();
			    };
		    };
	  this.hideContener=function(){
		    this.resetTimer()
		    var id=this.curId;
		    if(id==null)return;
		    this.curId=null;
		    this.findContener(id).style.display='none';
						try{document.getElementById('dPanoAll').style.display='inline'}catch(e){};
		    };
	  this.showContener=function(id){
		    if(typeof(this.mdestPos)=='undefined'){
			    this.mdestPos=parseInt(this.findContener(id).style.left);
			    };
		    this.curId=id;

		    this.setStartPosition();
		    this.findContener(id).style.display='inline';
		    this.clipLoop();
		    window.topMenuClipTimerId=setInterval('menuManager.clipLoop()',this.fps);
		    };
	  this.setStartPosition=function(){
		  //alert(this.curId);
		    this.obRef=this.findContener(this.curId)
		      //this.curContentW=this.u.getDivScrollWidth(this.obRef);
		      this.u.setDivPos(this.obRef,'left',this.positionParams.left);
		    this.u.setDivPos(this.obRef,'top',this.positionParams.top);
		    //this.clipPos=[this.positionParams.height/2-2,this.positionParams.width/2,this.positionParams.height/2,this.positionParams.width/2]
						var d=70;
						this.clipPos=[-1,this.positionParams.width/2+d,50,this.positionParams.width/2-d]
		      };
	  this.clipLoop=function(){
    var steps={x:15,y:10};
		    this.clipPos[1]+=steps.x;
		    this.clipPos[3]-=steps.x;
		    //logDebug(this.clipPos[1]<this.positionParams.width)
		    if(this.clipPos[1]<=this.positionParams.width ){
			    this.u.clipDiv(this.obRef,this.clipPos);
			    return;
			    };
		    //this.clipPos[0]-=steps.y;
		    this.clipPos[2]+=steps.y;
		    if(this.clipPos[2]<=this.positionParams.height){
			    this.u.clipDiv(this.obRef,this.clipPos);
			    return;
			    }
		    this.resetTimer();
		    };
	  this.findContener=function(id){
		    return document.getElementById('dml'+id);
		    };
	  this.getCurId=function(){
		    return this.curId;
		    };
	  this.swfCom=function(command, args){
			switch(command){
				case 'go':
					var art=708;
					var gr_art=0;
					//alert(args);
				if(args=="3"){
					//this.showSection(1);
					activeId="3";  //menu
				//	startNavigation();
					startDol2swf();
						art=0;
					gr_art=1035;
				}
				else{
					var el=document.getElementById("ln-"+args)
					//location=el.href;
					//alert('test');
					//menufilm.Play();
			//		var ids="zapiecek,lokalizacja,menu,specjalnosc_zakladu,fotogaleria,panoramy,webkamera,aktualnosci,polec_znajomym,kupon_rabatowy"
		//var ids="528,556,menu,571,572,573,574,527,polec_znajomym,576"
		                        
					
					activeId=args;
				//	startNavigation();
					if(args=='1'){
						 art=708;//karczma
						 startDol1swf();
					}
					if(args=='2'){
						 art=709;//lokalizacja
						 startDol2swf();
					}
					if(args=='4'){
						art=710;//1003;//specyjalnosc zakladu
						startDol3swf();
					}
					/*
					if(args=='8'){
						//art=572;
						var t=document.getElementById('tresc');
						t.innerHTML='<div id="webGaleryViewerDivOutner"><div id="webGaleryViewerDiv"> </div></div>';
						//onLoadQueue.appendOnLoad(startWebGalery);
						startWebGalery();
						break;
					}*/
					if(args=='5'){//dzieci
						startDol1swf();
						art=711;//1004;
						//panoLauncher=new PanoLauncher();
						//xajax_TplResp(art,'panoramyz.tpl');
						//break;
					}
					if(args=='6'){
						art=712;//imprezy
						startDol2swf();
					}
					
					if(args=='7'){
						 //art=574;
						 var t=document.getElementById('tresc');
						 t.innerHTML='<table><tr><td align=center width="570"><div id="webCamLauncherDiv" ></div></td></tr><tr><td align=center width="570"><div id="webCamLauncherDiv1" ></div></td></tr></table>';
						 //xajax_TplResp(art,'kamerykpz.tpl');
					
					 		
							webCamConf.miniatures={};
							webCamConf.strings={};
							webCamConf.cams=[];
							webCamConf.miniatures.cams=[];
							webCamConf.strings.archiwalna='archiwum';
							webCamConf.strings.data='data';
							webCamConf.strings.godzina='godzina';
							webCamConf.miniatures.sizes='480';
							webCamConf.miniatures.width=390;
							webCamConf.miniatures.height=200;
							webCamConf.miniatures.file='Miniatures1.swf';
							webCamConf.miniatures.cams.push(['cam4','Wnętrze']);
							webCamConf.cams.cam4={};
							webCamConf.cams.cam4.name='Wnętrze';
							webCamConf.cams.cam4.location='Karcma Po Zbóju';
							webCamConf.miniatures.cams.push(['cam10','Wnętrze']);
							webCamConf.cams.cam10={};
							webCamConf.cams.cam10.name='Wnętrze';
							webCamConf.cams.cam10.location='Karcma Po Zbóju';
							webCamConf.miniatures.cams.push(['cam15','Wnętrze']);
							webCamConf.cams.cam15={};
							webCamConf.cams.cam15.name='Wnętrze';
							webCamConf.cams.cam15.location='Karcma Po Zbóju';
							
							webCamConf.cams.cam16={};
							webCamConf.cams.cam16.name='Wnętrze';
							webCamConf.cams.cam16.location='Karcma Po Zbóju';
							
							
							webCamConf1.miniatures={};
							webCamConf1.strings={};
							webCamConf1.cams=[];
							webCamConf1.miniatures.cams=[];
							webCamConf1.strings.archiwalna='archiwum';
							webCamConf1.strings.data='data';
							webCamConf1.strings.godzina='godzina';
							webCamConf1.miniatures.sizes='480';
							webCamConf1.miniatures.width=390;
							webCamConf1.miniatures.height=200;
							webCamConf1.miniatures.file='Miniatures1.swf';
							webCamConf1.miniatures.cams.push(['cam15','Wnętrze']);
							webCamConf1.cams.cam15={};
							webCamConf1.cams.cam15.name='Wnętrze';
							webCamConf1.cams.cam15.location='Karcma Po Zbóju';
						//	webCamConf1.miniatures.cams.push(['cam15','Wnętrze']);
							webCamConf1.cams.cam10={};
							webCamConf1.cams.cam10.name='Wnętrze';
							webCamConf1.cams.cam10.location='Karcma Po Zbóju';
							
							
						        startWebcam();
							startWebcam1();
							startDol3swf();
						 break;
					}
					if(args=='8'){
						gr_art=714;//galeria
						art=714;
						startDol1swf();
					}
					if(args=='9'){
						art=715;//panoramy
						startDol2swf();
						xajax_TplResp(art,'panoramykpz.tpl');
						panoLauncher.path="/vpm/"
						panoLauncher.host="www.kpz.atprojekt.pl"
						panoLauncher.port="80"
						panoLauncher.start();
					}
					if(args=='10'){
					    startDol3swf();
					    xajax_TplResp(0,'mail_kpz.tpl');
					    break;
					}
					if(args=='11'){
					    startDol1swf();
					    xajax_TplResp(0,'mailmenago_kpz.tpl');
					    break;
					}
					
				}
				if(args=='3'){ 
					xajax_LadujHtml4l(gr_art,art,0);
					break;
				}
				
				if(args=='8')xajax_LadujHtml3l(gr_art,art,0);
				else xajax_LadujHtml3l(gr_art,art,0);
				//if(args==3)document.getElementById("menulista").style.display="block";
				break;
				case 'reset':
					this.hideContener();
					break;
				}
		}
	  };
function startMenuManager(){
	window.menuManager=new menuManagerC();
	//menuManager=new menuManagerC();
}
onLoadQueue.appendOnLoad(startMenuManager)
/*
 function menuswf_DoFSCommand(command, args) {
//alert(command)
switch(command){
case 'go':
if(args=="menu"){
	menuManager.showSection(1)
}
else{
	var el=document.getElementById("ln-"+args)
	location=el.href;
}
break;
case 'reset':
	menuManager.hideContener();
	break;
}
}

if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<scr'+'ipt language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub menuswf_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call menuswf_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</scr'+'ipt\>\n');
}*/