﻿// _____________________________________________________________________________
// _____________________________________________________________________________ Namespace(s)
Type.registerNamespace('DanLudwig.Controls.Client');



// _____________________________________________________________________________
// _____________________________________________________________________________ Constructor
DanLudwig.Controls.Client.ControlBase = function(element)
{
    // initialize base
    DanLudwig.Controls.Client.ControlBase.initializeBase(this, [element]);
    
    // construct control
}



// _____________________________________________________________________________
// _____________________________________________________________________________ Prototype
DanLudwig.Controls.Client.ControlBase.prototype = 
{
    // _________________________________________________________________________
    // _________________________________________________________________________ Inititalize
    initialize : function() 
    {
        // call base initialize
        DanLudwig.Controls.Client.ControlBase.callBaseMethod(this, 'initialize');
        
        // initialize control
    }

,

    // _________________________________________________________________________
    // _________________________________________________________________________ Dispose
    dispose : function() 
    {
		// dispose control

        // call base dispose
        DanLudwig.Controls.Client.ControlBase.callBaseMethod(this, 'dispose');
    }

,

    // _________________________________________________________________________
    // _________________________________________________________________________ Browser Sniffers

    // _________________________________________________________________________
    // _______________________________________________________________ Is Safari|
    isSafari: function() 
    {
        return navigator.userAgent.indexOf('Safari') > -1;
    }

,

    // _________________________________________________________________________
    // _____________________________________________________ Is Safari 2 Or Less|
    isSafari2OrLess: function() 
    {
		return (this.isSafari() && Sys.Browser.version < 500);
    }

,

    // _________________________________________________________________________
    // _____________________________________________________ Is Safari 3 Or More|
    isSafari3OrMore: function() 
    {
		return (this.isSafari() && Sys.Browser.version > 500);
    }

,

    // _________________________________________________________________________
    // ____________________________________________________ Is Internet Explorer|
    isInternetExplorer: function() 
    {
		return (Sys.Browser.agent === Sys.Browser.InternetExplorer);
    }

,

    // _________________________________________________________________________
    // __________________________________________ Is Internet Explorer 6 Or Less|
    isInternetExplorer6OrLess: function() 
    {
		return (this.isInternetExplorer() && Sys.Browser.version < 7);
    }

,

    // _________________________________________________________________________
    // __________________________________________ Is Internet Explorer 7 Or More|
    isInternetExplorer7OrMore: function() 
    {
		return (this.isInternetExplorer() && Sys.Browser.version >= 7);
    }

,

    // _________________________________________________________________________
    // ________________________________________________________________ Is Opera|
    isOpera: function() 
    {
		return (Sys.Browser.agent === Sys.Browser.Opera);
    }

,

    // _________________________________________________________________________
    // ______________________________________________________ Is Opera 9 Or More|
    isOpera9OrMore: function() 
    {
		return (this.isOpera() && Sys.Browser.version >= 9);
    }

,

    // _________________________________________________________________________
    // ______________________________________________________________ Is Firefox|
    isFirefox: function() 
    {
		return (Sys.Browser.agent === Sys.Browser.Firefox);
    }

,

    // _________________________________________________________________________
    // ____________________________________________________ Is Firefox 1 Or Less|
    isFirefox1OrLess: function() 
    {
		return (this.isFirefox() && Sys.Browser.version <= 1);
    }

,

    // _________________________________________________________________________
    // __________________________________________________ Is Firefox 1.5 Or Less|
    isFirefox1Point5: function() 
    {
		return (this.isFirefox() && Sys.Browser.version > 1 && Sys.Browser.version < 2);
    }

,

    // _________________________________________________________________________
    // ____________________________________________________ Is Firefox 2 Or More|
    isFirefox2OrMore: function() 
    {
		return (this.isFirefox() && Sys.Browser.version >= 2);
    }

,

    // _________________________________________________________________________
    // _________________________________________________________________________ Methods

    // _________________________________________________________________________
    // _______________________________________________________ Get Window Bounds|
    getWindowBounds : function()
    {
        // handle event
        var bounds = {
             x: this.get_scrollLeft()
            ,y: this.get_scrollTop()
            ,width: this.get_windowWidth()
            ,height: this.get_windowHeight()
        };
        
        return bounds;
    }

,

    // _________________________________________________________________________
    // _________________________________________________________________________ Properties

    // _________________________________________________________________________
    // ___________________________________________________________ Window Height|
    get_windowHeight : function()
    {
		var windowHeight = 0;
		if (typeof(window.innerHeight) == 'number')
		{
			//Non-IE
			windowHeight = window.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientHeight)
		{
			//IE 6+ in 'standards compliant mode'
			windowHeight = document.documentElement.clientHeight;
		}
		else if (document.body && document.body.clientHeight)
		{
			//IE 4 compatible
			windowHeight = document.body.clientHeight;
		}
		return windowHeight;
    }

,

    // _________________________________________________________________________
    // ____________________________________________________________ Window Width|
    get_windowWidth : function()
    {
		var windowWidth = 0;
		if (typeof(window.innerWidth) == 'number')
		{
			//Non-IE
			windowWidth = window.innerWidth;
		}
		else if (document.documentElement && document.documentElement.clientWidth)
		{
			//IE 6+ in 'standards compliant mode'
			windowWidth = document.documentElement.clientWidth;
		}
		else if (document.body && document.body.clientWidth)
		{
			//IE 4 compatible
			windowWidth = document.body.clientWidth;
		}
		return windowWidth;
    }

,

    // _________________________________________________________________________
    // ______________________________________________________________ Scroll Top|
    get_scrollTop : function()
    {
		var scrollTop = 0;
		if (typeof(window.pageYOffset) == 'number')
		{
			//Netscape compliant
			scrollTop = window.pageYOffset;
		}
		else if (document.body && document.body.scrollTop)
		{
			//DOM compliant
			scrollTop = document.body.scrollTop;
		}
		else if (document.documentElement && document.documentElement.scrollTop)
		{
			//IE6 standards compliant mode
			scrollTop = document.documentElement.scrollTop;
		}
		return scrollTop;
    }

,

    // _________________________________________________________________________
    // _____________________________________________________________ Scroll Left|
    get_scrollLeft : function()
    {
		var scrollLeft = 0;
		if (typeof(window.pageXOffset) == 'number')
		{
			//Netscape compliant
			scrollLeft = window.pageXOffset;
		}
		else if (document.body && document.body.scrollLeft)
		{
			//DOM compliant
			scrollLeft = document.body.scrollLeft;
		}
		else if (document.documentElement && document.documentElement.scrollLeft)
		{
			//IE6 standards compliant mode
			scrollLeft = document.documentElement.scrollLeft;
		}
		return scrollLeft;
    }



} // end prototype definition



// _____________________________________________________________________________
// _____________________________________________________________________________ JSON Serialization
//DanLudwig.Controls.Client.ControlBase.descriptor = 
//{
//    properties: [   
//         {name: 'propertName1', type: propertyType1} 
//        ,{name: 'propertName2 name', type: propertyType2 }
//    ]
//}



// _____________________________________________________________________________
// _____________________________________________________________________________ Register Class
DanLudwig.Controls.Client.ControlBase.registerClass(
    'DanLudwig.Controls.Client.ControlBase', Sys.UI.Control);



// _____________________________________________________________________________
// _____________________________________________________________________________ Notify Script Loaded
//if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();