﻿function IsSilverlight() {
    this.degree = 0;
}
IsSilverlight.prototype.IsInstalled = function() {
    var isSilverlightInstalled = false;
    try {
        //check on IE
        try {
            var slControl = new ActiveXObject('AgControl.AgControl');
            isSilverlightInstalled = true;
        }
        catch (e) {
            //either not installed or not IE. Check Firefox
            if (navigator.plugins["Silverlight Plug-In"]) {
                isSilverlightInstalled = true;
            }
        }
    }
    catch (e) {
        //we don't want to leak exceptions. However, you may want
        //to add exception tracking code here.
    }
    return isSilverlightInstalled;
}
IsSilverlight.prototype.FadeIn = function(obj) {
    if(this.degree < 100){
        this.degree += 10;
        if (obj.filters && obj.filters[0]) {
            if (typeof obj.filters[0].opacity == "number") //if IE6+
                obj.filters[0].opacity = this.degree
            else //else if IE5.5-
                obj.style.filter = "alpha(opacity=" + this.degree + ")"
        }
        else if (obj.style.MozOpacity)
            obj.style.MozOpacity = this.degree / 101
        else if (obj.style.KhtmlOpacity)
            obj.style.KhtmlOpacity = this.degree / 100
        else if (obj.style.opacity && !obj.filters)
            obj.style.opacity = this.degree / 101
    }
}
IsSilverlight.prototype.FadeOut = function(obj) {
    if(this.degree > 0){
        this.degree -= 10;
        if (obj.filters && obj.filters[0]) {
            if (typeof obj.filters[0].opacity == "number") //if IE6+
                obj.filters[0].opacity = this.degree
            else //else if IE5.5-
                obj.style.filter = "alpha(opacity=" + this.degree + ")"
        }
        else if (obj.style.MozOpacity)
            obj.style.MozOpacity = this.degree / 101
        else if (obj.style.KhtmlOpacity)
            obj.style.KhtmlOpacity = this.degree / 100
        else if (obj.style.opacity && !obj.filters)
            obj.style.opacity = this.degree / 101
    }
}



