﻿ var gender = null;
 var face = null;
 var dots="";
 var nuts="";
 var hots="";
 var path=null;
 
 
  if (!window.wunderchristmas)
	window.wunderchristmas = {};

Silverlight.createDelegate = function(instance, method) {
	return function() {
		return method.apply(instance, arguments);
	}
}

function createHolidayPage()
{
	var scene = new wunderchristmas.Page();
	Silverlight.createObjectEx({
		source: "XAML/HolidayPage.xaml",
		parentElement: document.getElementById("div_Content"),
		id: "SilverlightControl",
		properties: {
			width: "100%",
			height: "100%",
			version: "1.0",
			isWindowless: 'true'
		},
		events: {
			onLoad: Silverlight.createDelegate(scene, scene.handleLoad),
			onError: function(){}
		}
	});
}
 
wunderchristmas.Page = function() 
{
}

wunderchristmas.Page.prototype =
{
    
	handleLoad: function(control, userContext, rootElement) 
	{
		this.control = control;
		
		//var page = this.control.findName("Page");
		
		//var top = page["Canvas.Top"];
		//var left = page["Canvas.Left"];
		
		var qs = null;
		qs = checkQueryString();
		
		//alert(qs);
		
		if (qs == null || qs == "")
		{
		    this.control.content.findName("card").Visibility = "Collapsed";
		
		    this.control.content.findName("faces").Visibility="Collapsed";
		    //this.control.content.findName("introPan").Visibility="Collapsed";
		
		    this.control.content.findName("cookesPan").Visibility="Collapsed";
		    this.control.content.findName("fella").Visibility="Collapsed";
		    this.control.content.findName("chick").Visibility="Collapsed";
		    //this.control.content.findName{"postIt").Visibility = "Collapsed";
		
		    this.control.content.findName("hot14").Visibility = "Collapsed";
		    this.control.content.findName("hot13").Visibility = "Collapsed";
		
		    this.control.content.findName("getStartedAgain").Visibility ="Collapsed";
		    this.control.content.findName("panGuyIn").Begin();
		    this.control.content.findName("getStarted").Visibility="Visible";
		    
		    //Decorations
		this.control.content.findName("blue").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("blue").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("blue").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("red").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("red").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("red").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("purple").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("purple").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("purple").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("green").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("green").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("green").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("yellow").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("yellow").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("yellow").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("white").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("white").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("white").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("nut1").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("nut1").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("nut1").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("nut2").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("nut2").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("nut2").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("nut3").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("nut3").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("nut3").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("nut4").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("nut4").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("nut4").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("nut5").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("nut5").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("nut5").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("nut6").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("nut6").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("nut6").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("nut7").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("nut7").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("nut7").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("nut8").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("nut8").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("nut8").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("nut9").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("nut9").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("nut9").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("nut10").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("nut10").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("nut10").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("nut11").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("nut11").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("nut11").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("nut12").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("nut12").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("nut12").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("nut13").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("nut13").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("nut13").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("nut14").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("nut14").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("nut14").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("nut15").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("nut15").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("nut15").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("hot1").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("hot1").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("hot1").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("hot2").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("hot2").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("hot2").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("hot3").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("hot3").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("hot3").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("hot4").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("hot4").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("hot4").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("hot5").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("hot5").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("hot5").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("hot6").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("hot6").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("hot6").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("hot7").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("hot7").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("hot7").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("hot8").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("hot8").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("hot8").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("hot9").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("hot9").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("hot9").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("hot10").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("hot10").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("hot10").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("hot11").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("hot11").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("hot11").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("hot12").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("hot12").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("hot12").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("hot13").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("hot13").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("hot13").addEventListener("MouseLeftButtonUp","onMouseUp");
		this.control.content.findName("hot14").addEventListener("MouseLeftButtonDown","onMouseDown");
		this.control.content.findName("hot14").addEventListener("MouseMove","onMouseMove");
		this.control.content.findName("hot14").addEventListener("MouseLeftButtonUp","onMouseUp");
		
		//Dishes
		this.control.content.findName("nutcup").addEventListener("MouseEnter","onNutCupEnter");
		this.control.content.findName("nutcup").addEventListener("MouseLeave","onNutCupLeave");
		this.control.content.findName("hotCup").addEventListener("MouseEnter","onHotsCupEnter");
		this.control.content.findName("hotCup").addEventListener("MouseLeave","onHotsCupLeave");
		this.control.content.findName("dotCup").addEventListener("MouseEnter","onDotCupEnter");
		this.control.content.findName("dotCup").addEventListener("MouseLeave","onDotCupLeave");
		    
		}
		else
		{   
		    this.control.content.findName("card").Visibility = "Collapsed";
		    this.control.content.findName("faces").Visibility="Collapsed";
		    this.control.content.findName("postIt").Visibility = "Collapsed";
		    this.control.content.findName("getStartedAgain").Visibility ="Visible";
		    this.control.content.findName("hot13").Visibility = "Collapsed";
		    this.control.content.findName("hot14").Visibility = "Collapsed";
		    
		    this.control.content.findName("shareAgainIn").Begin();
            this.control.content.findName("startAgainIn").Begin();
            this.control.content.findName("greetingIn").Begin();
		    
		    //this.control.content.findName("nutcup").Visibility = "Collapsed";
		    //this.control.content.findName("hotCup").Visibility = "Collapsed";
		    //this.control.content.findName("dotCup").Visibility = "Collapsed";
		    //this.control.content.findName("cookesPan").Visibility="Collapsed";
		    
		    reconstructCookie(control);   
		}
		
		
		//Get Started Button
		this.control.content.findName("getStarted").addEventListener("MouseEnter", this.onStartedEnter);
		this.control.content.findName("getStarted").addEventListener("MouseLeave", this.onStartedLeave);
		this.control.content.findName("getStarted").addEventListener("MouseLeftButtonDown", this.onStartedClick);
		
		this.control.content.findName("getStartedAgain").addEventListener("MouseEnter", this.onStartedAgainEnter);
		this.control.content.findName("getStartedAgain").addEventListener("MouseLeave", this.onStartedAgainLeave);
		this.control.content.findName("getStartedAgain").addEventListener("MouseLeftButtonDown", this.onStartedAgainClick);
		
		//Male Cookie
		this.control.content.findName("fella").addEventListener("MouseLeftButtonDown", "onGuyClick");
		//this.control.content.findName("fella").addEventListener("MouseEnter", this.onGuyEnter);
		//this.control.content.findName("fella").addEventListener("MouseLeave",this.onGuyLeave);
		
		//Female Cookie
		this.control.content.findName("chick").addEventListener("MouseLeftButtonDown", "onGirlClick");
		//this.control.content.findName("chick").addEventListener("MouseEnter", this.onGirlEnter);
		//this.control.content.findName("chick").addEventListener("MouseLeave", this.onGirlLeave);
		
		//Transitions
		this.control.content.findName("panGuyOut").addEventListener("Completed", this.onPanGuyCompleted);
		this.control.content.findName("panIn").addEventListener("Completed", this.onPanInCompleted);
		
		//Faces
		this.control.content.findName("naughtyOff").addEventListener("MouseLeftButtonDown",this.onNaughtyClick);
		this.control.content.findName("niceOff").addEventListener("MouseLeftButtonDown",this.onNiceClick);
		this.control.content.findName("ohNoOff").addEventListener("MouseLeftButtonDown",this.onOhNoClick);
		//this.control.content.findName("naughtyOff").addEventListener("MouseEnter",this.onNaughtyEnter);
		//this.control.content.findName("niceOff").addEventListener("MouseEnter",this.onNiceEnter);
		//this.control.content.findName("ohNoOff").addEventListener("MouseEnter",this.onOhNoEnter);
		//this.control.content.findName("naughtyOff").addEventListener("MouseLeave",this.onNaughtyLeave);
		//this.control.content.findName("niceOff").addEventListener("MouseLeave",this.onNiceLeave);
		//this.control.content.findName("ohNoOff").addEventListener("MouseLeave",this.onOhNoLeave);
		
		
		
		//Next Button
		this.control.content.findName("nextOn").addEventListener("MouseLeftButtonDown", this.onNextClick);
		this.control.content.findName("nextOff").addEventListener("MouseEnter", this.onNextEnter);
		this.control.content.findName("nextOn").addEventListener("MouseLeave", this.onNextLeave);
		
		//I'm Done Button
		this.control.content.findName("doneOn").addEventListener("MouseLeftButtonDown", this.onDoneClick);
		this.control.content.findName("doneOff").addEventListener("MouseEnter", this.onDoneEnter);
		this.control.content.findName("doneOn").addEventListener("MouseLeave", this.onDoneLeave);
		
		//Send Button
		this.control.content.findName("sendOn").addEventListener("MouseLeftButtonDown", this.onSendClick);
		this.control.content.findName("sendOff").addEventListener("MouseEnter", this.onSendEnter);
		this.control.content.findName("sendOn").addEventListener("MouseLeave", this.onSendLeave);
		
	},
	
	// Sample event handler
	handleMouseDown: function(sender, eventArgs) 
	{
		// The following line of code shows how to find an element by name and call a method on it.
		// this.control.content.findName("Storyboard1").Begin();
	},
	
	onStartedEnter: function(sender, eventArgs)
	{
	    var host = sender.GetHost();
	    
	    //alert('event entered');
	    
	    host.content.findName("arrowLight").Visibility = "Visible";
	    host.content.findName("gsArrowOn").Begin();
	    
    },
    
    onStartedLeave: function(sender, eventArgs)
	{
	    var host = sender.GetHost();
	    
	    host.content.findName("gsArrowOff").Begin();
    },
    
    onStartedClick: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("panGuyOut").Begin();      
    },
    
    onStartedAgainEnter: function(sender, eventArgs)
	{
	    var host = sender.GetHost();
	    
	    //alert('event entered');
	    
	    host.content.findName("arrowLight").Visibility = "Visible";
	    host.content.findName("gsArrowOn").Begin();
	    
    },
    
    onStartedAgainLeave: function(sender, eventArgs)
	{
	    var host = sender.GetHost();
	    
	    host.content.findName("gsArrowOff").Begin();
    },
    
    onStartedAgainClick: function(sender, eventArgs)
    {
        //var host = sender.GetHost();
        
        //host.content.findName("panGuyOut").Begin();
        
        var href = window.location.href;
        
        var root = href.substring(0, href.length - window.location.search.length);
        
        //alert(root);
        
        window.location.href= root;      
    },
    
    onPanGuyCompleted: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("panIn").Begin();
        //host.content.findName("postItIn").Begin();
        
        //host.content.findName("cookesPan").Visibility="Visible";
		//host.content.findName("fella").Visibility="Visible";
		//host.content.findName("chick").Visibility="Visible";
        
    },
    
    onNextEnter: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("nextOff").Opacity = 0.0;
        host.content.findName("nextOff").Visibility = "Collapsed";
        host.content.findName("nextOn").Opacity = 1.0;
        host.content.findName("nextOn").Visibility = "Visible";
    },
    
    onNextLeave: function(sender, eventArgs)
    {
      var host = sender.GetHost();
      
      host.content.findName("nextOff").Opacity = 1.0;
      host.content.findName("nextOn").Opacity = 0.0;
      host.content.findName("nextOff").Visibility = "Visible";
      host.content.findName("nextOn").Visibility = "Collapsed";
    },
    
    onNextClick: function(sender, eventArgs)
    {
      var host = sender.GetHost();
      
      if (path == "shape")
      {
        if (gender == "f")
        {
            host.content.findName("chick").Visibility = "Collapsed";
            host.content.findName("chooseShape").Visibility="Collapsed";
            host.content.findName("chooseFace").Visibility="Visible";
            host.content.findName("naughtyOn").Opacity = 0.0;
            host.content.findName("niceOn").Opacity = 0.0;
            host.content.findName("ohNoOn").Opacity = 0.0;
            host.content.findName("faces").Visibility="Visible";
            host.content.findName("decorate").Visibility="Collapsed";
            host.content.findName("fellaOn").Visibility= "Collapsed";
            host.content.findName("fellaOff").Visibility = "Visible";
            host.content.findName("fellaOn").Opacity = 0.0;
            host.content.findName("fellaOff").Opacity = 1.0;
            host.content.findName("fella").removeEventListener("MouseLeftButtonDown", "onGuyClick");
            host.content.findName("fellaCenter").Begin();
            
            path="face";
        }
        else if (gender =="c")
        {
            host.content.findName("fella").Visibility = "Collapsed";
            host.content.findName("chooseShape").Visibility="Collapsed";
            host.content.findName("chooseFace").Visibility="Visible";
            host.content.findName("naughtyOn").Opacity = 0.0;
            host.content.findName("niceOn").Opacity = 0.0;
            host.content.findName("ohNoOn").Opacity = 0.0;
            host.content.findName("faces").Visibility="Visible";
            host.content.findName("decorate").Visibility="Collapsed";
            host.content.findName("chickOn").Visibility= "Collapsed";
            host.content.findName("chickOff").Visibility = "Visible";
            host.content.findName("chickOn").Opacity = 0.0;
            host.content.findName("chickOff").Opacity = 1.0;
            host.content.findName("chick").removeEventListener("MouseLeftButtonDown", "onGirlClick");
            host.content.findName("chickCenter").Begin();
            
            path="face";
        }
        else
        {
            alert("Please click on a shape to continue!");
        }
        
        
      }
      else
      {
        if (face == "n")
        {
            
            if (gender == "f")
            {
                host.content.findName("nice").Visibility="Visible";
                host.content.findName("naughty").Visibility="Collapsed";
                host.content.findName("ohNo").Visibility="Collapsed";
            }
            else
            {
                host.content.findName("chickNice").Visibility="Visible";
                host.content.findName("chickNaughty").Visibility="Collapsed";
                host.content.findName("chickOhno").Visibility="Collapsed";
            }
            
            host.content.findName("faces").Visibility = "Collapsed";
            host.content.findName("decorate").Visibility = "Visible";
        
            host.content.findName("cupsIn").Begin();
        
            host.content.findName("hotCup").Visibility="Visible";
		    host.content.findName("dotCup").Visibility="Visible";
		    host.content.findName("nutcup").Visibility="Visible";
		    host.content.findName("doneOff").Opacity = 1.0;
		    host.content.findName("doneOff").Visibility = "Visible";
		
		    host.content.findName("nextOff").Opacity = 0.0;
		    host.content.findName("nextOff").Visibility = "Collapsed";
		    host.content.findName("nextOn").Opacity = 0.0;
		    host.content.findName("nextOn").Visibility = "Collapsed";           
        }
        else if (face == "a")
        {
            if (gender == "f")
            {
                host.content.findName("naughty").Visibility="Visible";
                host.content.findName("nice").Visibility="Collapsed";
                host.content.findName("ohNo").Visibility="Collapsed";
            }
            else
            {
                host.content.findName("chickNaughty").Visibility="Visible";
                host.content.findName("chickNice").Visibility="Collapsed";
                host.content.findName("chickOhno").Visibility="Collapsed";
            }
            
            host.content.findName("faces").Visibility = "Collapsed";
            host.content.findName("decorate").Visibility = "Visible";
        
            host.content.findName("cupsIn").Begin();
        
            host.content.findName("hotCup").Visibility="Visible";
		    host.content.findName("dotCup").Visibility="Visible";
		    host.content.findName("nutcup").Visibility="Visible";
		    host.content.findName("doneOff").Opacity = 1.0;
		    host.content.findName("doneOff").Visibility = "Visible";
		
		    host.content.findName("nextOff").Opacity = 0.0;
		    host.content.findName("nextOff").Visibility = "Collapsed";
		    host.content.findName("nextOn").Opacity = 0.0;
		    host.content.findName("nextOn").Visibility = "Collapsed";        
        }
        else if (face =="o")
        {
            if (gender == "f")
            {
                host.content.findName("ohNo").Visibility="Visible";
                host.content.findName("nice").Visibility="Collapsed";
                host.content.findName("naughty").Visibility="Collapsed";
            
            }
            else
            {
                host.content.findName("chickOhno").Visibility="Visible";
                host.content.findName("chickNice").Visibility="Collapsed";
                host.content.findName("chickNaughty").Visibility="Collapsed";
            }
            
            host.content.findName("faces").Visibility = "Collapsed";
            host.content.findName("decorate").Visibility = "Visible";
        
            host.content.findName("cupsIn").Begin();
        
            host.content.findName("hotCup").Visibility="Visible";
		    host.content.findName("dotCup").Visibility="Visible";
		    host.content.findName("nutcup").Visibility="Visible";
		    host.content.findName("doneOff").Opacity = 1.0;
		    host.content.findName("doneOff").Visibility = "Visible";
		
		    host.content.findName("nextOff").Opacity = 0.0;
		    host.content.findName("nextOff").Visibility = "Collapsed";
		    host.content.findName("nextOn").Opacity = 0.0;
		    host.content.findName("nextOn").Visibility = "Collapsed";    
        }
        else
        {
            alert("Please click on a face to continue!");
        }
        
      }
      
      
        
    },
    
    onDoneClick: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("getStartedAgain").Visibility = "Visible";
        host.content.findName("shareAgainIn").Begin();
        host.content.findName("startAgainIn").Begin();
        host.content.findName("greetingIn").Begin();
        
        host.content.findName("staf").Visibility = "Visible";
        host.content.findName("decorate").Visibility = "Collapsed";
        host.content.findName("doneOff").Visibility = "Collapsed";
        host.content.findName("doneOn").Visibility = "Collapsed";
        host.content.findName("sendOn").Visibility = "Collapsed";
        host.content.findName("sendOn").Opacity = 0.0;
        host.content.findName("yourName").Visibility = "Collapsed";
        host.content.findName("yourNameBlock").Visibility = "Collapsed";
        host.content.findName("yourFriend").Visibility = "Collapsed";
        host.content.findName("yourFriendBlock").Visibility = "Collapsed";
        host.content.findName("addy").Visibility = "Collapsed";
        host.content.findName("addyBlock").Visibility = "Collapsed";
        
        //Lock position of decorations by disabling drag and drop.
        host.content.findName("blue").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("blue").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("blue").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("red").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("red").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("red").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("purple").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("purple").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("purple").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("white").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("white").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("white").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("yellow").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("yellow").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("yellow").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("green").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("green").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("green").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("nut1").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("nut1").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("nut1").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("nut2").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("nut2").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("nut2").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("nut3").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("nut3").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("nut3").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("nut4").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("nut4").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("nut4").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("nut5").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("nut5").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("nut5").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("nut6").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("nut6").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("nut6").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("nut7").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("nut7").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("nut7").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("nut8").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("nut8").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("nut8").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("nut9").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("nut9").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("nut9").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("nut10").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("nut10").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("nut10").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("nut11").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("nut11").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("nut11").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("nut12").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("nut12").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("nut12").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("nut13").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("nut13").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("nut13").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("nut14").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("nut14").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("nut14").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("nut15").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("nut15").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("nut15").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("hot1").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("hot1").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("hot1").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("hot2").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("hot2").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("hot2").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("hot3").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("hot3").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("hot3").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("hot4").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("hot4").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("hot4").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("hot5").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("hot5").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("hot5").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("hot6").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("hot6").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("hot6").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("hot7").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("hot7").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("hot7").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("hot8").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("hot8").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("hot8").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("hot9").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("hot9").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("hot9").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("hot10").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("hot10").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("hot10").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("hot11").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("hot11").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("hot11").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("hot12").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("hot12").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("hot12").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("hot13").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("hot13").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("hot13").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        host.content.findName("hot14").removeEventListener("MouseLeftButtonDown","onMouseDown");
        host.content.findName("hot14").removeEventListener("MouseMove", "onMouseMove");
        host.content.findName("hot14").removeEventListener("MouseLeftButtonUp", "onMouseUp");
        
        //Disable hover state on bowls once decorations are locked.
        host.content.findName("nutcup").removeEventListener("MouseEnter", "onNutCupEnter");
        host.content.findName("nutcup").removeEventListener("MouseLeave", "onNutCupLeave");
        host.content.findName("hotCup").removeEventListener("MouseEnter", "onHotsCupEnter");
        host.content.findName("hotCup").removeEventListener("MouseLeave", "onHotsCupLeave");
        host.content.findName("dotCup").removeEventListener("MouseEnter", "onDotCupEnter");
        host.content.findName("dotCup").removeEventListener("MouseLeave", "onDotCupLeave");
    },
    
    onDoneEnter: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("doneOff").Visibility = "Collapsed";
        host.content.findName("doneOn").Visibility = "Visible";
        host.content.findName("doneOff").Opacity = 0.0;
        host.content.findName("doneOn").Opacity = 1.0;
        
       
    },
    
    onDoneLeave: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("doneOff").Visibility = "Visible";
        host.content.findName("doneOn").Visibility = "Collapsed";
        host.content.findName("doneOff").Opacity = 1.0;
        host.content.findName("doneOn").Opacity = 0.0;
    },
    
    onSendClick: function(sender, eventArgs)
    {
        var qstring = "?s="+ gender + "&f=" + face + "&" + dots + hots + nuts;
        
        window.location.href = "mailto:?subject=" + encodeURIComponent("Happy Holidays (courtesy of the Windows Live and Microsoft Silverlight teams).")+ "&body=" + encodeURIComponent("Happy Holidays with this sweet holiday card I customized just for you (in the link below). You can also customize it and send to your friends to share your own holiday cheer.") + "%0A%0A" + window.location.href + encodeURIComponent(qstring.substring(0,qstring.length - 1));
    },
    
    onSendEnter: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("sendOff").Visibility = "Collapsed";
        host.content.findName("sendOn").Visibility = "Visible";
        host.content.findName("sendOff").Opacity = 0.0;
        host.content.findName("sendOn").Opacity = 1.0;   
    },
    
    onSendLeave: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("sendOff").Visibility = "Visible";
        host.content.findName("sendOn").Visibility = "Collapsed";
        host.content.findName("sendOff").Opacity = 1.0;
        host.content.findName("sendOn").Opacity = 0.0;   
    },
    
    onPanInCompleted: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("guyIn").Begin();
        //host.content.findName("postitIn").Begin();
        
        path = "shape";
        
        host.content.findName("nextOff").Opacity = 1.0;
        host.content.findName("nextOff").Visibility = "Visible";
		//host.content.findName("next").Visibility = "Visible";
        
        host.content.findName("pan").Opacity=0.0;
        host.content.findName("cookesPan").Visibility="Visible";
		host.content.findName("fella").Visibility="Visible";
		host.content.findName("chick").Visibility="Visible";
		host.content.findName("hotCup").Visibility="Collapsed";
		host.content.findName("dotCup").Visibility="Collapsed";
		host.content.findName("nutcup").Visibility="Collapsed";
		
        
    },
    
   
    
    /*onGuyEnter: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("fellaOn").Visibility= "Visible";
        host.content.findName("fellaOff").Visibility = "Collapsed";
        host.content.findName("fellaOn").Opacity = 1.0;
        host.content.findName("fellaOff").Opacity = 0.0;    
    },*/
    
    /*onGuyLeave: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("fellaOn").Visibility= "Collapsed";
        host.content.findName("fellaOff").Visibility = "Visible";
        host.content.findName("fellaOn").Opacity = 0.0;
        host.content.findName("fellaOff").Opacity = 1.0;    
    },*/
    
    /*onGirlEnter: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("chickOn").Visibility= "Visible";
        host.content.findName("chickOff").Visibility = "Collapsed";
        host.content.findName("chickOn").Opacity = 1.0;
        host.content.findName("chickOff").Opacity = 0.0;    
        
    },*/
    
    /*onGirlLeave: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("chickOn").Visibility= "Collapsed";
        host.content.findName("chickOff").Visibility = "Visible";
        host.content.findName("chickOn").Opacity = 0.0;
        host.content.findName("chickOff").Opacity = 1.0;    
    },*/
    
   
    
    onNiceClick: function(sender, eventArgs)
    {
        
        var host = sender.GetHost();
        
        host.content.findName("niceOff").Opacity=0.0;
        host.content.findName("niceOn").Opacity=1.0;
        
        host.content.findName("naughtyOff").Opacity=1.0;
         host.content.findName("naughtyOn").Opacity=0.0;
         
         host.content.findName("ohNoOff").Opacity=1.0;
        host.content.findName("ohNoOn").Opacity=0.0;
        
        
        
        if (gender == "f")
        {
            host.content.findName("nice").Visibility="Visible";
            host.content.findName("naughty").Visibility="Collapsed";
            host.content.findName("ohNo").Visibility="Collapsed";
        }
        else
        {
            host.content.findName("chickNice").Visibility="Visible";
            host.content.findName("chickNaughty").Visibility="Collapsed";
            host.content.findName("chickOhno").Visibility="Collapsed";
        }
        
         face = "n";
         
        /*host.content.findName("faces").Visibility = "Collapsed";
        host.content.findName("decorate").Visibility = "Visible";
        
        host.content.findName("cupsIn").Begin();
        
        host.content.findName("hotCup").Visibility="Visible";
		host.content.findName("dotCup").Visibility="Visible";
		host.content.findName("nutcup").Visibility="Visible";
		
		host.content.findName("doneOff").Opacity = 1.0;
		host.content.findName("doneOff").Visibility = "Visible";*/
    },
    
    onNaughtyClick: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("naughtyOff").Opacity=0.0;
         host.content.findName("naughtyOn").Opacity=1.0;
         
         host.content.findName("niceOff").Opacity=1.0;
        host.content.findName("niceOn").Opacity=0.0;
        
        host.content.findName("ohNoOff").Opacity=1.0;
        host.content.findName("ohNoOn").Opacity=0.0;
        
        
        
        if (gender == "f")
        {
            host.content.findName("naughty").Visibility="Visible";
            host.content.findName("nice").Visibility="Collapsed";
            host.content.findName("ohNo").Visibility="Collapsed";
        }
        else
        {
            host.content.findName("chickNaughty").Visibility="Visible";
            host.content.findName("chickNice").Visibility="Collapsed";
            host.content.findName("chickOhno").Visibility="Collapsed";
        }
        
        face = "a";
        
        /*host.content.findName("faces").Visibility = "Collapsed";
        host.content.findName("decorate").Visibility = "Visible";
        
        host.content.findName("cupsIn").Begin();
        
        host.content.findName("hotCup").Visibility="Visible";
		host.content.findName("dotCup").Visibility="Visible";
		host.content.findName("nutcup").Visibility="Visible";
		
		host.content.findName("doneOff").Opacity = 1.0;
		host.content.findName("doneOff").Visibility = "Visible";*/
        
        
    },
    
    onOhNoClick: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("ohNoOff").Opacity=0.0;
        host.content.findName("ohNoOn").Opacity=1.0;
        
        host.content.findName("naughtyOff").Opacity=1.0;
        host.content.findName("naughtyOn").Opacity=0.0;
         
        host.content.findName("niceOff").Opacity=1.0;
        host.content.findName("niceOn").Opacity=0.0;
         
         
         
         
        
        if (gender == "f")
        {
            host.content.findName("ohNo").Visibility="Visible";
            host.content.findName("nice").Visibility="Collapsed";
            host.content.findName("naughty").Visibility="Collapsed";
            
        }
        else
        {
            host.content.findName("chickOhno").Visibility="Visible";
            host.content.findName("chickNice").Visibility="Collapsed";
            host.content.findName("chickNaughty").Visibility="Collapsed";
        }
        
        face ="o";
        
        /*host.content.findName("faces").Visibility = "Collapsed";
        host.content.findName("decorate").Visibility = "Visible";
        
        host.content.findName("cupsIn").Begin();
        
        host.content.findName("hotCup").Visibility="Visible";
		host.content.findName("dotCup").Visibility="Visible";
		host.content.findName("nutcup").Visibility="Visible";
		host.content.findName("doneOff").Opacity = 1.0;
		host.content.findName("doneOff").Visibility = "Visible";*/
		
        
        
        
    },
    
    
    onNiceEnter: function(sender,eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("niceOff").Opacity=0.0;
        host.content.findName("niceOn").Opacity=1.0;
    },
    
    onNaughtyEnter: function(sender,eventArgs)
    {
         var host = sender.GetHost();
        
         host.content.findName("naughtyOff").Opacity=0.0;
         host.content.findName("naughtyOn").Opacity=1.0;
    },
    
    onOhNoEnter: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("ohNoOff").Opacity=0.0;
        host.content.findName("ohNoOn").Opacity=1.0;
    },
    
    onNaughtyLeave: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
         host.content.findName("naughtyOff").Opacity=1.0;
         host.content.findName("naughtyOn").Opacity=0.0;
    },
    
    onNiceLeave: function(sender, eventArgs)
    {
        var host = sender.GetHost();
        
        host.content.findName("niceOff").Opacity=1.0;
        host.content.findName("niceOn").Opacity=0.0;
    },
    
    onOhNoLeave: function(sender, eventArgs)
    {
         var host = sender.GetHost();
        
        host.content.findName("ohNoOff").Opacity=1.0;
        host.content.findName("ohNoOn").Opacity=0.0;
    }	
}

// Define state variables for drag and drop operation.
var beginX;
var beginY;
var isMouseDown = false;

// Start drag and drop operation.
function onMouseDown(sender, mouseEventArgs)
{
    
    // Retrieve the current position of the mouse.
    //alert(mouseEventArgs.getPosition(null).x);
    //alert(mouseEventArgs.getPosition(null).y);
    
    //alert("MouseDown");
    // Set the beginning position of the mouse.
    beginX = mouseEventArgs.getPosition(null).x;
    beginY = mouseEventArgs.getPosition(null).y;
    
    

    isMouseDown = true;

    // Ensure this object is the only one receiving mouse events.
    sender.captureMouse();
    
}

// Reposition object during drag and drop operation.
function onMouseMove(sender, mouseEventArgs)
{
    //alert("MouseMove");
    // Determine whether the mouse button is down.
    // If so, move the object.
    
    if (isMouseDown == true)
    {
        
        
        // Retrieve the current position of the mouse.
        var currX = mouseEventArgs.getPosition(null).x;
        var currY = mouseEventArgs.getPosition(null).y;
        
        if((currX < 20 || currX > 780) || (currY < 20 || currY > 580 ))
        {
            
           
            isMouseDown = false;
            sender.releaseMouseCapture();
            return;
            
        }
        else
        {
        
            // Reset the location of the object.
            sender["Canvas.Left"] += currX - beginX;
            sender["Canvas.Top"] += currY - beginY;

            // Update the beginning position of the mouse.
            beginX = currX;
            beginY = currY;
        }
         
    }
}



// Stop drag and drop operation.
function onMouseUp(sender, mouseEventArgs)
{
    //alert("MouseUp");
    isMouseDown = false;

    // Allow all objects to receive mouse events.    
    sender.releaseMouseCapture();
    
    switch (sender.Name)
    {
        case "blue":
        {
            var index = dots.indexOf("b=");
            if (index >= 0)
            {
                var string = dots.substring(index);
                var points = string.substring(2,string.indexOf("&"));
                
                //var replace = dots.indexOf(points);
                
                dots = dots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                 
            }   
            else
                dots += "b=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "red":
        {
            var index = dots.indexOf("r=");
            if (index >= 0)
            {
                var string = dots.substring(index);
                var points = string.substring(2,string.indexOf("&"));
                
                //var replace = dots.indexOf(points);
                
                dots = dots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
            }
            else
                dots += "r=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "green":
        {
            var index = dots.indexOf("g=");
            if (index >= 0)
            {
                var string = dots.substring(index);
                var points = string.substring(2,string.indexOf("&"));
                
                //var replace = dots.indexOf(points);
                
                dots = dots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
            }
            else
                dots += "g=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "purple":
        {
            var index = dots.indexOf("p=");
            if (index >= 0)
            {
                var string = dots.substring(index);
                var points = string.substring(2,string.indexOf("&"));
                
                
                
                dots = dots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(dots);
            }
            else
                dots += "p=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "white":
        {
            var index = dots.indexOf("w=");
            if (index >= 0)
            {
                var string = dots.substring(index);
                var points = string.substring(2,string.indexOf("&"));
               
                dots = dots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(dots);
            }
            else
                dots += "w=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "yellow":
        {
            var index = dots.indexOf("y=");
            if (index >= 0)
            {
                var string = dots.substring(index);
                var points = string.substring(2,string.indexOf("&"));
                
                
                
                dots = dots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(dots);
            }
            else
                dots += "y=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "nut1":
        {
             var index = nuts.indexOf("n1=");
             if (index >= 0)
             {
                var string = nuts.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                nuts = nuts.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
             }
            else
                nuts += "n1=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "nut2":
        {
            var index = nuts.indexOf("n2=");
             if (index >= 0)
             {
                var string = nuts.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                nuts = nuts.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
             }
            else 
                nuts += "n2=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "nut3":
        {
            var index = nuts.indexOf("n3=");
            if (index >= 0)
            {
                var string = nuts.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                nuts = nuts.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
             }
             else
                nuts += "n3=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "nut4":
        {
            var index = nuts.indexOf("n4=");
            if (index >= 0)
            {
                var string = nuts.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                nuts = nuts.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                nuts += "n4=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "nut5":
        {
            var index = nuts.indexOf("n5=");
            if (index >= 0)
            {
                var string = nuts.substring(index);
                var points = string.substring(3,string.indexOf("&"));
               
                nuts = nuts.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                nuts += "n5=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "nut6":
        {
            var index = nuts.indexOf("n6=");
            if (index >= 0)
            {
                var string = nuts.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                nuts = nuts.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                nuts += "n6=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "nut7":
        {
            var index = nuts.indexOf("n7=");
            if (index >= 0)
            {
                var string = nuts.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                nuts = nuts.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                nuts += "n7=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "nut8":
        {
            var index = nuts.indexOf("n8=");
            if (index >= 0)
            {
                var string = nuts.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                nuts = nuts.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                nuts += "n8=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "nut9":
        {
            var index = nuts.indexOf("n9=");
            if (index >= 0)
            {
                var string = nuts.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                nuts = nuts.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                nuts += "n9=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "nut10":
        {
            var index = nuts.indexOf("n10=");
            if (index >= 0)
            {
                var string = nuts.substring(index);
                var points = string.substring(4,string.indexOf("&"));
                
                
                
                nuts = nuts.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                nuts += "n10=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "nut11":
        {
            var index = nuts.indexOf("n11=");
            if (index >= 0)
            {
                var string = nuts.substring(index);
                var points = string.substring(4,string.indexOf("&"));
                
                
                
                nuts = nuts.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                nuts += "n11=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "nut12":
        {
            var index = nuts.indexOf("n12=");
            if (index >= 0)
            {
                var string = nuts.substring(index);
                var points = string.substring(4,string.indexOf("&"));
                
                
                
                nuts = nuts.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                nuts += "n12=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "nut13":
        {
            var index = nuts.indexOf("n13=");
            if (index >= 0)
            {
                var string = nuts.substring(index);
                var points = string.substring(4,string.indexOf("&"));
                
                
                
                nuts = nuts.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                nuts += "n13=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "nut14":
        {
            var index = nuts.indexOf("n14=");
            if (index >= 0)
            {
                var string = nuts.substring(index);
                var points = string.substring(4,string.indexOf("&"));
                
                
                
                nuts = nuts.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                nuts += "n14=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "nut15":
        {
            var index = nuts.indexOf("n15=");
            if (index >= 0)
            {
                var string = nuts.substring(index);
                var points = string.substring(4,string.indexOf("&"));
                
                
                
                nuts = nuts.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                nuts += "n15=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "hot1":
        {
            var index = hots.indexOf("h1=");
            if (index >= 0)
            {
                var string = hots.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                hots = hots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                hots += "h1=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "hot2":
        {
            var index = hots.indexOf("h2=");
            if (index >= 0)
            {
                var string = hots.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                hots = hots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                hots += "h2=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "hot3":
        {
            var index = hots.indexOf("h3=");
            if (index >= 0)
            {
                var string = hots.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                hots = hots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                hots += "h3=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "hot4":
        {
            var index = hots.indexOf("h4=");
            if (index >= 0)
            {
                var string = hots.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                hots = hots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                hots += "h4=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "hot5":
        {
            var index = hots.indexOf("h5=");
            if (index >= 0)
            {
                var string = hots.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                hots = hots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                hots += "h5=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "hot6":
        {
            var index = hots.indexOf("h6=");
            if (index >= 0)
            {
                var string = hots.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                hots = hots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                hots += "h6=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "hot7":
        {
            var index = hots.indexOf("h7=");
            if (index >= 0)
            {
                var string = hots.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                hots = hots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
            hots += "h7=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "hot8":
        {
            var index = hots.indexOf("h8=");
            if (index >= 0)
            {
                var string = hots.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                hots = hots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                hots += "h8=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "hot9":
        {
            var index = hots.indexOf("h9=");
            if (index >= 0)
            {
                var string = hots.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                hots = hots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                hots += "h9=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "hot10":
        {
            var index = hots.indexOf("h10=");
            if (index >= 0)
            {
                var string = hots.substring(index);
                var points = string.substring(4,string.indexOf("&"));
                
                
                
                hots = hots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(hots);
            }
            else
                hots += "h10=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "hot11":
        {
            var index = hots.indexOf("h11=");
            if (index >= 0)
            {
                var string = hots.substring(index);
                var points = string.substring(3,string.indexOf("&"));
                
                
                
                hots = hots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                hots += "h11=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "hot12":
        {
            var index = hots.indexOf("h12=");
            if (index >= 0)
            {
                var string = hots.substring(index);
                var points = string.substring(4,string.indexOf("&"));
                
                hots = hots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                hots += "h12=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "hot13":
        {
            var index = hots.indexOf("h13=");
            if (index >= 0)
            {
                var string = hots.substring(index);
                var points = string.substring(4,string.indexOf("&"));
                
                
                
                hots = hots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(nuts);
            }
            else
                hots += "h13=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        case "hot14":
        {
             var index = hots.indexOf("h14=");
            if (index >= 0)
            {
                var string = hots.substring(index);
                var points = string.substring(4,string.indexOf("&"));
                
                
                
                hots = hots.replace(points, sender["Canvas.Left"] + ":" + sender["Canvas.Top"]);
                
                //alert(hots);
            }
            else
                hots += "h14=" + sender["Canvas.Left"] + ":" + sender["Canvas.Top"] + "&";
            break;
        }
        default:
            break;
    }
    
}

function onNutCupEnter(sender, eventArgs)
{
    //sender.releaseMouseCapture();
    
    var host = sender.GetHost();
        
    host.content.findName("nutCupOn").Visibility = "Visible";
    host.content.findName("nutCupOff").Opacity = 0.0;
    host.content.findName("nutCupOn").Opacity = 1.0;
}

function onNutCupLeave(sender, eventArgs)
{
    var host = sender.GetHost();
        
    host.content.findName("nutCupOff").Opacity = 1.0;
    host.content.findName("nutCupOn").Opacity = 0.0;
}

function onHotsCupEnter(sender, eventArgs)
{
    
    //sender.releaseMouseCapture();
    
    
    var host = sender.GetHost();
        
    host.content.findName("hotCupOn").Visibility = "Visible";
    host.content.findName("hotCupOff").Opacity = 0.0;
    host.content.findName("hotCupOn").Opacity = 1.0;
    
}

function onHotsCupLeave(sender, eventArgs)
{
    var host = sender.GetHost();
        
    host.content.findName("hotCupOff").Opacity = 1.0;
    host.content.findName("hotCupOn").Opacity = 0.0;
    
}
    
function onDotCupEnter(sender, eventArgs)
{
    //sender.releaseMouseCapture();
    
    var host = sender.GetHost();
        
    host.content.findName("dotCupOn").Visibility = "Visible";
    host.content.findName("dotCupOff").Opacity = 0.0;
    host.content.findName("dotCupOn").Opacity = 1.0;
}
    
function onDotCupLeave(sender, eventArgs)
{
    var host = sender.GetHost();
        
    host.content.findName("dotCupOff").Opacity = 1.0;
    host.content.findName("dotCupOn").Opacity = 0.0;
}

function onGuyClick(sender, eventArgs)
{
        var host = sender.GetHost();
        
        //host.content.findName("chick").Visibility = "Collapsed";
        gender = "f";
        
        host.content.findName("fellaOn").Visibility= "Visible";
        host.content.findName("fellaOff").Visibility = "Collapsed";
        host.content.findName("fellaOn").Opacity = 1.0;
        host.content.findName("fellaOff").Opacity = 0.0;
        
        host.content.findName("chickOn").Visibility= "Collapsed";
        host.content.findName("chickOff").Visibility = "Visible";
        host.content.findName("chickOn").Opacity = 0.0;
        host.content.findName("chickOff").Opacity = 1.0;
        
        //host.content.findName("chooseShape").Visibility="Collapsed";
        //host.content.findName("chooseFace").Visibility="Visible";
        
        //host.content.findName("naughtyOn").Opacity = 0.0;
        //host.content.findName("niceOn").Opacity = 0.0;
        //host.content.findName("ohNoOn").Opacity = 0.0;
        
        //host.content.findName("faces").Visibility="Visible";
       // host.content.findName("decorate").Visibility="Collapsed";
        
        //host.content.findName("fellaCenter").Begin();
}

function onGirlClick(sender, eventArgs)
{
        var host = sender.GetHost();
        
        //host.content.findName("fella").Visibility = "Collapsed";
        gender="c";
        
        //host.content.findName("chooseShape").Visibility="Collapsed";
        //host.content.findName("chooseFace").Visibility="Visible";
        
        //host.content.findName("naughtyOn").Opacity = 0.0;
        //host.content.findName("niceOn").Opacity = 0.0;
        //host.content.findName("ohNoOn").Opacity = 0.0;
        
        //host.content.findName("faces").Visibility="Visible";
        //host.content.findName("decorate").Visibility="Collapsed";
        
        //host.content.findName("chickCenter").Begin();
        
        host.content.findName("fellaOn").Visibility= "Collapsed";
        host.content.findName("fellaOff").Visibility = "Visible";
        host.content.findName("fellaOn").Opacity = 0.0;
        host.content.findName("fellaOff").Opacity = 1.0;
       
        host.content.findName("chickOn").Visibility= "Visible";
        host.content.findName("chickOff").Visibility = "Collapsed";
        host.content.findName("chickOn").Opacity = 1.0;
        host.content.findName("chickOff").Opacity = 0.0;
        
}

function checkQueryString()
{
    return window.location.search.substring(1);
}

function reconstructCookie(sender)
{
    
    var arguments = window.location.search.substring(1);
    
    var pairs = arguments.split("&");
    var coords;
    var object;
    
    for(i=0; i< pairs.length; i++)
    {
        var  subpairs = pairs[i].split("=");
        
        //alert(subpairs[0]);
        //alert(subpairs[1]);
        switch(subpairs[0])
        {
            
           case "s":
           {
                
                if (subpairs[1]=="f")
                {
                    sender.content.findName("fella").Visibility = "Visible";
                    sender.content.findName("chick").Visibility = "Collapsed";
                    sender.content.findName("fellaCenter").Begin();
                    gender = "f";
                }
                else if (subpairs[1]=="c")
                {
                    sender.content.findName("chick").Visibility = "Visible";
                    sender.content.findName("fella").Visibility = "Collapsed";
                    sender.content.findName("chickCenter").Begin();
                    gender = "c";
                }
                break;
           }
           case "f":
           {
                if (subpairs[1] =="n")
                {
                    if (gender == "f")
                    {
                        sender.content.findName("nice").Visibility="Visible";
                    }
                    else if (gender == "c")
                    {
                        sender.content.findName("chickNice").Visibility="Visible";
                    }
                }
                else if (subpairs[1] =="a")
                {
                    if (gender == "f")
                    {
                        sender.content.findName("naughty").Visibility="Visible";
                    }
                    else if (gender == "c")
                    {
                        sender.content.findName("chickNaughty").Visibility="Visible";
                    }
                }
                else if (subpairs[1] =="o")
                {
                    if (gender == "f")
                    {
                        sender.content.findName("ohNo").Visibility="Visible";
                    }
                    else if (gender == "c")
                    {
                        sender.content.findName("chickOhno").Visibility="Visible";
                    }
                }
                break;
           }
           case "b":
           {
                coords = subpairs[1].split(":");
                object = sender.content.findName("blue");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "r":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("red");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "p":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("purple");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "w":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("white");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "y":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("yellow");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "g":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("green");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "h1":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("hot1");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "h2":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("hot2");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "h3":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("hot3");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "h4":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("hot4");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "h5":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("hot5");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "h6":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("hot6");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "h7":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("hot7");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "h8":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("hot8");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "h9":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("hot9");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "h10":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("hot10");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "h11":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("hot11");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "h12":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("hot12");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "h13":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("hot13");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "h14":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("hot14");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "n1":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("nut1");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "n2":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("nut2");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "n3":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("nut3");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "n4":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("nut4");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "n5":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("nut5");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "n6":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("nut6");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "n7":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("nut7");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "n8":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("nut8");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "n9":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("nut9");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "n10":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("nut10");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "n11":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("nut11");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "n12":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("nut12");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "n13":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("nut13");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "n14":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("nut14");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           case "n15":
           {    
                coords = subpairs[1].split(":");
                object = sender.content.findName("nut15");
                object["Canvas.Left"] = coords[0];
                object["Canvas.Top"] = coords[1];
                break;
           }
           default:
                break;
        }
        
    }
}
