function isMSIE(){
    return (window.navigator.userAgent.indexOf("MSIE") >= 0);
}

function isMSIE6() {
    return (window.navigator.userAgent.indexOf("MSIE 6.") >= 0);
}

function isSafari(){
    return (window.navigator.userAgent.indexOf("Safari") >= 0);
}

function isMozilla(){
    return (window.navigator.userAgent.indexOf("Firefox") >= 0);
}

function BodyClick(e){
    document.body.event = e;
}

function getEvent(){
    var evt;    
    if (isMSIE() || isSafari()) evt = event ? event : window.event;
	if (isMozilla()) evt = document.body.event;
	return evt;
}

function isNull(item){
    return (typeof(item) == 'undefined' || item == null)
}

function toInt(item){
    var result = 0;
    if (!isNull(item)) result = isNaN(parseInt(item)) ? 0 : parseInt(item);
    return result;
}

function HyperLinkClick(ID, Url)
{
    if(isMozilla())
    {
        var a = document.getElementById(ID);
        var NewUrl = Url.replace("~","");
        a.href = NewUrl;
    }
}
function Download(src)
{
	if(isSafari()) 
	{
		if(window.clientInformation.platform.indexOf("Mac") < 0)
		{
				src.target="_blank";
		}
	}
}

function disableSelection(target) {
    if (typeof target.onselectstart != "undefined") //IE route
        target.onselectstart = function() { return false }
    else if (typeof target.style.MozUserSelect != "undefined") //Firefox route
        target.style.MozUserSelect = "none"
    else //All other route (ie: Opera)
        target.onmousedown = function() { return false }
    target.style.cursor = "default"
}

//
// Function for event attaching 
// 
function addEvent(obj, eventName, handler) {
    if (obj.attachEvent) {
        obj.attachEvent("on" + eventName, handler);
        return;
    }
    if (obj.addEventListener) {
        obj.addEventListener(eventName, handler, false);
        return;
    }
}

function clearEvent(obj, eventName, handler) {
    if (obj.detachEvent) {
        obj.detachEvent("on" + eventName, handler);
        return;
    }
    if (obj.removeEventListener) {
        obj.removeEventListener(eventName, handler, false);
        return;
    }
}

//  Hint Function is there

ToolTipAdjusterClass = function() {
    this.whenCollapsedText = "Click here to expand";
    this.whenExpandedText = "Click here to collapse";

    this.init = function(id) {
        this.checkSplitterHint(id, this.whenExpandedText);
    };

    this.splitterIsCollapsed = function(obj) {
        return obj.get_collapsed();
    };

    this.checkSplitterHint = function(id, text) {
        //debugger;
        var isIE = navigator.userAgent.indexOf(' MSIE ') > -1;
        var Splitter = document.getElementById(id);
        var diver;
        if (isIE) {
            diver = Splitter.childNodes[0].childNodes[0].cells[1];
        } else {
            diver = Splitter.rows[0].cells[1];
        }

        if (diver.childNodes[0].tagName == "IMG")
        { diver.childNodes[0].title = text; }
        else { diver.childNodes[1].title = text; }
    };

    this.OnSplitterCollapse = function(id) {
        this.checkSplitterHint(id, this.whenCollapsedText);
    };

    this.OnSplitterExpand = function(id) {
        this.checkSplitterHint(id, this.whenExpandedText);
    };
}
var ToolTipAdjuster = new ToolTipAdjusterClass();



