(function(){
		  
	//The EDDESK namespace
	if(!window.LOG) { window['LOG'] = {} }

    function createUL(arg)
    {
        var ul = document.createElement('ul');
        ul.setAttribute('id','log');
        return ul;
    }
    window['LOG']['createUL'] = createUL;	

    function createLI(arg)
    {
        var li = document.createElement('li');
        
        if(typeof arg == 'string')
        {
            var p = document.createElement('p');
            p.appendChild(document.createTextNode(arg));
            li.appendChild(p);
        } else {
            li.appendChild(arg);
        }        
        return li;
    }
    window['LOG']['createLI'] = createLI;	
    
    function print(arg)
    {
        //If log window does not exist create it
        if(document.getElementById('log') == null)
        {
            var ul = createUL();
            ul.appendChild(createLI(arg));
            document.getElementById('wrapper').appendChild(ul);
        } else {
            if(!ul)ul = document.getElementById('log');
            document.getElementById('log').appendChild(createLI(arg));
        }  
        
    }
    window['LOG']['print'] = print;
    
    function printH1(arg)
    {
        var h1 = document.createElement('h1');
        
        h1.appendChild(document.createTextNode(arg));
        
        print(h1);
    }
    window['LOG']['printH1'] = printH1;
	
	function printH2(arg)
    {
        var h2 = document.createElement('h2');
        
        h2.appendChild(document.createTextNode(arg));
        
        print(h2);
    }
    window['LOG']['printH2'] = printH2;
    
    function printULwithH1(h1,vars)
    {
        //Create heading for LOG window
        var h = document.createElement('h1');
        h.appendChild(document.createTextNode(h1));
        var li = document.createElement('li');
        li.appendChild(h);
        
        //Create element to hold variable list
        var ul = document.createElement('ul');    
        //attach heading
        ul.appendChild(li);
        
        //Loop through variable list and add items    
        for(var i = 0; i < vars.length; i++)
        {
            var li = document.createElement('li');
            li.appendChild(document.createTextNode(vars[i]));
            ul.appendChild(li);
        }
        
        //Print list into LOG window
        
        print(ul);
    }
    window['LOG']['printULwithH1'] = printULwithH1;
	/*
	function createTable(idStr)
	{
		var oTable = document.createElement('table');
		oTable.setAttribute('id',idStr);
		print(oTable);
	}
	window['LOG']['createTable'] = createTable;
	*/
	function printTable(TDs, classStr)
	{
	/*	
		if(document.getElementById(idStr) == null)
		{
			var oTable = document.createElement('table');
			oTable.setAttribute('id',idStr);
			var tableCreated = true;
		}
		
		//Create table row
		var TR = document.createElement('tr');
		//Attach class if it has been provided
		if(classStr) TR.className = classStr;
		
		//Loop through table data array and attach each column
		
		for(var i = 0; i < TDs.length; i++)
		{
			var td = document.createElement('td');
			if(typeof TDs[i] == 'string')
			{
				td.appendChild(document.createTextNode(TDs[i]));
			} else {
				td.appendChild(TDs[i]);	
			}
			TR.appendChild(td);
			
		}
		
		if(!tableCreated)
		{
			document.getElementById(idStr).appendChild(TR);	
		} else {
			oTable.appendChild(TR);
			print(oTable);
		}
		*/
		
		
		
		var oTable = document.createElement('table');
		
		
		//Create table row
		var TR = document.createElement('tr');
		//Attach class if it has been provided
		if(classStr) TR.className = classStr;
		
		//Loop through table data array and attach each column
		
		for(var i = 0; i < TDs.length; i++)
		{
			var td = document.createElement('td');
			if(typeof TDs[i] == 'string')
			{
				td.appendChild(document.createTextNode(TDs[i]));
			} else {
				td.appendChild(TDs[i]);	
			}
			TR.appendChild(td);
			
		}
		
		
		oTable.appendChild(TR);
		print(oTable);
		
		
		
	}
	window['LOG']['printTable'] = printTable;

})();