var myrules = {

//main page
// switch
	'a.switch' : function(element)
	{
		element.onmouseover = function()
		{
			var flashM = window.document.klik;
			flashM.GotoFrame(0);
			flashM.Play();
		}		
	},

	'a.switch_personal' : function(element)
	{
		element.onmouseover = function()
		{
			var flashM = window.document.klik;
			flashM.GotoFrame(0);
			flashM.Play();
		}		
	},

	
// zemljevid roll on
	'a#zemljevidToggle' : function(element)
	{
		element.onclick = function()
		{
			myHeight.toggle();
			tajmout = setTimeout("setRemote();", 500);
		}
	},

	// kontakt roll on
	'a#kontaktToggle' : function(element)
	{
		element.onclick = function()
		{
			if (KONTAKT_STATE == 1) // je poslano
			{
				KONTAKT_STATE = 0;
				resetKontakt();
			}
			
			mkContact.toggle();
			tajmout = setTimeout("setRemote();", 500);
		}
	},

	// podatki roll on
	'a#podatkiToggle' : function(element)
	{
		element.onclick = function()
		{
			mkPodatki.toggle();
			tajmout = setTimeout("setRemote();", 500);
		}
	},
	
// mini map	
	'a.minimap' : function(element)
	{
			element.onmouseover = function()
			{
				document.getElementById("napis").firstChild.data = this.firstChild.firstChild.data;
				var R = "r" + this.id.substring(1);
				document.getElementById(RIBBON).style.display = "none";
				document.getElementById(R).style.display = "block";
			}
		
			element.onmouseout = function () 
			{ 
				document.getElementById("napis").firstChild.data = MAPTITLE; 
				var R = "r" + this.id.substring(1);
				document.getElementById(R).style.display = "none";
				document.getElementById(RIBBON).style.display = "block";
			}

			element.onclick = function () 
			{ 
				

				theHandle = document.getElementById("zunanji");
				aktivna = 1*(this.id.substring(1));
				lw = (screenSize('w')-548)/2; // 548 = sirina / visina sobe
				th = (screenSize()-548)/2;
				ww = 1*(XY[aktivna][1]-lw*1);
				hh = 1*(XY[aktivna][0]-th*1);
				ww = (ww<0) ? 0 : ww;
				hh = (hh<0) ? 0 : hh;
				theHandle.style.top = (hh)*-1 + 'px';
				theHandle.style.left = (ww)*-1 + 'px';
				MAPLEFT = ww * -1; //(XY[aktivna][1]) * -1;
				MAPTOP = hh * -1; //(XY[aktivna][0]) * -1;			
				//writeSessionCookie('zuLeft', MAPLEFT);
				//writeSessionCookie('zuTop', MAPTOP);
				
			}
	},

	'.txt' : function(element)
	{
		element.onblur = function()
		{
			element.className = 'txt';
		};

		element.onfocus = function()
		{
			element.className = 'txt focus';
		}
				
	},

// bizuterija.php / wallpaper
	'a.wallp' : function(element)
	{
		element.onclick = function()
		{
			if (up == 0)
			{
				platno1.clearTimer();
				platno1.hide();
				var platno2 = new fx.Opacity('platno-b', {duration: 400, onComplete: function ()
					{
						$('tabs').style.display = 'none';
						$('x').style.display = 'none';
						wAjax('wpID=0', 'reset', 'platno-b', 'wallpaper');
						wAjax('wpID=0', 'reset', 'tabs', 'wallpaper');
						mscreen1.toggle();
					}
				});
				platno2.toggle();
				up = 1;
			} else
			{
				mscreen1.clearTimer();
				mscreen1.hide();
				if (element.id != "" && element.id != "x") 
				{
					var mscreen2 = new fx.Height('platno1', {duration: 100, onComplete: function ()
						{
						var platno3 = new fx.Opacity('platno-b', {duration: 400, onComplete: function ()
							{
								document.getElementById('platno-b').innerHTML = '<div style="text-align: center; line-height: 170px;"><img src="P/Ura.gif" /></div>';
								var postP = 'wpID='+element.id;
								wAjax(postP, 0, 'platno-b', 'wallpaper');
								wAjax(postP, 1, 'tabs', 'wallpaper');
							}
						});
						platno3.hide();
						platno3.toggle();
						timer = setTimeout("$('tabs').style.display = 'block'", 400);
						timer = setTimeout("$('x').style.display = 'block'", 100);
						}
					});
					mscreen2.toggle();
				
					up = 0;
				}

			}
		}
	},

// sproscevalnica.php / filmi
	'a.tivi' : function(element)
	{
		element.onclick = function()
		{
			if (up == 0)
			{
				platno1.clearTimer();
				platno1.hide();
				var platno2 = new fx.Opacity('platno-b', {duration: 400, onComplete: function ()
					{
						$('tabs').style.display = 'none';
						$('x').style.display = 'none';
						wAjax('wpID=0', 'reset', 'platno-b', 'wallpaper');
						mscreen1.toggle();
					}
				});
				platno2.toggle();
				$('tv').style.display = 'block';
				up = 1;
			} else
			{
				mscreen1.clearTimer();
				mscreen1.hide();
				if (element.id != "" && element.id != "x") 
				{
					var mscreen2 = new fx.Height('platno1', {duration: 100, onComplete: function ()
						{
						var platno3 = new fx.Opacity('platno-b', {duration: 400, onComplete: function ()
							{
								document.getElementById('platno-b').innerHTML = '<div style="text-align: center; line-height: 170px;"><img src="P/Ura.gif" /></div>';
								var postP = 'wpID='+element.id;
								wAjax(postP, 0, 'platno-b', 'sproscevalnica');
							}
						});
						platno3.hide();
						platno3.toggle();
						timer = setTimeout("$('x').style.display = 'block'", 100);
						}
					});
					mscreen2.toggle();
					timer = setTimeout("$('tv').style.display = 'none';", 100);
					up = 0;
				}

			}
		}
	},


// garderoba.php / t-shirt
	'a.gard' : function(element)
	{
		element.onclick = function()
		{
			if (up == 0)
			{
				platno1.clearTimer();
				platno1.hide();
				var platno2 = new fx.Opacity('platno-b', {duration: 400, onComplete: function ()
					{
						$('order').style.display = 'none';
						$('x').style.display = 'none';
						wAjax('wpID=0', 'reset', 'platno-b', 'garderoba');
						wAjax('wpID=0', 'reset', 'tabs', 'garderoba');
						mscreen1.toggle();
					}
				});			
				platno2.toggle();
				up = 1;
			} else
			{
				mscreen1.clearTimer();
				mscreen1.hide();
				if (element.id != "" && element.id != "x") 
				{
					var mscreen2 = new fx.Height('platno1', {duration: 100, onComplete: function ()
						{
						var platno3 = new fx.Opacity('platno-b', {duration: 400, onComplete: function ()
							{
								document.getElementById('platno-b').innerHTML = '<div style="text-align: center; line-height: 170px;"><img src="P/Ura.gif" /></div>';
								var postP = 'wpID='+element.id;
								wAjax(postP, 0, 'platno-b', 'garderoba');
								//wAjax(postP, 1, 'order', 'garderoba');
								
								//wAjax(element.id, 1, 'tabs');
							}
						});
						platno3.hide();
						platno3.toggle();
						timer = setTimeout("$('order').style.display = 'block'", 400);
						timer = setTimeout("$('x').style.display = 'block'", 100);
						}
					});
					mscreen2.toggle();
				
					up = 0;
				}

			}
		}
	},

	// arhiv.php / arhiv	
	'a.switch-v' : function(element)
	{
		element.onclick = function()
		{
			if (element.id == 's_narocnik')
			{
				var gumbON = 's_narocnik';
				var gumbOFF = 's_produkt';
				var func1 = 'narocnik1';
				var func2 = 'narocnik_Filter';
			}
			else
			{
				var gumbON = 's_produkt';
				var gumbOFF = 's_narocnik';
				var func1 = 'produkt1';
				var func2 = 'produkt_Filter';
			}
			document.getElementById(gumbON).className = "switch-v v_on";
			document.getElementById(gumbOFF).className = "switch-v";
			wAjax('wpID=0', func1, 'file2', 'arhiv');
			wAjax('wpID=0', func2, 'filter1', 'arhiv');
			wAjax('wpID=0', 'reset', 'file3', 'arhiv');
		}
	}

	

	
};
	
Behaviour.register(myrules);