﻿//-------------------------------------------------------------------------------
// General methods.
//-------------------------------------------------------------------------------
// To make show/hide in all browser versions.
var block = isIE() ? "block" : "block";
var none = "none";

function isIE()
{
    return ( navigator.appName.indexOf( "Internet Explorer" ) != -1);
}

// This method show/hide the element using the given Id.
function showElement( pObject, pVisible )
{
    // Get the element of given id.
    var element = pObject;
    
    // Check the passed parameter is a id or an object.
    if( typeof( element ) != 'object' )
        element = document.getElementById( pObject );
    
    // Check the element was found or not.
    if ( !isNull( element ) )
    {
	    if( pVisible )
		    element.style.display = block;
	    else
		    element.style.display = none;
    }
}

// This method Gets the element using the given Id.
function getElement( pObject )
{
    // Get the element of given id.
    var element = pObject;
    
    // Check the passed parameter is a id or an object.
    if( typeof( element ) != 'object' )
        element = document.getElementById( pObject );
    
    // Check the element was found or not.
    if ( isNull( element ) )
        return null;

    // Return the element.
    return element;
}

// This method check the given object is null or undefined.
function isNull( pValue )
{
    // Return true or false.
    return ( pValue == null || pValue == undefined || pValue == '' );
}
