﻿// JScript File

//Register Namespace
Namespace.Register("System.Browser");
//User Browser Object
System.Browser = function(){ return {

    Agent : null,
    App_Version : null,
    Major : null,
    IsOpera : false,
    IsSafari : false,
    IsSafari1_3up : false,
    IsKonqeror : false,
    IsIe : false,
    IsIeMac : false,
    IsIe3 : false,
    IsIe4 : false,
    IsIe5 : false,
    IsIe5_5 : false,
    IsIe5_5up : false,
    IsIe6up : false,
    IsMozilla : false,
    IsNetscape6 : false,
    
    
    

    ///<summary>
				/// Gets the type of object
				///</summary>
				///<returns>string: Type Name</returns>
    GetType : function(){ return "System.Browser"; },
    //--------------------------------------------------------------------
    
    //Initializer---------------------------------------------------------
    Cotr : function()
    { 
						this.Agent						=(navigator==null||navigator.userAgent==null)?'':navigator.userAgent.toLowerCase();
						this.App_Version				=(navigator==null||navigator.appVersion==null)?'':navigator.appVersion;
						this.Major						=parseInt(this.App_Version);
						this.IsOpera					=this.Agent.indexOf('opera')!=-1;
						this.IsIe						=!this.IsOpera&&(this.Agent.indexOf('msie')!=-1);
						this.IsIeMac					=this.IsIe&&(this.Agent.indexOf('mac')!=-1);
						this.IsSafari					=this.Agent.indexOf('safari')!=-1;
						this.IsSafari1_3up		        =this.IsSafari&&(this.Agent.indexOf('safari/125.')==-1)&&(this.Agent.indexOf('safari/85.')==-1);
						this.IsKonqeror					=this.Agent.indexOf('konqueror')!=-1;
						this.IsMozilla					=!this.IsIe&&!this.IsOpera&&((this.Agent.indexOf('netscape')!=-1)||(this.Agent.indexOf('mozilla')!=-1))&&(this.Major>=5);
						this.IsIe3						=this.IsIe&&(this.Major<4);
						this.IsIe4						=this.IsIe&&(this.Major==4)&&(this.Agent.indexOf("msie 4")!=-1);
						this.IsIe5_5					=this.IsIe&&(this.Major==4)&&(this.Agent.indexOf("msie 5.5")!=-1);
						this.IsIe5						=this.IsIe&&(this.Major==4)&&(this.Agent.indexOf("msie 5")!=-1)&&!this.IsIe5_5;
						this.IsIe5_5up					=this.IsIe&&!this.IsIe3&&!this.IsIe4&&!this.IsIe5;
						this.IsIe6up					=this.IsIe&&!this.IsIe3&&!this.IsIe4&&!this.IsIe5&&!this.IsIe5_5up;
						this.IsNetscape6				=(this.Agent.indexOf('netscape6')!=-1);
						this.ApplyInputTextCss          =true;
						this.ImageInputCssClass         =" imagefield";
						this.TextInputCssClass          =" textfield";
						this.RadioInputCssClass         =" radiofield";
						
						
        return this; 
    },
    //--------------------------------------------------------------------

    Page_Load : function()
    {
        if(true == this.ApplyInputTextCss)
        {
            var elements = document.getElementsByTagName('input');
            var len = elements.length;
            for(var i = 0; i<len;i++)
            {
                var name = elements[i].type.toLowerCase()
                if(name == "image")
                    elements[i].className += this.ImageInputCssClass;
                else if(name == "text")
                    elements[i].className += this.TextInputCssClass;
                else if(name == "radio")
                    elements[i].className += this.RadioInputCssClass;
            }
        }
    }
}.Cotr(arguments);}

window.Browser = new System.Browser();