﻿function scriptUtilities()
{
    this.Hide = function(clienID)
    {
        document.getElementById(clienID).display = "none";
    };
    
    this.Show = function(clienID)
    {
        document.getElementById(clienID).display = "inline";
    };
    
    this.ShowBlock = function(clienID)
    {
        document.getElementById(clienID).display = "block";
    };
    
    this.GetAttributes = function(styleCollection)
    {
        var result = new Array();
        var styles = styleCollection.split(";");
        for(var i = 0; i< styles.length; i++)
        {
            var temp = styles[i].split(":");
            if(temp.length == 2)
            {
                //var key = temp[0];
                if(temp[0].indexOf("-") > -1)
                {
                    var x = temp[0].substring(temp[0].indexOf("-") + 1, temp[0].indexOf("-") + 2);
                    temp[0] = temp[0].replace("-"+x, x.toUpperCase());
                }
                result[result.length] = temp;
            }
        }
        return result;
    };
    
    
    this.SetStylesCollection = function(elementId, styles)
    {
        for(var i = 0; i< styles.length; i++)
        {
            var toExec = "document.getElementById('" + elementId + "').style." + styles[i][0] + " = '" + styles[i][1] + "';";
            eval(toExec);
        }
    };
    
    this.ApplyStyles = function(elementId, style)
    {
        var styles = this.GetAttributes(style);
        this.SetStylesCollection(elementId, styles);
    };
    
   
    
}




var Utilities = new scriptUtilities()