﻿evides.website.minisite.action = function() 
{
}

evides.website.minisite.action.prototype =
{   
    
    //  link naar homepage
    
    toHomepage: function(sender, args) {
    	window.location.href = homepageUrl;
    },
    
    //  menu buttons
    
    menuMouseEnter: function(sender, args) {
    	sender.findName(sender.name + "txt").Foreground = themedColor;
    },
    
    menuMouseLeave: function(sender, args) {
    	sender.findName(sender.name + "txt").Foreground = "#FF000000";
    },
    
    menuMouseLeftButtonUp: function(sender, args) {
	    for ( i=0; i<buttonTxt.length ; i++ ) {
    	    sender.findName("btn0" + i + "icon").visibility = "Visible";
    	    sender.findName("btn0" + i + "iconselected").visibility = "Collapsed";
    	    
    	    //  link naar toon-juiste-content functionaliteit!
    	    
    	    //  maak elk textblok onzichtbaar
    	    document.getElementById("contentblock" + i ).style.display = "none";
    	    //  check welke keuze actief moet zijn
    	    if ( ("btn0" + i) == sender.name.toString() ) {
    	        //  zet header in andere silverlight movie
    	        if (scene2) scene2.setText(i);
    	        //  zet juiste textblok aan
    	        document.getElementById("contentblock" + i ).style.display = "block";
    	    }
	    }
    	sender.findName(sender.name + "icon").Visibility = "Collapsed";
    	sender.findName(sender.name + "iconselected").Visibility = "Visible";
    },
    
    //  tooltip weergave op foto's
    
    showTooltip: function(control, userContext, rootElement) {
        if (control.findName(control.name + "tooltip").Visibility == "Visible" ) {
    	    control.findName(control.name + "showTooltip").begin();
    	}
    },
    
    hideTooltip: function(control, userContext, rootElement) {
        //  voorkom onnodig animeren
        if (control.findName(control.name + "tooltip").Visibility == "Visible" ) {
            //  voorkom zichtbare tekst als de showTooltip animatie nog loopt
            if (control.findName(control.name + "tooltiptext").Opacity == 0 ) {
    	        control.findName(control.name + "hideTooltip2").begin();
    	    } else {
    	        control.findName(control.name + "hideTooltip").begin();
    	    }
    	}
    },
    
    hideTooltip2: function(control, userContext, rootElement) {
    	control.findName(control.name + "2").begin();
    },
    
    //  zoom functionaliteit van foto's
    
    zoomIn: function(control, userContext, rootElement) {
        control["Canvas.ZIndex"] = 1000;
        //  zet de correcte hoogte van zoomeffect dmv extra plaatje
        var myFaker = control.findName(control.name + "fakeImage");
        if ( myFaker.visibility = "Visible" ) {
            var myNewHeight = myFaker.height;
            control.findName(control.name + "i1").setValue("Value", "440," + myNewHeight);
            control.findName(control.name + "i2").setValue("Value", "0," + myNewHeight);
            control.findName(control.name + "k1").setValue("Value", myNewHeight+6);
            control.findName(control.name + "k2").setValue("Value", myNewHeight+6);
            myFaker.visibility = "Collapsed";
        }
    	control.findName(control.name + "hideTooltip").begin();
    	control.findName(control.name + "tooltip").Visibility = "Collapsed";
    	control.findName(control.name + "zoomIn").begin();
    	// verschuif hele lijst vertikaal
        var toMove = -135 * eval(control.name.substring(4,5)) + 9;
    	control.findName("StoryboardMoveAmount").setValue("Value", toMove);
    	control.findName("StoryboardMoveList").begin();
    },
    
    zoomInFinished: function(control, userContext, rootElement) {
        //  zet juiste uitzoom event op sluit-knopje
        myZoomIndex = control.name.substring(0,5);
        control.findName("closeBtn").addEventListener("MouseLeftButtonUp", this.zoomOut);
        control.findName("masker").Visibility = "Visible";
    },
    
    zoomOut: function(control, userContext, rootElement) {
    	control.findName(myZoomIndex + "zoomOut").begin();
    	control.findName("masker").Visibility = "Collapsed";
    },
    
    zoomOutFinished: function(control, userContext, rootElement) {
        if (control.findName(control.name.substring(0,5) + "tooltiptext").text.length > 0) {
    	    control.findName(control.name.substring(0,5) + "tooltip").Visibility = "Visible";
        }
    	control.findName(control.name.substring(0,5))["Canvas.ZIndex"] = 200;
    },
    
    //  vertikale animatie van lijst met foto's
    
    moveListUp: function(control, userContext, rootElement) {
        var toMove = control.findName("StoryboardMoveAmount").value + 135;
        if (toMove > 9) { toMove = 9; };
    	control.findName("StoryboardMoveAmount").setValue("Value", toMove);
    	control.findName("StoryboardMoveList").begin();
    },
    
    moveListDown: function(control, userContext, rootElement) {
        var toMove = control.findName("StoryboardMoveAmount").value - 135;
        if (toMove < maxMoveDist ) { toMove = maxMoveDist; };
    	control.findName("StoryboardMoveAmount").setValue("Value", toMove);
    	control.findName("StoryboardMoveList").begin();
    }
}