/*
 ** SlidePanel v2.3.1, SchwarzTech DHTML API from SchwarzTech.co.uk
 ** Copyright (c) 2005 Darren Schwarz (darren@schwarztech.co.uk)
 ** Distributed under the terms of the GNU LGPL from gnu.org - Please Read the License - Thankyou :)
 ** Author Darren Schwarz
*/

		var timer = 5000;
		var max = 100;
		var step = 0;
		var offset = 0;
		
		var currentbtn = new Object;
		var previousbtn = new Object;
		var currentimg = 'empty';
		var previousimg = 'empty';

		var moving = false;
		var visible = false;

		// Hide ribbon on MouseOut & MousePos
		function HideSubNavOnMousePos(x, y) 
		{		    
		    if(null != x && null != y)
		    {		 
		        var tempX = x;
		        var tempY = y;

		        if(tempX < 180 || tempX > 1050 || tempY > 200)    		    
		        {
			        var element = document.getElementById('subnav').style;
			        if(element.visibility == 'visible')
			        {
				        element.visibility = 'hidden';
				        previousbtn.src = "common/images/en/topnavigation/" + previousimg + ".png";
				        visible = false;
				        document.onmouseup = null;
			        }
		        }
		    }
		}

		// Hide ribbon on document click
		function HideSubNav(e) 
		{
	        var element = document.getElementById('subnav').style;
	        if(element.visibility == 'visible')
	        {
		        element.visibility = 'hidden';
		        previousbtn.src = "common/images/en/topnavigation/" + previousimg + ".png";
		        visible = false;
		        document.onmouseup = null;
	        }
		}
		
		function CheckFocus()
		{
			setTimeout("document.onmouseup = HideSubNav;",1); 
		}

		function showPic (whichpic) 
		{
  			if (!document.getElementById) return true;

  			//var element = document.getElementById('subnav_option');
    			//element.innerHTML = "<img src='common/images/" + whichpic + ".png' usemap='#" + whichpic + "_Map' />";

			var so = new SWFObject("common/swf/" + whichpic + ".swf", "myoption", "980", "108", "8", "#000000");
			so.addParam('Quality', 'High');
   			so.addParam('WMode', 'transparent');
   			so.addParam('SAlign', '');
   			so.addParam('AllowScriptAccess', '');
			so.write('subnav_option');

  			return false;
		}

		function NavAnimation(btn, img, option)
		{	
			var element = document.getElementById('subnav').style;

			showPic(option);

			currentbtn = btn;
			currentimg = img;

			if(previousbtn == null)
			{
				previousbtn = btn;
			}

			if(previousbtn.id == btn.id)
			{
				if(visible == true)
				{
					visible = false;
					PlayAnimation(visible);
				}
				else
				{
					currentbtn.src = "common/images/en/topnavigation/" + previousimg + "-over.png";
					element.visibility = 'visible';
					visible = false;
					PlayAnimation(visible);
				}
			}
			else
			{
				element.visibility = 'visible';
				visible = true;
				PlayAnimation(visible);

				if(previousbtn.id != btn.id)
				{
					previousbtn.src = "common/images/en/topnavigation/" + previousimg + ".png";
					currentbtn.src = "common/images/en/topnavigation/" + img + "-over.png"; 
	
					previousbtn = currentbtn;
					previousimg = currentimg;
				}
			}
		}
		
		function PlayAnimation(_visible)
		{
			if(!_visible)
			{
				if(step <= max)
				{
					step += Friction();
					setTimeout("PlayAnimation(" + _visible + ")",timer);
					var element = document.getElementById('subnav').style;
					//element.top = step + offset;
				}
			}
			else
			{
				if(step > 0)
				{
					step -= Friction();
					setTimeout("PlayAnimation(" + _visible + ")",timer);
					var element = document.getElementById('subnav').style;
					//element.top = 110;
				}
			}
		}

		function Friction()
		{
			var dir = 45;
			var t = 10;
			speed = t/10;
			speed = Math.sin(dir*Math.PI/380)*speed;					
			return speed;
}
