﻿
   //alert('hi');
        var available=false;
    	if(navigator.plugins["Silverlight Plug-In"]){available=true;}
    	var b;
    	try{
    	   try{ b = new ActiveXObject("AgControl.AgControl");}catch(e){}
    	}
    	catch (e)
    	{
    	//continue;
    	  //  alert(Error.message);
    	}
    
    	if(b!=null){available=true;b=null;}
    	
    	function hyperlink_MouseLeftButtonDown(sender, args) {
            window.location = "http://www.eatitnow.co.uk/storeinformationrequest.aspx";
            //onewwindow=window.open("http://www.eatitnow.co.uk");
        }
        function subwayhyperlink_MouseLeftButtonDown(sender,args) {
            onewwindow=window.open("http://www.subwaywarrington.co.uk","_blank");
        }
        function bringadrinkhyperlink_MouseLeftButtonDown(sender, args)
        {
            window.location = "http://www.eatitnow.co.uk/TabbedMenu.aspx?StoreID=AF049638-7DA7-4DAF-9FB1-0149A8176D1C";
        }        
        
        function createSilverlight()
		{
		    //alert('hi');
			//var scene = new SignupAnim.Page();
			Silverlight.createObjectEx({
				source: "../xaml/signup/Signup.xaml",
				parentElement: document.getElementById("SilverLightDivPane"),
				id: "SilverlightControl",
				properties: {
					width: "125px",
					height: "150px",
					version: "1.0"
				},
				events: {
					//onLoad: Silverlight.createDelegate(scene, scene.handleLoad),
					onError: function(sender, args) {
						var errorDiv = document.getElementById("errorLocation");
						if (errorDiv != null) {
							var errorText = args.errorType + "- " + args.errorMessage;
									
							if (args.ErrorType == "ParserError") {
								errorText += "<br />File: " + args.xamlFile;
								errorText += ", line " + args.lineNumber;
								errorText += " character " + args.charPosition;
							}
							else if (args.ErrorType == "RuntimeError") {
								errorText += "<br />line " + args.lineNumber;
								errorText += " character " +  args.charPosition;
							}
							errorDiv.innerHTML = errorText;
						}	
					}
				}
			});
		
			//now create subway advert
			Silverlight.createObjectEx({
				source: "../xaml/subwayadvert/subwayadvert.xaml",
				parentElement: document.getElementById("SubwayWarringtonDIV"),
				id: "SubwaySilverlightControl",
				properties: {
					width: "125px",
					height: "700px",
					version: "1.0"
				},
				events: {
					//onLoad: Silverlight.createDelegate(scene, scene.handleLoad),
					onError: function(sender, args) {
						var errorDiv = document.getElementById("errorLocation");
						if (errorDiv != null) {
							var errorText = args.errorType + "- " + args.errorMessage;
									
							if (args.ErrorType == "ParserError") {
								errorText += "<br />File: " + args.xamlFile;
								errorText += ", line " + args.lineNumber;
								errorText += " character " + args.charPosition;
							}
							else if (args.ErrorType == "RuntimeError") {
								errorText += "<br />line " + args.lineNumber;
								errorText += " character " +  args.charPosition;
							}
							errorDiv.innerHTML = errorText;
						}	
					}
				}
			});
			
			//now create subway advert
			/*Silverlight.createObjectEx({
				source: "../XAML/BringADrinkAd/BringADrinkAd.xaml",
				parentElement: document.getElementById("LeftSidebarSilverlight"),
				id: "LeftSidebarSilverlightControl",
				properties: {
					width: "125px",
					height: "700px",
					version: "1.0"
				},
				events: {
					//onLoad: Silverlight.createDelegate(scene, scene.handleLoad),
					onError: function(sender, args) {
						var errorDiv = document.getElementById("errorLocation");
						if (errorDiv != null) {
							var errorText = args.errorType + "- " + args.errorMessage;
									
							if (args.ErrorType == "ParserError") {
								errorText += "<br />File: " + args.xamlFile;
								errorText += ", line " + args.lineNumber;
								errorText += " character " + args.charPosition;
							}
							else if (args.ErrorType == "RuntimeError") {
								errorText += "<br />line " + args.lineNumber;
								errorText += " character " +  args.charPosition;
							}
							errorDiv.innerHTML = errorText;
						}	
					}
				}
			});*/
			
		}
		
		if (!window.Silverlight) 
			Silverlight = {};

		Silverlight.createDelegate = function(instance, method) {
			return function() {
				return method.apply(instance, arguments);
			}
			
			
		}
		
		function pageLoad()
		{
		    //DoCenterMenu(null);
		    
		    if (available)
		    {
		        createSilverlight();
		    }
		}
