var BrowserDetect = {

	init: function () {

		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";

		this.version = this.searchVersion(navigator.userAgent)

			|| this.searchVersion(navigator.appVersion)

			|| "an unknown version";

		this.OS = this.searchString(this.dataOS) || "an unknown OS";

	},

	searchString: function (data) {

		for (var i=0;i<data.length;i++)	{

			var dataString = data[i].string;

			var dataProp = data[i].prop;

			this.versionSearchString = data[i].versionSearch || data[i].identity;

			if (dataString) {

				if (dataString.indexOf(data[i].subString) != -1)

					return data[i].identity;

			}

			else if (dataProp)

				return data[i].identity;

		}

	},

	searchVersion: function (dataString) {

		var index = dataString.indexOf(this.versionSearchString);

		if (index == -1) return;

		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));

	},

	dataBrowser: [

		{ 	string: navigator.userAgent,

			subString: "OmniWeb",

			versionSearch: "OmniWeb/",

			identity: "OmniWeb"

		},

		{

			string: navigator.vendor,

			subString: "Apple",

			identity: "Safari"

		},

		{

			prop: window.opera,

			identity: "Opera"

		},

		{

			string: navigator.vendor,

			subString: "iCab",

			identity: "iCab"

		},

		{

			string: navigator.vendor,

			subString: "KDE",

			identity: "Konqueror"

		},

		{

			string: navigator.userAgent,

			subString: "Firefox",

			identity: "Firefox"

		},

		{

			string: navigator.vendor,

			subString: "Camino",

			identity: "Camino"

		},

		{		// for newer Netscapes (6+)

			string: navigator.userAgent,

			subString: "Netscape",

			identity: "Netscape"

		},

		{

			string: navigator.userAgent,

			subString: "MSIE",

			identity: "Explorer",

			versionSearch: "MSIE"

		},

		{

			string: navigator.userAgent,

			subString: "Gecko",

			identity: "Mozilla",

			versionSearch: "rv"

		},

		{ 		// for older Netscapes (4-)

			string: navigator.userAgent,

			subString: "Mozilla",

			identity: "Netscape",

			versionSearch: "Mozilla"

		}

	],

	dataOS : [

		{

			string: navigator.platform,

			subString: "Win",

			identity: "Windows"

		},

		{

			string: navigator.platform,

			subString: "Mac",

			identity: "Mac"

		},

		{

			string: navigator.platform,

			subString: "Linux",

			identity: "Linux"

		}

	]



};



BrowserDetect.init();



if(BrowserDetect.browser == 'Explorer'){

	var offset_width = 800;

}

else{

	var offset_width = 795;

}



var target_offset_width = (screen.width - offset_width)/2;

var floatingMenuId = 'floatdiv';

var floatingMenu =

{

	targetX: target_offset_width,

    targetY: 10,



    hasInner: typeof(window.innerWidth) == 'number',

    hasElement: document.documentElement

        && document.documentElement.clientWidth,



    menu:

        document.getElementById

        ? document.getElementById(floatingMenuId)

        : document.all

          ? document.all[floatingMenuId]

          : document.layers[floatingMenuId]

};



floatingMenu.move = function ()

{

    if (document.layers)

    {

        floatingMenu.menu.left = floatingMenu.nextX;

        floatingMenu.menu.top = floatingMenu.nextY;

    }

    else

    {

        floatingMenu.menu.style.left = floatingMenu.nextX + 'px';

        	if(floatingMenu.nextY>255){

				floatingMenu.menu.style.top = floatingMenu.nextY + 'px';

			}

	}

}



floatingMenu.computeShifts = function ()

{

    var de = document.documentElement;



    floatingMenu.shiftX =

        floatingMenu.hasInner

        ? pageXOffset

        : floatingMenu.hasElement

          ? de.scrollLeft

          : document.body.scrollLeft;

    if (floatingMenu.targetX < 0)

    {

        if (floatingMenu.hasElement && floatingMenu.hasInner)

        {

            // Handle Opera 8 problems

            floatingMenu.shiftX +=

                de.clientWidth > window.innerWidth

                ? window.innerWidth

                : de.clientWidth

        }

        else

        {

            floatingMenu.shiftX +=

                floatingMenu.hasElement

                ? de.clientWidth

                : floatingMenu.hasInner

                  ? window.innerWidth

                  : document.body.clientWidth;

        }

    }



    floatingMenu.shiftY = 

        floatingMenu.hasInner

        ? pageYOffset

        : floatingMenu.hasElement

          ? de.scrollTop

          : document.body.scrollTop;

    if (floatingMenu.targetY < 0)

    {

        if (floatingMenu.hasElement && floatingMenu.hasInner)

        {

            // Handle Opera 8 problems

            floatingMenu.shiftY +=

                de.clientHeight > window.innerHeight

                ? window.innerHeight

                : de.clientHeight

        }

        else

        {

            floatingMenu.shiftY +=

                floatingMenu.hasElement

                ? document.documentElement.clientHeight

                : floatingMenu.hasInner

                  ? window.innerHeight

                  : document.body.clientHeight;

        }

    }

}



floatingMenu.doFloat = function()

{

    var stepX, stepY;



    floatingMenu.computeShifts();



    stepX = (floatingMenu.shiftX + 

        floatingMenu.targetX - floatingMenu.nextX) * .07;

    if (Math.abs(stepX) < .5)

    {

        stepX = floatingMenu.shiftX +

            floatingMenu.targetX - floatingMenu.nextX;

    }



    stepY = (floatingMenu.shiftY + 

        floatingMenu.targetY - floatingMenu.nextY) * .07;

    if (Math.abs(stepY) < .5)

    {

        stepY = floatingMenu.shiftY + 

            floatingMenu.targetY - floatingMenu.nextY;

    }



    if (Math.abs(stepX) > 0 ||

        Math.abs(stepY) > 0)

    {

        floatingMenu.nextX += stepX;

        floatingMenu.nextY += stepY;

        floatingMenu.move();

    }



    setTimeout('floatingMenu.doFloat()', 20);

};



// addEvent designed by Aaron Moore

floatingMenu.addEvent = function(element, listener, handler)

{

    if(typeof element[listener] != 'function' || 

       typeof element[listener + '_num'] == 'undefined')

    {

        element[listener + '_num'] = 0;

        if (typeof element[listener] == 'function')

        {

            element[listener + 0] = element[listener];

            element[listener + '_num']++;

        }

        element[listener] = function(e)

        {

            var r = true;

            e = (e) ? e : window.event;

            for(var i = element[listener + '_num'] -1; i >= 0; i--)

            {

                if(element[listener + i](e) == false)

                    r = false;

            }

            return r;

        }

    }



    //if handler is not already stored, assign it

    for(var i = 0; i < element[listener + '_num']; i++)

        if(element[listener + i] == handler)

            return;

    element[listener + element[listener + '_num']] = handler;

    element[listener + '_num']++;

};



floatingMenu.init = function()

{

    floatingMenu.initSecondary();

    floatingMenu.doFloat();

};



// Some browsers init scrollbars only after

// full document load.

floatingMenu.initSecondary = function()

{

    floatingMenu.computeShifts();

    floatingMenu.nextX = floatingMenu.shiftX +

        floatingMenu.targetX;

    floatingMenu.nextY = floatingMenu.shiftY +

        floatingMenu.targetY;

    floatingMenu.move();

}



if (document.layers)

    floatingMenu.addEvent(window, 'onload', floatingMenu.init);

else

{

    floatingMenu.init();

    floatingMenu.addEvent(window, 'onload',

        floatingMenu.initSecondary);

}



//-->