if (!window.sb) { window.sb = {}; }
sb.slsidebar = function() {}
sb.slsidebar.prototype =
{
	handleLoad: function(control, userContext, rootElement) {
		this.control = control;
		this.rootElement = rootElement;
		this.btnOpen = false;
		
		this.rootElement.findName("showNavs").Begin();
		this.rootElement.addEventListener("mouseLeave", Silverlight.createDelegate(this, this.hideButtons));
		
		var btn1 = this.rootElement.findName("button1");
		btn1.addEventListener("mouseEnter", Silverlight.createDelegate(this, this.btn1_over));
		btn1.addEventListener("mouseLeave", Silverlight.createDelegate(this, this.btn1_out));
		var btn2 = this.rootElement.findName("button2");
		btn2.addEventListener("mouseEnter", Silverlight.createDelegate(this, this.btn2_over));
		btn2.addEventListener("mouseLeave", Silverlight.createDelegate(this, this.btn2_out));
		var btn3 = this.rootElement.findName("button3");
		btn3.addEventListener("mouseEnter", Silverlight.createDelegate(this, this.btn3_over));
		btn3.addEventListener("mouseLeave", Silverlight.createDelegate(this, this.btn3_out));
		
		btn1.addEventListener("MouseLeftButtonUp", this.getUrl);
		btn2.addEventListener("MouseLeftButtonUp", this.getUrl);
		btn3.addEventListener("MouseLeftButtonUp", this.getUrl);
		
		this.rootElement.findName("learn_more1").addEventListener("MouseLeftButtonUp", this.getUrl);
		this.rootElement.findName("test_drive1").addEventListener("MouseLeftButtonUp", this.getUrl);
		this.rootElement.findName("download_trial1").addEventListener("MouseLeftButtonUp", this.getUrl);
		
		this.rootElement.findName("learn_more2").addEventListener("MouseLeftButtonUp", this.getUrl);
		this.rootElement.findName("test_drive2").addEventListener("MouseLeftButtonUp", this.getUrl);
		this.rootElement.findName("download_trial2").addEventListener("MouseLeftButtonUp", this.getUrl);
		
		this.rootElement.findName("learn_more3").addEventListener("MouseLeftButtonUp", this.getUrl);
		this.rootElement.findName("test_drive3").addEventListener("MouseLeftButtonUp", this.getUrl);
		this.rootElement.findName("download_trial3").addEventListener("MouseLeftButtonUp", this.getUrl);
		
	},
	
	handleError: function(sender, eventArgs)
	{
	    //do nothing...
	},
	
	btn1_over: function(sender, eventArgs) {
		this.control.content.findName("btn1_over").Begin();

        document.getElementById("shortcuts").style.zIndex = 99;    

	    this.control.content.findName("winserver").IsHitTestVisible= true;
	    this.control.content.findName("visstudio").IsHitTestVisible= false;
	    this.control.content.findName("sqlserver").IsHitTestVisible= false;		

		if(showOverlayer) {
			if(this.btnOpen) {
				this.control.content.findName("openWinserver").Begin();				
				this.control.content.findName("closeVisstudio").Begin();				
				this.control.content.findName("closeSqlserver").Begin();
			} else {
				this.control.content.findName("showWinserver").Begin();
				this.control.content.findName("hideVisstudio").Begin();
				this.control.content.findName("hideSqlserver").Begin();
			}
		}
		this.btnOpen = true;
	},
	btn1_out: function(sender, eventArgs) {	    
		this.control.content.findName("btn1_out").Begin();
	},
	btn2_over: function(sender, eventArgs) {
		this.control.content.findName("btn2_over").Begin();
		document.getElementById("shortcuts").style.zIndex = 99;    

	    this.control.content.findName("winserver").IsHitTestVisible= false;
	    this.control.content.findName("visstudio").IsHitTestVisible= true;
	    this.control.content.findName("sqlserver").IsHitTestVisible= false;		
		
		if(showOverlayer) {
			if(this.btnOpen) {
				this.control.content.findName("closeWinserver").Begin();
				this.control.content.findName("openVisstudio").Begin();
				this.control.content.findName("closeSqlserver").Begin();
			} else {
				this.control.content.findName("hideWinserver").Begin();
				this.control.content.findName("showVisstudio").Begin();
				this.control.content.findName("hideSqlserver").Begin();
			}
		}
		this.btnOpen = true;
	},
	btn2_out: function(sender, eventArgs) {	    
		this.control.content.findName("btn2_out").Begin();
	},
	btn3_over: function(sender, eventArgs) {
	    document.getElementById("shortcuts").style.zIndex = 99;    
		this.control.content.findName("btn3_over").Begin();
		
	    this.control.content.findName("winserver").IsHitTestVisible= false;
	    this.control.content.findName("visstudio").IsHitTestVisible= false;
	    this.control.content.findName("sqlserver").IsHitTestVisible= true;		
		
		
		if(showOverlayer) {
			if(this.btnOpen) {
				this.control.content.findName("closeWinserver").Begin();
				this.control.content.findName("closeVisstudio").Begin();
				this.control.content.findName("openSqlserver").Begin();
			} else {
				this.control.content.findName("hideWinserver").Begin();
				this.control.content.findName("hideVisstudio").Begin();
				this.control.content.findName("showSqlserver").Begin();
			}
		}
		this.btnOpen = true;
	},
	btn3_out: function(sender, eventArgs) {
	    
		this.control.content.findName("btn3_out").Begin();
	},
	hideButtons: function(sender, eventArgs) {
	    document.getElementById("shortcuts").style.zIndex = -1;    
		this.btnOpen = false;
		this.control.content.findName("hideWinserver").Begin();
		this.control.content.findName("hideVisstudio").Begin();
		this.control.content.findName("hideSqlserver").Begin();
	},
	getUrl: function(sender, eventArgs) {
		switch(sender.name) {
			case "button1":			window.location = 'products_winserver.aspx'; break;
			case "button2":			window.location = 'products_visualstudio.aspx'; break;
			case "button3":			window.location = 'products_sqlserver.aspx'; break;
			case "learn_more1":		window.location = 'products_winserver.aspx'; break;
			case "test_drive1":		window.location = 'http://www.microsoft.com/heroeshappenhere/TestDrive/windows-server-2008/default.mspx'; break;
			case "download_trial1":	window.location = 'http://www.microsoft.com/ws08eval/'; break;
			case "learn_more2":		window.location = 'products_visualstudio.aspx'; break;
			case "test_drive2":		window.location = 'http://www.microsoft.com/heroeshappenhere/TestDrive/visual-studio-2008/default.mspx'; break;
			case "download_trial2":	window.location = 'http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx'; break;
			case "learn_more3":		window.location = 'products_sqlserver.aspx'; break;
			case "test_drive3":		window.location = 'http://www.microsoft.com/heroeshappenhere/TestDrive/sql-server-2008/default.mspx'; break;
			case "download_trial3":	window.location = 'http://technet.microsoft.com/nl-be/bb851664(en-us).aspx'; break;
		}
	}
}