function PageQuery(q) 
{
    if(q.length > 1) 
    {
        this.q = q.substring(1, q.length);
    }
    else 
    {
        this.q = null;
    }
    
    this.keyValuePairs = new Array();
    
    if(q) 
    {
        for( var i=0; i < this.q.split("&").length; i++) 
        {
            this.keyValuePairs[i] = this.q.split("&")[i];
        }
    }
    
    this.getKeyValuePairs = function() 
    { 
        return this.keyValuePairs; 
    }

    this.getValue = function(s) 
    {
        for(var j=0; j < this.keyValuePairs.length; j++) 
        {
            if(this.keyValuePairs[j].split("=")[0] == s)
            {
                return this.keyValuePairs[j].split("=")[1];
            }
        }
        
        return null;
    }

    this.getParameters = function() 
    {
        var a = new Array(this.getLength());
        for(var j=0; j < this.keyValuePairs.length; j++) 
        {
            a[j] = this.keyValuePairs[j].split("=")[0];
        }
        
        return a;
    }

    this.getLength = function() 
    { 
        return this.keyValuePairs.length; 
    } 
}

var page = null; 

function queryString(key)
{
    if(!page)
    {
        page = new PageQuery(window.location.search); 
    }
    
    if(page && page.getValue(key))
    {
        return unescape(page.getValue(key)); 
    }
    
    return null;
}

function get_item(name)
{
    var item = null;
    
    if(name && document)
        if (typeof(document.getElementById) != 'undefined')
            item = document.getElementById(name);
        else if (typeof(document.all) != 'undefined')
            item = document.all[name];
        else if (typeof(document.layers) != 'undefined')
            item = document.layers[name];
                
    if(item && typeof(item.style) == 'undefined')
        item.style = item;
                   
    return item;
}

function convert_to_numeric( str )
{
    var c_a, c, i, out;
    
    out = '';
    
    if(typeof(str)!='undefined' && str!=null)
    {
        str = str.toString();
        
        if(str.length>0)
        {
            for( i=0; i<str.length; i++ )
            {
                c = str.charAt(i);
                c_a = c.charCodeAt(0);
                
                if((c_a >= 48 && c_a <= 57) || ( c_a == 46))
                {
                    out += c;
                }
            }
            
            if ( out.length > 0 )
            {
                return parseFloat(out);
            }
        }
    }
    
    return 0;
}

function kern_xml_dining_viewer ( parent_div, xml_file, city_filter )
{
    function trim(stringToTrim) 
    {
	    return stringToTrim.replace(/^\s+|\s+$/g,"");
    }
    this.trim = trim;

    var menu = new Array();
    var city_filter_array = new Array();
    
    if(city_filter)
    {
        city_filter_array = city_filter.split(",");
        
        if(city_filter_array && city_filter_array.length >0)
        {
            for(var i = 0; i < city_filter_array.length; i++)
            {
                city_filter_array[i] = city_filter_array[i].toLowerCase();
                city_filter_array[i] = trim(city_filter_array[i]);
            }
        }
    }
    
    this.verify_xml = function()
    {
        if (xml_doc && xml_doc.readyState == 4)
        {
            //return true;
        }
        else
        {
            return false;        
        }
    }
    
    function sort_list(a, b)
    {
        if( a && b && typeof(a.text) != 'undefined' && typeof(b.text) != 'undefined')
        {
            if( a.text == b.text ) return 0;
            if( a.text > b.text ) return 1;
            if( a.text < b.text ) return -1;
        }
        
        return 0;
    }
    
    var xml_doc;
    
    if(xml_file)
    {
        if (window.ActiveXObject)
        {
            try 
            {
                xml_doc = new ActiveXObject("MSXML2.DOMDocument");
            } 
            catch (e) 
            {
                try 
                {
                    xml_doc = new ActiveXObject("Microsoft.XMLDOM");
                } 
                catch (e) 
                {
                }
            }
        }
        
        if(xml_doc)
        {
            xml_doc.async="false";
            xml_doc.onreadystatechange = this.verify_xml;
            
            xml_doc.load( xml_file );
            
            if (xml_doc.readyState == 4)
            {
                var xml_obj;
                if(xml_doc.documentElement) xml_obj = xml_doc.documentElement;
                
                if( xml_obj && xml_obj.hasChildNodes() )
                {
                    var name_din;
                    var type_din;
                    var address_din;
                    var city_din;
                    var phone_din;
                    var error = false;
                    var city_continue = false;
                    var xml_child_index = 0;
                    var xml_backup_method = 0;
		    var additional_info_link;
                    
                    for( var i = 0; i < xml_obj.childNodes.length; i++ )
                    {
                        var i_child_node =  xml_obj.childNodes(i);
                        
                        switch ( i_child_node.tagName )
                        {        
                            case 'dining': 
                                if( i_child_node.hasChildNodes() )
                                {       
                                    name_din = '';
                                    type_din = '';
                                    address_din = '';
                                    city_din = '';
                                    phone_din = '';
				    additional_info_link = '';
                                    
                                    city_continue = false;
                                    if(!(city_filter_array && city_filter_array.length && city_filter_array.length > 0))
                                    {
                                        city_continue = true;
                                    }
                                    
                             	    if(!error)
                                    {
                             	        if(i==0)
                             	        {
                             	            xml_child_index = 10;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'city_din')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    city_din = trim(i_child_node.childNodes(xml_child_index).text);
                                 	                
                             	                    if(city_filter_array && city_filter_array.length && city_filter_array.length > 0)
                             	                    {
                             	                        for(var z = 0; z < city_filter_array.length;z++)
                             	                        {
                             	                            if(city_filter_array[z] == city_din.toLowerCase())
                             	                            {
                             	                                city_continue = true;
                             	                                break;
                             	                            }
                             	                        }
                             	                    }
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            } 
                                 	        
                             	            xml_child_index = 1;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'name_din')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    name_din = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            }
                                         	
                             	            xml_child_index = 2;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'type_din')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    type_din = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            }
                                         	
                             	            xml_child_index = 9;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'address_din')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    address_din = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            }
                                         	
                             	            xml_child_index = 13;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'phone_din')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    phone_din = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            } 

                                            xml_child_index = 27;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'additional_info_link')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    additional_info_link = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            } 


                             	        }
                             	        else
                             	        {
                             	            city_din = trim(i_child_node.childNodes(10).text);
                             	            if(city_filter_array && city_filter_array.length && city_filter_array.length > 0)
                             	            {
                             	                for(var z = 0; z < city_filter_array.length;z++)
                     	                        {
                     	                            if(city_filter_array[z] == city_din.toLowerCase())
                     	                            {
                     	                                city_continue = true;
                     	                                break;
                     	                            }
                     	                        }
                             	            }
                                 	        
                             	            if(city_continue)
                             	            {
                             	                name_din = i_child_node.childNodes(1).text;
                                                type_din = i_child_node.childNodes(2).text;
                                                address_din = i_child_node.childNodes(9).text;
                                                phone_din = i_child_node.childNodes(13).text;
                                                if(i_child_node.childNodes(27)) additional_info_link = i_child_node.childNodes(27).text;
                                            }
                                        }
                                    }
                        
                                    if(error)
                                    {
                                        xml_backup_method = 0;
                                        
                                        for( var j = 0; j < i_child_node.childNodes.length; j++ )
                                        {
                                            var j_child_node =  i_child_node.childNodes(j);
                                            
                                            if(j_child_node && j_child_node.firstChild)
                                            {
                                                switch ( j_child_node.tagName )
                                                {   
                                                    case 'name_din': 
                                                        if(j_child_node.firstChild.text) name_din = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    case 'type_din':
                                                        if(j_child_node.firstChild.text) type_din = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    case 'address_din':
                                                        if(j_child_node.firstChild.text) address_din = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    case 'city_din':
                                                        if(j_child_node.firstChild.text) city_din = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        
                                                        if(city_filter_array && city_filter_array.length && city_filter_array.length > 0)
                                                        {
                                                            for(var z = 0; z < city_filter_array.length;z++)
                             	                            {
                             	                                if(city_filter_array[z] == city_din.toLowerCase())
                             	                                {
                             	                                    city_continue = true;
                             	                                    break;
                             	                                }
                             	                            }
                             	                        }
                                                        break;
                                                    case 'phone_din':
                                                        if(j_child_node.firstChild.text) phone_din = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    case 'additional_info_link':
                                                        if(j_child_node.firstChild.text) additional_info_link = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    default:
                                                        break;
                                                }
                                            }
                                            
                                            if(xml_backup_method == 5)
                                            {
                                                break;
                                            }
                                        }
                                    }
                                    
                                    if(city_continue)
                                    {
                                        var k = 0;
                                        for(k = 0; k < menu.length; k++)
                                        {
                                            if(menu[k] && menu[k].id == type_din)
                                            {
                                                break;
                                            }
                                        }
                                        
                                        if(k >= menu.length)
                                        {
                                            menu[k] = new Object();
                                            menu[k].id = type_din;
                                            menu[k].text = "<table cellpadding='0' cellspacing='0' height='100%' width='100%'><tr><td align='center' valaign='middle'><font style='font-size:20px;font-weight:strong;'>" + type_din + "</font></td></tr></table>";
                                            menu[k].array = new Array();
                                        }

                                        menu[k].array[menu[k].array.length] = new Object();
                                        menu[k].array[menu[k].array.length-1].text = "<table border=0 width='100%' cellpadding=0 cellspacing=0><tr><td width='100%'><font style='font-size:18px;font-weight:strong;white-space:normal;'>" + name_din + "</font><br><font style='font-size:14px;'>" + address_din + ", " + city_din + "</font><br><font style='font-size:14px;'>" + phone_din + "</font></td>" + ( additional_info_link ? "<td><a href='" + additional_info_link + "'><img border=0 alt='' src='ButtonsAndBackgrounds/fingerdatabase2.png' /></a></td>" : "") + "</tr></table>";
                                    }
                                }
                                break;
                            default:
                                break;
                        }
                    }
                }
            }
            
            if(menu && menu.length>0)
            {
                menu = menu.sort(sort_list);
                
                for(var i = 0; i < menu.length; i++ )
                {
                    if( typeof(menu[i].array) != 'undefined' && menu[i].array && menu[i].array.length )
                    {
                        menu[i].array = menu[i].array.sort(sort_list);
                    }
                }
                
                var event_a = new event_viewer(parent_div, menu);
                return event_a;
            }
        }
    }
}

/*
function kern_xml_lodging_viewer ( parent_div, xml_file, city_filter )
{
    function trim(stringToTrim) 
    {
	    return stringToTrim.replace(/^\s+|\s+$/g,"");
    }
    this.trim = trim;

    var menu = new Array();
    var city_filter_array = new Array();
    
    if(city_filter)
    {
        city_filter_array = city_filter.split(",");
        
        if(city_filter_array && city_filter_array.length >0)
        {
            for(var i = 0; i < city_filter_array.length; i++)
            {
                city_filter_array[i] = city_filter_array[i].toLowerCase();
                city_filter_array[i] = trim(city_filter_array[i]);
            }
        }
    }
    
    this.verify_xml = function()
    {
        if (xml_doc && xml_doc.readyState == 4)
        {
            //return true;
        }
        else
        {
            return false;        
        }
    }
    
    function sort_list(a, b)
    {
        if( a && b && typeof(a.text) != 'undefined' && typeof(b.text) != 'undefined')
        {
            if( a.text == b.text ) return 0;
            if( a.text > b.text ) return 1;
            if( a.text < b.text ) return -1;
        }
        
        return 0;
    }
    
    var xml_doc;
    
    if(xml_file)
    {
        if (window.ActiveXObject)
        {
            try 
            {
                xml_doc = new ActiveXObject("MSXML2.DOMDocument");
            } 
            catch (e) 
            {
                try 
                {
                    xml_doc = new ActiveXObject("Microsoft.XMLDOM");
                } 
                catch (e) 
                {
                }
            }
        }
        
        if(xml_doc)
        {
            xml_doc.async="false";
            xml_doc.onreadystatechange = this.verify_xml;
            
            xml_doc.load( xml_file );
            
            if (xml_doc.readyState == 4)
            {
                var xml_obj;
                if(xml_doc.documentElement) xml_obj = xml_doc.documentElement;
                
                if( xml_obj && xml_obj.hasChildNodes() )
                {
                    var name_lodg;
                    var type_lodg = 'lodging';
                    var address_lodg;
                    var city_lodg;
                    var phone_lodg;
                    var error = false;
                    var city_continue = false;
                    var xml_child_index = 0;
                    var xml_backup_method = 0;
                    var additional_info_link;			
                    
                    for( var i = 0; i < xml_obj.childNodes.length; i++ )
                    {
                        var i_child_node =  xml_obj.childNodes(i);
                        
                        switch ( i_child_node.tagName )
                        {        
                            case 'lodging': 
                                if( i_child_node.hasChildNodes() )
                                {       
                                    name_lodg = '';
                                    address_lodg = '';
                                    city_lodg = '';
                                    phone_lodg = '';
                                    additional_info_link = '';
                                    
                                    city_continue = false;
                                    if(!(city_filter_array && city_filter_array.length && city_filter_array.length > 0))
                                    {
                                        city_continue = true;
                                    }
                                    
                             	    if(!error)
                                    {
                             	        if(i==0)
                             	        {
                             	            xml_child_index = 6;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'city_lodg')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    city_lodg = trim(i_child_node.childNodes(xml_child_index).text);
                                 	                
                             	                    if(city_filter_array && city_filter_array.length && city_filter_array.length > 0)
                             	                    {
                             	                        for(var z = 0; z < city_filter_array.length;z++)
                             	                        {
                             	                            if(city_filter_array[z] == city_lodg.toLowerCase())
                             	                            {
                             	                                city_continue = true;
                             	                                break;
                             	                            }
                             	                        }
                             	                    }
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            } 
                                 	        
                             	            xml_child_index = 1;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'name_lodg')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    name_lodg = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            }
                                         	
                                         	xml_child_index = 5;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'address_lodg')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    address_lodg = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            }
                                         	
                             	            xml_child_index = 9;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'phone_lodg')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    phone_lodg = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            } 

                             	            xml_child_index = 24;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'additional_info_link')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    additional_info_link = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            }
                             	        }
                             	        else
                             	        {
                             	            city_lodg = trim(i_child_node.childNodes(6).text);
                             	            if(city_filter_array && city_filter_array.length && city_filter_array.length > 0)
                             	            {
                             	                for(var z = 0; z < city_filter_array.length;z++)
                     	                        {
                     	                            if(city_filter_array[z] == city_lodg.toLowerCase())
                     	                            {
                     	                                city_continue = true;
                     	                                break;
                     	                            }
                     	                        }
                             	            }
                                 	        
                             	            if(city_continue)
                             	            {
                             	                name_lodg = i_child_node.childNodes(1).text;
                                                address_lodg = i_child_node.childNodes(5).text;
                                                phone_lodg = i_child_node.childNodes(9).text;
                                                if(i_child_node.childNodes(24)) additional_info_link = i_child_node.childNodes(24).text;
                                            }
                                        }
                                    }
                        
                                    if(error)
                                    {
                                        xml_backup_method = 0;
                                        
                                        for( var j = 0; j < i_child_node.childNodes.length; j++ )
                                        {
                                            var j_child_node =  i_child_node.childNodes(j);
                                            
                                            if(j_child_node && j_child_node.firstChild)
                                            {
                                                switch ( j_child_node.tagName )
                                                {   
                                                    case 'name_lodg': 
                                                        if(j_child_node.firstChild.text) name_lodg = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    case 'address_lodg':
                                                        if(j_child_node.firstChild.text) address_lodg = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    case 'city_lodg':
                                                        if(j_child_node.firstChild.text) city_lodg = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        
                                                        if(city_filter_array && city_filter_array.length && city_filter_array.length > 0)
                                                        {
                                                            for(var z = 0; z < city_filter_array.length;z++)
                             	                            {
                             	                                if(city_filter_array[z] == city_lodg.toLowerCase())
                             	                                {
                             	                                    city_continue = true;
                             	                                    break;
                             	                                }
                             	                            }
                             	                        }
                                                        break;
                                                    case 'phone_lodg':
                                                        if(j_child_node.firstChild.text) phone_lodg = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    case 'additional_info_link':
                                                        if(j_child_node.firstChild.text) additional_info_link = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    default:
                                                        break;
                                                }
                                            }
                                            
                                            if(xml_backup_method == 4)
                                            {
                                                break;
                                            }
                                        }
                                    }
                                    
                                    if(city_continue)
                                    {
                                        var k = 0;
                                        for(k = 0; k < menu.length; k++)
                                        {
                                            if(menu[k] && menu[k].id == type_lodg)
                                            {
                                                break;
                                            }
                                        }
                                        
                                        if(k >= menu.length)
                                        {
                                            menu[k] = new Object();
                                            menu[k].id = type_lodg;
                                            menu[k].text = "<table cellpadding='0' cellspacing='0' height='100%' width='100%'><tr><td align='center' valaign='middle'><font style='font-size:20px;font-weight:strong;'>" + type_lodg + "</font></td></tr></table>";
                                            menu[k].array = new Array();
                                        }

                                        menu[k].array[menu[k].array.length] = new Object();
                                        menu[k].array[menu[k].array.length-1].text = "<table border=0 width='100%' cellpadding=0 cellspacing=0><tr><td width='100%'><font style='font-size:18px;font-weight:strong;'>" + name_lodg + "</font><br><font style='font-size:14px;'>" + address_lodg + ", " + city_lodg + "</font><br><font style='font-size:14px;'>" + phone_lodg + "</font></td>" + ( additional_info_link ? "<td><a href='" + additional_info_link + "'><img border=0 alt='' src='ButtonsAndBackgrounds/fingerdatabase2.png' /></a></td>" : "") + "</tr></table>";
                                    }
                                }
                                break;
                            default:
                                break;
                        }
                    }
                }
            }
            
            if(menu && menu.length>0)
            {
                menu = menu.sort(sort_list);
                
                for(var i = 0; i < menu.length; i++ )
                {
                    if( typeof(menu[i].array) != 'undefined' && menu[i].array && menu[i].array.length )
                    {
                        menu[i].array = menu[i].array.sort(sort_list);
                    }
                }
                
                var event_a = new event_viewer(parent_div, menu);
                return event_a;
            }
        }
    }
}

function kern_xml_event_viewer ( parent_div, xml_file, city_filter )
{
    function trim(stringToTrim) 
    {
	    return stringToTrim.replace(/^\s+|\s+$/g,"");
    }
    this.trim = trim;

    var menu = new Array();
    var city_filter_array = new Array();
    
    if(city_filter)
    {
        city_filter_array = city_filter.split(",");
        
        if(city_filter_array && city_filter_array.length >0)
        {
            for(var i = 0; i < city_filter_array.length; i++)
            {
                city_filter_array[i] = city_filter_array[i].toLowerCase();
                city_filter_array[i] = trim(city_filter_array[i]);
            }
        }
    }
    
    this.verify_xml = function()
    {
        if (xml_doc && xml_doc.readyState == 4)
        {
            //return true;
        }
        else
        {
            return false;        
        }
    }
    
    function sort_menu(a, b)
    {
        if( a && b && typeof(a.text) != 'undefined' && typeof(b.text) != 'undefined')
        {
            if( a.text == b.text ) return 0;
            if( a.text > b.text ) return 1;
            if( a.text < b.text ) return -1;
        }
        
        return 0;
    }
    
    function sort_list(a, b)
    {
        var a_temp, b_temp;
        
        if( a && b )
        {
            if( typeof(a.event_start_date) != 'undefined' && a.event_start_date )
            {
                a_temp = a.event_start_date;
            }
            else if ( typeof(a.end_date) != 'undefined' && a.end_date )
            {
                a_temp = a.end_date;
            }
            
            if( typeof(b.event_start_date) != 'undefined' && b.event_start_date )
            {
                b_temp = b.event_start_date;
            }
            else if ( typeof(b.end_date) != 'undefined' && b.end_date )
            {
                b_temp = b.end_date;
            }
            
            if( !a_temp && !b_temp)
            {
                return 0;
            }
            else if( a_temp && !b_temp)
            {
                return 1;
            }
            else if( !a_temp && b_temp)
            {
                return -1;
            }
            else if(a_temp && b_temp)
            {
                if( a_temp == b_temp ) return 0;
                if( a_temp > b_temp ) return 1;
                if( a_temp < b_temp ) return -1;
            }
        }
        
        return 1;
    }
    
    var xml_doc;
    
    if(xml_file)
    {
        if (window.ActiveXObject)
        {
            try 
            {
                xml_doc = new ActiveXObject("MSXML2.DOMDocument");
            } 
            catch (e) 
            {
                try 
                {
                    xml_doc = new ActiveXObject("Microsoft.XMLDOM");
                } 
                catch (e) 
                {
                }
            }
        }
        
        if(xml_doc)
        {
            xml_doc.async="false";
            xml_doc.onreadystatechange = this.verify_xml;
            
            xml_doc.load( xml_file );
            
            if (xml_doc.readyState == 4)
            {
                var xml_obj;
                if(xml_doc.documentElement) xml_obj = xml_doc.documentElement;
                
                if( xml_obj && xml_obj.hasChildNodes() )
                {
                    var type_event = 'event';
                    
                    var dt_event_start;
                    var dt_event_end;
                    var tm_event_start;
                    var tm_event_end;
                    var event_name;
                    var event_cost;
                    var event_url;
                    var event_desc;
                    var name_sponsor;
                    var location;
                    var street_addr;
                    var city;

                    var error = false;
                    var city_continue = false;
                    var xml_child_index = 0;
                    var xml_backup_method = 0;
                    var date_split
                    
                    for( var i = 0; i < xml_obj.childNodes.length; i++ )
                    {
                        var i_child_node =  xml_obj.childNodes(i);
                        
                        switch ( i_child_node.tagName )
                        {        
                            case 'calendar_events': 
                                if( i_child_node.hasChildNodes() )
                                {       
                                    dt_event_start = '';
                                    dt_event_end = '';
                                    tm_event_start = '';
                                    tm_event_end = '';
                                    event_name = '';
                                    event_cost = '';
                                    event_url = '';
                                    event_desc = '';
                                    location = '';
                                    street_addr = '';
                                    city = '';
                                    name_sponsor = '';
                                    
                                    city_continue = false;
                                    if(!(city_filter_array && city_filter_array.length && city_filter_array.length > 0))
                                    {
                                        city_continue = true;
                                    }
                                    
                             	    if(!error)
                                    {
                             	        if(i==0)
                             	        {
                             	            xml_child_index = 13;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'city')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    city = trim(i_child_node.childNodes(xml_child_index).text);
                                 	                
                             	                    if(city_filter_array && city_filter_array.length && city_filter_array.length > 0)
                             	                    {
                             	                        for(var z = 0; z < city_filter_array.length;z++)
                             	                        {
                             	                            if(city_filter_array[z] == city.toLowerCase())
                             	                            {
                             	                                city_continue = true;
                             	                                break;
                             	                            }
                             	                        }
                             	                    }
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            } 
                                 	        
                             	            xml_child_index = 1;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'dt_event_start')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    dt_event_start = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            }
                                         	
                                         	xml_child_index = 2;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'dt_event_end')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    dt_event_end = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            }
                                         	
                             	            xml_child_index = 3;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'tm_event_start')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    tm_event_start = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            } 
                             	            
                             	            xml_child_index = 4;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'tm_event_end')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    tm_event_end = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            } 
                             	            
                             	            xml_child_index = 5;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'event_name')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    event_name = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            } 
                             	            
                             	            xml_child_index = 6;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'event_cost')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    event_cost = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            } 
                             	            
                             	            xml_child_index = 7;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'event_url')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    event_url = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            } 
                             	            
                             	            xml_child_index = 8;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'event_desc')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    event_desc = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            } 
                             	            
                             	            xml_child_index = 9;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'name_sponsor')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    name_sponsor = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            } 
                             	            
                             	            xml_child_index = 11;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'location')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    location = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            } 
                             	            
                             	            xml_child_index = 12;
                             	            if( !error && i_child_node.childNodes(xml_child_index) && i_child_node.childNodes(xml_child_index).tagName && i_child_node.childNodes(xml_child_index).tagName == 'street_addr')
                             	            {
                             	                if(i_child_node.childNodes(xml_child_index).text)
                             	                {
                             	                    street_addr = i_child_node.childNodes(xml_child_index).text;
                             	                }
                             	            }
                             	            else
                             	            {
                             	                error = true;
                             	            } 
                             	        }
                             	        else
                             	        {
                             	            city_lodg = trim(i_child_node.childNodes(13).text);
                             	            if(city_filter_array && city_filter_array.length && city_filter_array.length > 0)
                             	            {
                             	                for(var z = 0; z < city_filter_array.length;z++)
                     	                        {
                     	                            if(city_filter_array[z] == city_lodg.toLowerCase())
                     	                            {
                     	                                city_continue = true;
                     	                                break;
                     	                            }
                     	                        }
                             	            }
                                 	        
                             	            if(city_continue)
                             	            {
                             	                dt_event_start = i_child_node.childNodes(1).text;
                                                dt_event_end = i_child_node.childNodes(2).text;
                                                tm_event_start = i_child_node.childNodes(3).text;
                                                //tm_event_end = i_child_node.childNodes(4).text;
                                                event_name = i_child_node.childNodes(5).text;
                                                //event_cost = i_child_node.childNodes(6).text;
                                                //event_url = i_child_node.childNodes(7).text;
                                                //event_desc = i_child_node.childNodes(8).text;
                                                name_sponsor = i_child_node.childNodes(9).text;
                                                location = i_child_node.childNodes(11).text;
                                                street_addr = i_child_node.childNodes(12).text;
                                            }
                                        }
                                    }
                        
                                    if(error)
                                    {
                                        xml_backup_method = 0;
                                        
                                        for( var j = 0; j < i_child_node.childNodes.length; j++ )
                                        {
                                            var j_child_node =  i_child_node.childNodes(j);
                                            
                                            if(j_child_node && j_child_node.firstChild)
                                            {
                                                switch ( j_child_node.tagName )
                                                {   
                                                    case 'dt_event_start': 
                                                        if(j_child_node.firstChild.text) dt_event_start = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    case 'dt_event_end':
                                                        if(j_child_node.firstChild.text) dt_event_end = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    case 'city':
                                                        if(j_child_node.firstChild.text) city_lodg = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        
                                                        if(city_filter_array && city_filter_array.length && city_filter_array.length > 0)
                                                        {
                                                            for(var z = 0; z < city_filter_array.length;z++)
                             	                            {
                             	                                if(city_filter_array[z] == city_lodg.toLowerCase())
                             	                                {
                             	                                    city_continue = true;
                             	                                    break;
                             	                                }
                             	                            }
                             	                        }
                                                        break;
                                                    case 'tm_event_start':
                                                        if(j_child_node.firstChild.text) tm_event_start = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    case 'tm_event_end':
                                                        if(j_child_node.firstChild.text) tm_event_end = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    case 'event_name':
                                                        event_name = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    case 'event_cost':
                                                        if(j_child_node.firstChild.text) event_cost = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    case 'event_url':
                                                        if(j_child_node.firstChild.text) event_url = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    case 'event_desc':
                                                        if(j_child_node.firstChild.text) event_desc = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    case 'location':
                                                        if(j_child_node.firstChild.text) location = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    case 'street_addr':
                                                        if(j_child_node.firstChild.text) street_addr = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;                                                        
                                                    case 'name_sponsor':
                                                        if(j_child_node.firstChild.text) name_sponsor = j_child_node.firstChild.text;
                                                        xml_backup_method++;
                                                        break;
                                                    default:
                                                        break;
                                                }
                                            }
                                            
                                            if(xml_backup_method == 12)
                                            {
                                                break;
                                            }
                                        }
                                    }
                                    
                                    if(city_continue)
                                    {
                                        var k = 0;
                                        for(k = 0; k < menu.length; k++)
                                        {
                                            if(menu[k] && menu[k].id == type_event)
                                            {
                                                break;
                                            }
                                        }
                                        
                                        if(k >= menu.length)
                                        {
                                            menu[k] = new Object();
                                            menu[k].id = type_event;
                                            menu[k].text = "<table cellpadding='0' cellspacing='0' height='100%' width='100%'><tr><td align='center' valaign='middle'><font style='font-size:20px;font-weight:strong;'>" + type_event + "</font></td></tr></table>";
                                            menu[k].array = new Array();
                                        }
                                        
                                        menu[k].array[menu[k].array.length] = new Object();
                                        
                                        date_split = null;
                                        date_split = dt_event_start.split(" ");
                                        if(date_split && date_split.length == 2)
                                        {
                                            date_split = date_split[0].split("-")
                                            
                                            if(date_split && date_split.length == 3)
                                            {
                                                dt_event_start = new Date(parseFloat(date_split[0]), parseFloat(date_split[1]) - 1, parseFloat(date_split[2]));
                                                menu[k].array[menu[k].array.length - 1].event_start_date = dt_event_start;
                                            }
                                        }
                                        
                                        date_split = null;
                                        date_split = dt_event_end.split(" ");
                                        if(date_split && date_split.length == 2)
                                        {
                                            date_split = date_split[0].split("-")
                                            
                                            if(date_split && date_split.length == 3)
                                            {
                                                dt_event_end = new Date(parseFloat(date_split[0]), parseFloat(date_split[1]) - 1, parseFloat(date_split[2]));
                                                
                                                menu[k].array[menu[k].array.length-1].end_date = new Date(dt_event_end.getFullYear(), dt_event_end.getMonth(), dt_event_end.getDate() );
                                                menu[k].array[menu[k].array.length-1].end_date.setDate( dt_event_end.getDate() + 1 );

                                                if(dt_event_end.getDate() > menu[k].array[menu[k].array.length-1].end_date.getDate())
                                                {
                                                    if(dt_event_end.getMonth() == 11)
                                                    {
                                                        menu[k].array[menu[k].array.length-1].end_date.setMonth(0);
                                                    }
                                                    else
                                                    {
                                                        menu[k].array[menu[k].array.length-1].end_date.setMonth(dt_event_end.getMonth() + 1);
                                                    }
                                                }
                                            }
                                        }
                                        
                                        
                                        
                                        menu[k].array[menu[k].array.length-1].text = "<table cellpadding='0' cellspacing='0' height='100%' width='100%'><tr><td align='left' valign='top' width='100px'><font style='font-size:18px;font-weight:strong;'>" + ( dt_event_start ? (dt_event_start.getMonth() + 1 ) + '/' + dt_event_start.getDate() : '' ) + ( dt_event_start && dt_event_end && dt_event_start.toDateString() != dt_event_end.toDateString() ? ' - ' : '' ) + ( dt_event_end && ( !dt_event_start || dt_event_start.toDateString() != dt_event_end.toDateString() ) ? (dt_event_end.getMonth() + 1 ) + '/' + dt_event_end.getDate() : '' ) + "</font></td><td><font style='font-size:18px;font-weight:strong;'>" + event_name + "</font><br><font style='font-size:14px;'>" + tm_event_start + " / " + location + ', ' + street_addr + ', ' + city + ( name_sponsor ? "</font><br><font style='font-size:14px;'>" + name_sponsor + "</font></td></tr></table>" : '');                        
                                    }
                                }
                                break;
                            default:
                                break;
                        }
                    }
                }
            }
            
            if(menu && menu.length>0)
            {
                menu = menu.sort(sort_menu);
                
                for(var i = 0; i < menu.length; i++ )
                {
                    if( typeof(menu[i].array) != 'undefined' && menu[i].array && menu[i].array.length )
                    {
                        menu[i].array = menu[i].array.sort(sort_list);
                    }
                }
                
                var event_a = new event_viewer(parent_div, menu);
                return event_a;
            }
        }
    }
}
*/

function event_viewer( parent_div, menu )
{
    var parent_element = get_item(parent_div);
    
    var initialized = false;
    
    this.first_button_border_width;
    this.first_button_border_color;
    this.first_button_text;
    this.first_button_image;
    this.first_element_font_color;
    this.first_element_padding;
    this.first_element_font_face;
    this.first_element_font_size;
    
    this.forward_button_border_width;
    this.forward_button_border_color;
    this.forward_button_text;
    this.forward_button_image;
    this.forward_element_font_color;
    this.forward_element_padding;
    this.forward_element_font_face;
    this.forward_element_font_size;
    
    this.back_button_border_width;
    this.back_button_border_color;
    this.back_button_text;
    this.back_button_image;
    this.back_element_font_color;
    this.back_element_padding;
    this.back_element_font_face;
    this.back_element_font_size;
    
    this.menu_button_border_width;
    this.menu_button_border_color;
    this.menu_button_text;
    this.menu_button_image;
    this.menu_element_font_color;
    this.menu_element_padding;
    this.menu_element_font_face;
    this.menu_element_font_size;
    
    this.info_border_width;
    this.info_border_width_menu;
    this.info_border_color;
    this.info_text;
    this.info_menu_text;
    this.info_image;
    
    this.menu_items_to_display;
    this.items_to_display;
    
    this.menu_items_columns;
    this.items_columns;
    
    this.item_padding;
    this.item_border_width;
    this.item_border_color;
    this.item_border_width_menu;
    this.item_border_color_menu;
    this.item_background_image;
    this.item_background_image_menu;
    
    var first_element;
    var back_element;
    var forward_element;
    var info_element;
    var list_element;
    var menu_element;
    var main_element;
    var loading_element;
    
    var column_count = 3;
    var page_count = 3;
    var list_page_count = 3;
    var menu_page_count = 3;
    var list_column_count = 3;
    var menu_column_count = 3;
        
    var item_height = 0;
    var item_width = 0;
    var item_padding = 5;
    var item_border_width = 0;
    var item_border_color = 'black';
    var item_border_width_menu = 0;
    var item_border_color_menu = 'black';
    var item_background_image;
    var item_background_image_menu;
    
    var parent_element_border_width = 0;
    
    var list_element_height = 0;
    var list_element_width = 0;
    
    var loading_element_width = 0;
    var loading_element_height = 0;

    var first_element_width = 0;
    var first_element_height = 0;
    var first_element_border_width = 0;
    var first_element_border_color = 'black';
    var first_element_text = 'First Page';
    var first_element_font_color;// = 'black';
    var first_element_padding = '10';
    var first_element_font_face;
    var first_element_font_size;
    var first_element_background_image;
    
    var back_element_width = 0;
    var back_element_height = 0;
    var back_element_border_width = 0;
    var back_element_border_color = 'black';
    var back_element_text = 'Previous Page';
    var back_element_font_color;// = 'black';
    var back_element_padding = '10';
    var back_element_font_face;
    var back_element_font_size;
    var back_element_background_image;
    
    var menu_element_width = 0;
    var menu_element_height = 0;
    var menu_element_border_width = 0;
    var menu_element_border_color = 'black';
    var menu_element_text = 'Menu';
    var menu_element_font_color;// = 'black';
    var menu_element_padding = '10';
    var menu_element_font_face;
    var menu_element_font_size;
    var menu_element_background_image;
    
    var forward_element_width = 0;
    var forward_element_height = 0;
    var forward_element_border_width = 0;
    var forward_element_border_color = 'black';
    var forward_element_text = 'Next Page';
    var forward_element_font_color;// = 'black';
    var forward_element_padding = '10';
    var forward_element_font_face;
    var forward_element_font_size;
    var forward_element_background_image;
    
    var info_element_width = 0;
    var info_element_height = 0;
    var info_element_border_width = 0;
    var info_element_border_color = 'black';
    var info_element_text;// = '';
    var info_element_menu_text;// = '';
    var info_element_background_image;
    
    var parent_client_height = 0;
    var parent_client_width = 0;
    
    //this.first = function()
    function first()
    {
        if(loading_element && loading_element.style && typeof(loading_element.style.visibility) != 'undefined') loading_element.style.visibility = 'visible';
        
        if(initialized && list_element && list_element.children)
        {
            var i = 0;
            var j = 0;
            var finished_drawing = false;
            var total_visible_height = 0;
            var now = new Date();
            var count = 0;
            var row_height = 0;
            
            while(i < list_element.children.length)
            {
                if(list_element.children[i].end_date > now )
                {
                    if( !finished_drawing && count < ( page_count * column_count ) && list_element.children[i].start_date <= now && ( total_visible_height + list_element.children[i].client_height + item_padding + item_padding ) <= list_element_height)
                    {
                        list_element.children[i].style.visibility = 'visible';
                        list_element.children[i].style.display = 'inline-block';
                        list_element.children[i].style.height = list_element.children[i].client_height + 'px';
                        
                        if(row_height < list_element.children[i].client_height)
                        {
                            row_height = list_element.children[i].client_height;
                        }
                        
                        if( ( ( count % column_count ) == column_count - 1 ) || ( i == list_element.children.length - 1 ) )
                        {
                            total_visible_height += row_height + item_padding;
                            
                            for( j = i - ( count % column_count ); j <= i; j++)
                            {
                                if( row_height > list_element.children[j].client_height )
                                {
                                    list_element.children[j].style.height = row_height + 'px';
                                }
                            }
                            
                            row_height = 0;
                        }
                        
                        count++;
                    }
                    else 
                    {
                        list_element.children[i].style.visibility = 'hidden';
                        list_element.children[i].style.display = 'none';
                        
                        if(list_element.children[i].start_date <= now)
                        {
                            finished_drawing = true;                            
                        }
                    }
                    
                    i++;
                }
                else
                {
                    list_element.children[i].outerHTML = '';
                }
            }
            
            if(list_element && list_element.style && typeof(list_element.style.visibility) != 'undefined') list_element.style.visibility = 'visible';
            
            if(back_element && back_element.style && typeof(back_element.style.visibility) != 'undefined') back_element.style.visibility = 'hidden';
            if(first_element && first_element.style && typeof(first_element.style.visibility) != 'undefined') first_element.style.visibility = 'hidden';
            if(forward_element && forward_element.style && typeof(forward_element.style.visibility) != 'undefined') forward_element.style.visibility = 'hidden';

            if(first_element && first_element.style && typeof(first_element.style.display) != 'undefined') first_element.style.display = 'none';
            if(forward_element && forward_element.style && typeof(forward_element.style.display) != 'undefined') forward_element.style.display = 'none';
            if(back_element && back_element.style && typeof(back_element.style.display) != 'undefined') back_element.style.display = 'none';
            
            if( finished_drawing ) 
            {
                if(forward_element && forward_element.style && typeof(forward_element.style.visibility) != 'undefined') forward_element.style.visibility = 'visible';
                if(forward_element && forward_element.style && typeof(forward_element.style.display) != 'undefined') forward_element.style.display = 'block';
            }
        }
        
        if(loading_element && loading_element.style && typeof(loading_element.style.visibility) != 'undefined') loading_element.style.visibility = 'hidden';
    }
    this.first = first;
    
    
    //this.next = function()
    function next()
    {
        if(loading_element && loading_element.style && typeof(loading_element.style.visibility) != 'undefined') loading_element.style.visibility = 'visible';
        
        if(initialized && list_element && list_element.children)
        {
            var i = 0;
            var bool_visible = false;
            var count = 0;
            var finished_drawing = false;
            var total_visible_height = 0;
            var now = new Date();
            
            var first_index = -1;
            var last_index = -1;
            var row_height = 0;
            
            while(!finished_drawing && i < list_element.children.length)
            {
                if(list_element.children[i].end_date > now )
                {
                    if( list_element.children[i].style.visibility.toLowerCase() == 'visible' )
                    {
                        if(!bool_visible)
                        {
                            bool_visible = true;
                        }

                        list_element.children[i].style.visibility = 'hidden';
                        list_element.children[i].style.display = 'none';
                    } 
                    else if ( bool_visible )
                    {
                        if( count < ( page_count * column_count ) && list_element.children[i].start_date <= now && ( total_visible_height + list_element.children[i].client_height + item_padding + item_padding ) <= list_element_height)
                        {
                            if(first_index<0)
                            {
                                first_index = i;
                            }
                            
                            last_index = i;
                            
                            list_element.children[i].style.visibility = 'visible';
                            list_element.children[i].style.display = 'inline-block';
                            list_element.children[i].style.height = list_element.children[i].client_height + 'px';
                            
                            if(row_height < list_element.children[i].client_height)
                            {
                                row_height = list_element.children[i].client_height;
                            }
                            
                            if( ( ( count % column_count ) == column_count - 1 ) || ( i == list_element.children.length - 1 ) )
                            {
                                total_visible_height += row_height + item_padding;
                                
                                for( j = i - ( count % column_count ); j <= i; j++)
                                {
                                    if( row_height > list_element.children[j].client_height )
                                    {
                                        list_element.children[j].style.height = row_height + 'px';
                                    }
                                }
                                
                                row_height = 0;
                            }
                            
                            count++;
                        }
                        else 
                        {
                            list_element.children[i].style.visibility = 'hidden';
                            list_element.children[i].style.display = 'none';
                            
                            if(list_element.children[i].start_date <= now)
                            {
                                finished_drawing = true;                            
                            }
                        }
                    }
                    
                    i++;
                }
                else
                {
                    list_element.children[i].outerHTML = '';
                }
            }

            if(list_element && list_element.style && typeof(list_element.style.visibility) != 'undefined') list_element.style.visibility = 'visible';
            
            if(first_element && first_element.style && typeof(first_element.style.visibility) != 'undefined') first_element.style.visibility = 'hidden';
            if(back_element && back_element.style && typeof(back_element.style.visibility) != 'undefined') back_element.style.visibility = 'hidden';
            if(forward_element && forward_element.style && typeof(forward_element.style.visibility) != 'undefined') forward_element.style.visibility = 'hidden';
                       
            if(first_element && first_element.style && typeof(first_element.style.display) != 'undefined') first_element.style.display = 'none';
            if(forward_element && forward_element.style && typeof(forward_element.style.display) != 'undefined') forward_element.style.display = 'none';
            if(back_element && back_element.style && typeof(back_element.style.display) != 'undefined') back_element.style.display = 'none';
             
            if(count <= 0)
            {
                this.first();
            }
            else
            {
                if( finished_drawing ) 
                {
                    if(forward_element && forward_element.style && typeof(forward_element.style.visibility) != 'undefined') forward_element.style.visibility = 'visible';
                    if(forward_element && forward_element.style && typeof(forward_element.style.display) != 'undefined') forward_element.style.display = 'block';
                }
                else
                {
                    if(first_element && first_element.style && typeof(first_element.style.visibility) != 'undefined') first_element.style.visibility = 'visible';
                    if(first_element && first_element.style && typeof(first_element.style.display) != 'undefined') first_element.style.display = 'block';
                }
                
                if ( first_index >= 0 )
                {
                    if(back_element && back_element.style && typeof(back_element.style.visibility) != 'undefined') back_element.style.visibility = 'visible';
                    if(back_element && back_element.style && typeof(back_element.style.display) != 'undefined') back_element.style.display = 'block';
                }
            }
        }
        
        if(loading_element && loading_element.style && typeof(loading_element.style.visibility) != 'undefined') loading_element.style.visibility = 'hidden';
    }
    this.next = next;
    

    //this.previous = function()
    function previous()
    {
        if(loading_element && loading_element.style && typeof(loading_element.style.visibility) != 'undefined') loading_element.style.visibility = 'visible';
        
        if(initialized && list_element && list_element.children)
        {
            var i = list_element.children.length - 1;
            var bool_visible = false;
            var count = 0;
            var finished_drawing = false;
            var total_visible_height = 0;
            var now = new Date();
            
            var first_index = -1;
            var last_index = -1;
            var row_height = 0;
            
            while(!finished_drawing && i >=0)
            {
                if(list_element.children[i].end_date > now )
                {
                    if( list_element.children[i].style.visibility.toLowerCase() == 'visible' )
                    {
                        if(!bool_visible)
                        {
                            bool_visible = true;
                        }

                        list_element.children[i].style.visibility = 'hidden';
                        list_element.children[i].style.display = 'none';
                    } 
                    else if ( bool_visible )
                    {
                        if( count < ( page_count * column_count ) && list_element.children[i].start_date <= now && ( total_visible_height + list_element.children[i].client_height + item_padding + item_padding ) <= list_element_height)
                        {
                            if(first_index<0)
                            {
                                first_index = i;
                            }
                            
                            last_index = i;
                            
                            list_element.children[i].style.visibility = 'visible';
                            list_element.children[i].style.display = 'inline-block';
                            list_element.children[i].style.height = list_element.children[i].client_height + 'px';
                            
                            if(row_height < list_element.children[i].client_height)
                            {
                                row_height = list_element.children[i].client_height;
                            }
                            
                            if( ( ( count % column_count ) == column_count - 1 ) || ( i == 0 ) )
                            {
                                total_visible_height += row_height + item_padding;
                                
                                for( j = i; j <= i + ( count % column_count ); j++)
                                {
                                    if( row_height > list_element.children[j].client_height )
                                    {
                                        list_element.children[j].style.height = row_height + 'px';
                                    }
                                }
                                
                                row_height = 0;
                            }
                            
                            count++;
                        }
                        else 
                        {
                            list_element.children[i].style.visibility = 'hidden';
                            list_element.children[i].style.display = 'none';
                            
                            if(list_element.children[i].start_date <= now)
                            {
                                if( ( count % column_count ) != 0 )
                                {
                                    for( j = i; j <= i + ( count % column_count ); j++)
                                    {
                                        list_element.children[j].style.visibility = 'hidden';
                                        list_element.children[j].style.display = 'none';
                                    }
                                }
                                
                                finished_drawing = true;                         
                            }
                        }
                    }
                    
                    i--;
                }
                else
                {
                    list_element.children[i].outerHTML = '';
                }
            }

            if(list_element && list_element.style && typeof(list_element.style.visibility) != 'undefined') list_element.style.visibility = 'visible';
            
            if(first_element && first_element.style && typeof(first_element.style.visibility) != 'undefined') first_element.style.visibility = 'hidden';
            if(back_element && back_element.style && typeof(back_element.style.visibility) != 'undefined') back_element.style.visibility = 'hidden';
            if(forward_element && forward_element.style && typeof(forward_element.style.visibility) != 'undefined') forward_element.style.visibility = 'hidden';
            
            if(back_element && back_element.style && typeof(back_element.style.display) != 'undefined') back_element.style.display = 'none';
            if(forward_element && forward_element.style && typeof(forward_element.style.display) != 'undefined') forward_element.style.display = 'none';
            if(first_element && first_element.style && typeof(first_element.style.display) != 'undefined') first_element.style.display = 'none';
                        
            if(count <= 0 )
            {
                this.first();
            }
            else
            {
                if( finished_drawing ) 
                {
                    if(back_element && back_element.style && typeof(back_element.style.visibility) != 'undefined') back_element.style.visibility = 'visible';
                    if(back_element && back_element.style && typeof(back_element.style.display) != 'undefined') back_element.style.display = 'block';
                }
                
                if ( first_index >= 0 )
                {
                    if(forward_element && forward_element.style && typeof(forward_element.style.visibility) != 'undefined') forward_element.style.visibility = 'visible';
                    if(forward_element && forward_element.style && typeof(forward_element.style.display) != 'undefined') forward_element.style.display = 'block';
                }
            }
        }
        
        if(loading_element && loading_element.style && typeof(loading_element.style.visibility) != 'undefined') loading_element.style.visibility = 'hidden';        
    }   
    this.previous = previous;
     
    function menu_button_link()
    {
        if(loading_element && loading_element.style && typeof(loading_element.style.visibility) != 'undefined') loading_element.style.visibility = 'visible';
        
        parent_element.innerHTML = '';
        initialize_work();
        
        if(loading_element && loading_element.style && typeof(loading_element.style.visibility) != 'undefined') loading_element.style.visibility = 'hidden';
    }
    this.menu_button_link = menu_button_link;
     
    //this.menu_click = function()
    function menu_click()
    {
        if(loading_element && loading_element.style && typeof(loading_element.style.visibility) != 'undefined') loading_element.style.visibility = 'visible';
        
        if(this && typeof(this.index_id) != 'undefined' && this.index_id >= 0 )
        {
            parent_element.innerHTML = '';
            initialize_work(this.index_id);
        }
        
        if(loading_element && loading_element.style && typeof(loading_element.style.visibility) != 'undefined') loading_element.style.visibility = 'hidden';
    }
    this.menu_click = menu_click;
     
    function initialize_work( index_id )
    {
        if(parent_element)
        {
            if(typeof(parent_element.style) != 'undefined' && typeof(parent_element.style.borderRightWidth) != 'undefined') parent_element_border_width = convert_to_numeric(parent_element.style.borderRightWidth);
            
            if(window && window.document)
            {
                main_element = window.document.createElement('div');
                if(typeof(main_element.style.visibility) != 'undefined') main_element.style.visibility = 'visible';
                if(typeof(main_element.style.display) != 'undefined') main_element.style.display = 'block';
                if(typeof(main_element.style.clear) != 'undefined') main_element.style.clear = 'none';
                if(typeof(main_element.style.height) != 'undefined') main_element.style.height = '100%';
                if(typeof(main_element.style.width) != 'undefined') main_element.style.width = '100%';
                if(typeof(main_element.style.position) != 'undefined') main_element.style.position = 'relative';
                //if(typeof(main_element.style.whiteSpace) != 'undefined') main_element.style.whiteSpace = 'nowrap';
                if(typeof(main_element.style.marginLeft) != 'undefined') main_element.style.marginLeft = 0 + 'px';
                if(typeof(main_element.style.marginRight) != 'undefined') main_element.style.marginRight = 0 + 'px';
                if(typeof(main_element.style.marginTop) != 'undefined') main_element.style.marginTop = 0 + 'px';
                if(typeof(main_element.style.marginBottom) != 'undefined') main_element.style.marginBottom = 0 + 'px';
                if(typeof(main_element.style.paddingLeft) != 'undefined') main_element.style.paddingLeft = 0 + 'px';
                if(typeof(main_element.style.paddingRight) != 'undefined') main_element.style.paddingRight = 0 + 'px';
                if(typeof(main_element.style.paddingTop) != 'undefined') main_element.style.paddingTop = 0 + 'px';
                if(typeof(main_element.style.paddingTop) != 'undefined') main_element.style.paddingTop = 0 + 'px';
                main_element = parent_element.appendChild(main_element);
                
                if(typeof(main_element.clientHeight) != 'undefined') parent_client_height = convert_to_numeric(main_element.clientHeight);
                if(typeof(main_element.clientWidth) != 'undefined') parent_client_width = convert_to_numeric(main_element.clientWidth);
                
                loading_element = window.document.createElement('div');
                if(typeof(loading_element.style.visibility) != 'undefined') loading_element.style.visibility = 'visible';
                if(typeof(loading_element.style.display) != 'undefined') loading_element.style.display = 'block';
                if(typeof(loading_element.style.clear) != 'undefined') loading_element.style.clear = 'none';
                if(typeof(loading_element.style.height) != 'undefined') loading_element.style.height = '0px';
                if(typeof(loading_element.style.width) != 'undefined') loading_element.style.width = '0px';
                if(typeof(loading_element.style.position) != 'undefined') loading_element.style.position = 'absolute';
                if(typeof(loading_element.style.whiteSpace) != 'undefined') loading_element.style.whiteSpace = 'nowrap';
                if(typeof(loading_element.style.marginLeft) != 'undefined') loading_element.style.marginLeft = 0 + 'px';
                if(typeof(loading_element.style.marginRight) != 'undefined') loading_element.style.marginRight = item_padding + 'px';
                if(typeof(loading_element.style.marginTop) != 'undefined') loading_element.style.marginTop = 0 + 'px';
                if(typeof(loading_element.style.marginBottom) != 'undefined') loading_element.style.marginBottom = 0 + 'px';
                if(typeof(loading_element.style.paddingLeft) != 'undefined') loading_element.style.paddingLeft = 0 + 'px';
                if(typeof(loading_element.style.paddingRight) != 'undefined') loading_element.style.paddingRight = 0 + 'px';
                if(typeof(loading_element.style.paddingTop) != 'undefined') loading_element.style.paddingTop = 0 + 'px';
                if(typeof(loading_element.style.paddingBottom) != 'undefined') loading_element.style.paddingBottom = 0 + 'px';
                if(typeof(loading_element.innerHTML) != 'undefined') loading_element.innerHTML = 'Loading...';
                loading_element = main_element.appendChild(loading_element);
                
                if(typeof(loading_element.clientWidth) != 'undefined') loading_element_width = convert_to_numeric(loading_element.clientWidth);
                if(typeof(loading_element.clientHeight) != 'undefined') loading_element_height = convert_to_numeric(loading_element.clientHeight);
                
                if(typeof(loading_element.style.top) != 'undefined') loading_element.style.top = ( ( parent_client_height / 2 ) - ( loading_element_height / 2 ) ) + 'px';
                if(typeof(loading_element.style.left) != 'undefined') loading_element.style.left = ( ( parent_client_width / 2 ) - ( loading_element_width / 2 ) ) + 'px';
                
                first_element = window.document.createElement('div');
                if(typeof(first_element.style.visibility) != 'undefined') first_element.style.visibility = 'hidden';
                if(typeof(first_element.style.display) != 'undefined') first_element.style.display = 'block';
                if(typeof(first_element.style.clear) != 'undefined') first_element.style.clear = 'none';
                if(typeof(first_element.style.height) != 'undefined') first_element.style.height = '0px';
                if(typeof(first_element.style.width) != 'undefined') first_element.style.width = '0px';
                if(typeof(first_element.style.position) != 'undefined') first_element.style.position = 'relative';
                if(typeof(first_element.style.whiteSpace) != 'undefined') first_element.style.whiteSpace = 'nowrap';
                if(typeof(first_element.style.marginLeft) != 'undefined') first_element.style.marginLeft = 0 + 'px';
                if(typeof(first_element.style.marginRight) != 'undefined') first_element.style.marginRight = item_padding + 'px';
                if(typeof(first_element.style.marginTop) != 'undefined') first_element.style.marginTop = 0 + 'px';
                if(typeof(first_element.style.marginBottom) != 'undefined') first_element.style.marginBottom = 0 + 'px';
                if(typeof(first_element.style.paddingLeft) != 'undefined') first_element.style.paddingLeft = first_element_padding + 'px';
                if(typeof(first_element.style.paddingRight) != 'undefined') first_element.style.paddingRight = first_element_padding + 'px';
                if(typeof(first_element.style.paddingTop) != 'undefined') first_element.style.paddingTop = first_element_padding + 'px';
                if(typeof(first_element.style.paddingBottom) != 'undefined') first_element.style.paddingBottom = first_element_padding + 'px';
                if(typeof(first_element.style.borderTopStyle) != 'undefined') first_element.style.borderTopStyle = 'solid';
                if(typeof(first_element.style.borderTopColor) != 'undefined') first_element.style.borderTopColor = first_element_border_color;
                if(typeof(first_element.style.borderTopWidth) != 'undefined') first_element.style.borderTopWidth = first_element_border_width + 'px';
                if(typeof(first_element.style.borderLeftStyle) != 'undefined') first_element.style.borderLeftStyle = 'solid';
                if(typeof(first_element.style.borderLeftColor) != 'undefined') first_element.style.borderLeftColor = first_element_border_color;
                if(typeof(first_element.style.borderLeftWidth) != 'undefined') first_element.style.borderLeftWidth = first_element_border_width + 'px';
                if(typeof(first_element.style.borderBottomStyle) != 'undefined') first_element.style.borderBottomStyle = 'solid';
                if(typeof(first_element.style.borderBottomColor) != 'undefined') first_element.style.borderBottomColor = first_element_border_color;
                if(typeof(first_element.style.borderBottomWidth) != 'undefined') first_element.style.borderBottomWidth = first_element_border_width + 'px';
                if(typeof(first_element.style.borderRightStyle) != 'undefined') first_element.style.borderRightStyle = 'solid';
                if(typeof(first_element.style.borderRightColor) != 'undefined') first_element.style.borderRightColor = first_element_border_color;
                if(typeof(first_element.style.borderRightWidth) != 'undefined') first_element.style.borderRightWidth = first_element_border_width + 'px';
                
                if(first_element_font_face && typeof(first_element.style.fontFace) != 'undefined') first_element.style.fontFace = first_element_font_face;
                if(first_element_font_color && typeof(first_element.style.color) != 'undefined') first_element.style.color = first_element_font_color;
                if(first_element_background_image && typeof(first_element.style.filter) != 'undefined') first_element.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src=\'' + first_element_background_image + '\')';
                if(typeof(first_element.innerHTML) != 'undefined') first_element.innerHTML = first_element_text;
                first_element.onclick = ( typeof(this.first) != 'undefined' ? this.first : first );
                first_element = main_element.appendChild(first_element);

                forward_element = window.document.createElement('div');
                
                if(typeof(forward_element.style.backgroundColor) != 'undefined') forward_element.style.backgroundColor = 'transparent';
                
                if(typeof(forward_element.style.visibility) != 'undefined') forward_element.style.visibility = 'hidden';
                if(typeof(forward_element.style.display) != 'undefined') forward_element.style.display = 'block';
                if(typeof(forward_element.style.clear) != 'undefined') forward_element.style.clear = 'none';
                if(typeof(forward_element.style.height) != 'undefined') forward_element.style.height = '0px';
                if(typeof(forward_element.style.width) != 'undefined') forward_element.style.width = '0px';
                if(typeof(forward_element.style.position) != 'undefined') forward_element.style.position = 'relative';
                if(typeof(forward_element.style.whiteSpace) != 'undefined') forward_element.style.whiteSpace = 'nowrap';
                if(typeof(forward_element.style.marginLeft) != 'undefined') forward_element.style.marginLeft = 0 + 'px';
                if(typeof(forward_element.style.marginRight) != 'undefined') forward_element.style.marginRight = item_padding + 'px';
                if(typeof(forward_element.style.marginTop) != 'undefined') forward_element.style.marginTop = 0 + 'px';
                if(typeof(forward_element.style.marginBottom) != 'undefined') forward_element.style.marginBottom = 0 + 'px';
                if(typeof(forward_element.style.paddingLeft) != 'undefined') forward_element.style.paddingLeft = forward_element_padding + 'px';
                if(typeof(forward_element.style.paddingRight) != 'undefined') forward_element.style.paddingRight = forward_element_padding + 'px';
                if(typeof(forward_element.style.paddingTop) != 'undefined') forward_element.style.paddingTop = forward_element_padding + 'px';
                if(typeof(forward_element.style.paddingBottom) != 'undefined') forward_element.style.paddingBottom = forward_element_padding + 'px';
                if(typeof(forward_element.style.borderTopStyle) != 'undefined') forward_element.style.borderTopStyle = 'solid';
                if(typeof(forward_element.style.borderTopColor) != 'undefined') forward_element.style.borderTopColor = forward_element_border_color;
                if(typeof(forward_element.style.borderTopWidth) != 'undefined') forward_element.style.borderTopWidth = forward_element_border_width + 'px';
                if(typeof(forward_element.style.borderLeftStyle) != 'undefined') forward_element.style.borderLeftStyle = 'solid';
                if(typeof(forward_element.style.borderLeftColor) != 'undefined') forward_element.style.borderLeftColor = forward_element_border_color;
                if(typeof(forward_element.style.borderLeftWidth) != 'undefined') forward_element.style.borderLeftWidth = forward_element_border_width + 'px';
                if(typeof(forward_element.style.borderBottomStyle) != 'undefined') forward_element.style.borderBottomStyle = 'solid';
                if(typeof(forward_element.style.borderBottomColor) != 'undefined') forward_element.style.borderBottomColor = forward_element_border_color;
                if(typeof(forward_element.style.borderBottomWidth) != 'undefined') forward_element.style.borderBottomWidth = forward_element_border_width + 'px';
                if(typeof(forward_element.style.borderRightStyle) != 'undefined') forward_element.style.borderRightStyle = 'solid';
                if(typeof(forward_element.style.borderRightColor) != 'undefined') forward_element.style.borderRightColor = forward_element_border_color;
                if(typeof(forward_element.style.borderRightWidth) != 'undefined') forward_element.style.borderRightWidth = forward_element_border_width + 'px';
                
                if(forward_element_font_face && typeof(forward_element.style.fontFace) != 'undefined') forward_element.style.fontFace = forward_element_font_face;
                if(forward_element_font_color && typeof(forward_element.style.color) != 'undefined') forward_element.style.color = forward_element_font_color;
                if(typeof(forward_element.innerHTML) != 'undefined') forward_element.innerHTML = forward_element_text;
                if(forward_element_background_image && typeof(forward_element.style.filter) != 'undefined') forward_element.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src=\'' + forward_element_background_image + '\')';
                forward_element.onclick = ( typeof(this.next) != 'undefined' ? this.next : next );
                forward_element = main_element.appendChild(forward_element);
                
                
                
                back_element = window.document.createElement('div');
                if(typeof(back_element.style.visibility) != 'undefined') back_element.style.visibility = 'hidden';
                if(typeof(back_element.style.display) != 'undefined') back_element.style.display = 'block';
                if(typeof(back_element.style.clear) != 'undefined') back_element.style.clear = 'none';
                if(typeof(back_element.style.height) != 'undefined') back_element.style.height = '0px';
                if(typeof(back_element.style.width) != 'undefined') back_element.style.width = '0px';
                if(typeof(back_element.style.position) != 'undefined') back_element.style.position = 'relative';
                if(typeof(back_element.style.whiteSpace) != 'undefined') back_element.style.whiteSpace = 'nowrap';
                if(typeof(back_element.style.marginLeft) != 'undefined') back_element.style.marginLeft = 0 + 'px';
                if(typeof(back_element.style.marginRight) != 'undefined') back_element.style.marginRight = item_padding + 'px';
                if(typeof(back_element.style.marginTop) != 'undefined') back_element.style.marginTop = 0 + 'px';
                if(typeof(back_element.style.marginBottom) != 'undefined') back_element.style.marginBottom = 0 + 'px';
                if(typeof(back_element.style.paddingLeft) != 'undefined') back_element.style.paddingLeft = back_element_padding + 'px';
                if(typeof(back_element.style.paddingRight) != 'undefined') back_element.style.paddingRight = back_element_padding + 'px';
                if(typeof(back_element.style.paddingTop) != 'undefined') back_element.style.paddingTop = back_element_padding + 'px';
                if(typeof(back_element.style.paddingBottom) != 'undefined') back_element.style.paddingBottom = back_element_padding + 'px';
                if(typeof(back_element.style.borderTopStyle) != 'undefined') back_element.style.borderTopStyle = 'solid';
                if(typeof(back_element.style.borderTopColor) != 'undefined') back_element.style.borderTopColor = back_element_border_color;
                if(typeof(back_element.style.borderTopWidth) != 'undefined') back_element.style.borderTopWidth = back_element_border_width + 'px';
                if(typeof(back_element.style.borderLeftStyle) != 'undefined') back_element.style.borderLeftStyle = 'solid';
                if(typeof(back_element.style.borderLeftColor) != 'undefined') back_element.style.borderLeftColor = back_element_border_color;
                if(typeof(back_element.style.borderLeftWidth) != 'undefined') back_element.style.borderLeftWidth = back_element_border_width + 'px';
                if(typeof(back_element.style.borderBottomStyle) != 'undefined') back_element.style.borderBottomStyle = 'solid';
                if(typeof(back_element.style.borderBottomColor) != 'undefined') back_element.style.borderBottomColor = back_element_border_color;
                if(typeof(back_element.style.borderBottomWidth) != 'undefined') back_element.style.borderBottomWidth = back_element_border_width + 'px';
                if(typeof(back_element.style.borderRightStyle) != 'undefined') back_element.style.borderRightStyle = 'solid';
                if(typeof(back_element.style.borderRightColor) != 'undefined') back_element.style.borderRightColor = back_element_border_color;
                if(typeof(back_element.style.borderRightWidth) != 'undefined') back_element.style.borderRightWidth = back_element_border_width + 'px';
                
                if(back_element_background_image && typeof(back_element.style.filter) != 'undefined') back_element.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src=\'' + back_element_background_image + '\')';
                if(back_element_font_face && typeof(back_element.style.fontFace) != 'undefined') back_element.style.fontFace = back_element_font_face;
                if(back_element_font_color && typeof(back_element.style.color) != 'undefined') back_element.style.color = back_element_font_color;
                if(typeof(back_element.innerHTML) != 'undefined') back_element.innerHTML = back_element_text;
                back_element.onclick = ( typeof(this.previous) != 'undefined' ? this.previous : previous )
                back_element = main_element.appendChild(back_element);
                
                
                menu_element = window.document.createElement('div');
                
                if(typeof(menu_element.style.backgroundColor) != 'undefined') menu_element.style.backgroundColor = 'transparent';
                
                if(typeof(menu_element.style.visibility) != 'undefined') menu_element.style.visibility = 'hidden';
                if(typeof(menu_element.style.display) != 'undefined') menu_element.style.display = 'block';
                if(typeof(menu_element.style.clear) != 'undefined') menu_element.style.clear = 'none';
                if(typeof(menu_element.style.height) != 'undefined') menu_element.style.height = '0px';
                if(typeof(menu_element.style.width) != 'undefined') menu_element.style.width = '0px';
                if(typeof(menu_element.style.position) != 'undefined') menu_element.style.position = 'relative';
                if(typeof(menu_element.style.whiteSpace) != 'undefined') menu_element.style.whiteSpace = 'nowrap';
                if(typeof(menu_element.style.marginLeft) != 'undefined') menu_element.style.marginLeft = 0 + 'px';
                if(typeof(menu_element.style.marginRight) != 'undefined') menu_element.style.marginRight = item_padding + 'px';
                if(typeof(menu_element.style.marginTop) != 'undefined') menu_element.style.marginTop = 0 + 'px';
                if(typeof(menu_element.style.marginBottom) != 'undefined') menu_element.style.marginBottom = 0 + 'px';
                if(typeof(menu_element.style.paddingLeft) != 'undefined') menu_element.style.paddingLeft = menu_element_padding + 'px';
                if(typeof(menu_element.style.paddingRight) != 'undefined') menu_element.style.paddingRight = menu_element_padding + 'px';
                if(typeof(menu_element.style.paddingTop) != 'undefined') menu_element.style.paddingTop = menu_element_padding + 'px';
                if(typeof(menu_element.style.paddingBottom) != 'undefined') menu_element.style.paddingBottom = menu_element_padding + 'px';
                if(typeof(menu_element.style.borderTopStyle) != 'undefined') menu_element.style.borderTopStyle = 'solid';
                if(typeof(menu_element.style.borderTopColor) != 'undefined') menu_element.style.borderTopColor = menu_element_border_color;
                if(typeof(menu_element.style.borderTopWidth) != 'undefined') menu_element.style.borderTopWidth = menu_element_border_width + 'px';
                if(typeof(menu_element.style.borderLeftStyle) != 'undefined') menu_element.style.borderLeftStyle = 'solid';
                if(typeof(menu_element.style.borderLeftColor) != 'undefined') menu_element.style.borderLeftColor = menu_element_border_color;
                if(typeof(menu_element.style.borderLeftWidth) != 'undefined') menu_element.style.borderLeftWidth = menu_element_border_width + 'px';
                if(typeof(menu_element.style.borderBottomStyle) != 'undefined') menu_element.style.borderBottomStyle = 'solid';
                if(typeof(menu_element.style.borderBottomColor) != 'undefined') menu_element.style.borderBottomColor = menu_element_border_color;
                if(typeof(menu_element.style.borderBottomWidth) != 'undefined') menu_element.style.borderBottomWidth = menu_element_border_width + 'px';
                if(typeof(menu_element.style.borderRightStyle) != 'undefined') menu_element.style.borderRightStyle = 'solid';
                if(typeof(menu_element.style.borderRightColor) != 'undefined') menu_element.style.borderRightColor = menu_element_border_color;
                if(typeof(menu_element.style.borderRightWidth) != 'undefined') menu_element.style.borderRightWidth = menu_element_border_width + 'px';
                if(menu_element_font_face && typeof(menu_element.style.fontFace) != 'undefined') menu_element.style.fontFace = menu_element_font_face;
                if(menu_element_font_color && typeof(menu_element.style.color) != 'undefined') menu_element.style.color = menu_element_font_color;
                if(typeof(menu_element.innerHTML) != 'undefined') menu_element.innerHTML = menu_element_text;
                if(menu_element_background_image && typeof(menu_element.style.filter) != 'undefined') menu_element.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src=\'' + menu_element_background_image + '\')';
                menu_element.onclick = ( typeof(this.menu_button_link) != 'undefined' ? this.menu_button_link : menu_button_link );
                menu_element = main_element.appendChild(menu_element);
                
                if(typeof(back_element.clientWidth) != 'undefined') back_element_width = convert_to_numeric(back_element.clientWidth);
                if(typeof(forward_element.clientWidth) != 'undefined') forward_element_width = convert_to_numeric(forward_element.clientWidth);
                if(typeof(first_element.clientWidth) != 'undefined') first_element_width = convert_to_numeric(first_element.clientWidth);
                if(typeof(menu_element.clientWidth) != 'undefined') menu_element_width = convert_to_numeric(menu_element.clientWidth);

                if(typeof(back_element.clientHeight) != 'undefined') back_element_height = convert_to_numeric(back_element.clientHeight);
                if(typeof(forward_element.clientHeight) != 'undefined') forward_element_height = convert_to_numeric(forward_element.clientHeight);
                if(typeof(first_element.clientHeight) != 'undefined') first_element_height = convert_to_numeric(first_element.clientHeight);
                if(typeof(menu_element.clientHeight) != 'undefined') menu_element_height = convert_to_numeric(forward_element.clientHeight);
                
                info_element_width = parent_client_width - back_element_width - menu_element_width - ( forward_element_width > first_element_width ? forward_element_width + ( forward_element_border_width * 2 ) : first_element_width + ( first_element_border_width * 2 ) ) - ( item_padding * 7 ) - ( back_element_border_width * 2 ) - ( info_element_border_width * 2 ) - ( menu_element_border_width * 2 );
                
                info_element = window.document.createElement('div');
                if(typeof(info_element.style.visibility) != 'undefined') info_element.style.visibility = 'hidden';
                if(typeof(info_element.style.display) != 'undefined') info_element.style.display = 'block';
                if(typeof(info_element.style.clear) != 'undefined') info_element.style.clear = 'none';
                if(typeof(info_element.style.height) != 'undefined') info_element.style.height = 'auto';
                if(typeof(info_element.style.width) != 'undefined') info_element.style.width = info_element_width + 'px';
                if(typeof(info_element.style.position) != 'undefined') info_element.style.position = 'relative';
                if(typeof(info_element.style.marginLeft) != 'undefined') info_element.style.marginLeft = item_padding + 'px';
                if(typeof(info_element.style.marginRight) != 'undefined') info_element.style.marginRight = 0 + 'px';
                if(typeof(info_element.style.marginTop) != 'undefined') info_element.style.marginTop = 0 + 'px';
                if(typeof(info_element.style.marginBottom) != 'undefined') info_element.style.marginBottom = 0 + 'px';
                if(typeof(info_element.style.paddingLeft) != 'undefined') info_element.style.paddingLeft = item_padding + 'px';
                if(typeof(info_element.style.paddingRight) != 'undefined') info_element.style.paddingRight = item_padding + 'px';
                if(typeof(info_element.style.paddingTop) != 'undefined') info_element.style.paddingTop = item_padding + 'px';
                if(typeof(info_element.style.paddingBottom) != 'undefined') info_element.style.paddingBottom = item_padding + 'px';
                if(typeof(info_element.style.paddingBottom) != 'undefined') info_element.style.paddingBottom = item_padding + 'px';
                if(typeof(info_element.style.borderTopStyle) != 'undefined') info_element.style.borderTopStyle = 'solid';
                if(typeof(info_element.style.borderTopColor) != 'undefined') info_element.style.borderTopColor = info_element_border_color;
                if(typeof(info_element.style.borderTopWidth) != 'undefined') info_element.style.borderTopWidth = info_element_border_width + 'px';
                if(typeof(info_element.style.borderLeftStyle) != 'undefined') info_element.style.borderLeftStyle = 'solid';
                if(typeof(info_element.style.borderLeftColor) != 'undefined') info_element.style.borderLeftColor = info_element_border_color;
                if(typeof(info_element.style.borderLeftWidth) != 'undefined') info_element.style.borderLeftWidth = info_element_border_width + 'px';
                if(typeof(info_element.style.borderBottomStyle) != 'undefined') info_element.style.borderBottomStyle = 'solid';
                if(typeof(info_element.style.borderBottomColor) != 'undefined') info_element.style.borderBottomColor = info_element_border_color;
                if(typeof(info_element.style.borderBottomWidth) != 'undefined') info_element.style.borderBottomWidth = info_element_border_width + 'px';
                if(typeof(info_element.style.borderRightStyle) != 'undefined') info_element.style.borderRightStyle = 'solid';
                if(typeof(info_element.style.borderRightColor) != 'undefined') info_element.style.borderRightColor = info_element_border_color;
                if(typeof(info_element.style.borderRightWidth) != 'undefined') info_element.style.borderRightWidth = info_element_border_width + 'px';
                
                if(info_element_background_image && typeof(info_element.style.filter) != 'undefined') info_element.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src=' + info_element_background_image + ')';
                if(typeof(info_element.innerHTML) != 'undefined') info_element.innerHTML = info_element_text;
                info_element = main_element.appendChild(info_element);
                
                var info_element_height_temp = 0;
                if(typeof(info_element.clientHeight) != 'undefined') info_element_height_temp = convert_to_numeric(info_element.clientHeight);
                
                if(typeof(info_element.innerHTML) != 'undefined') info_element.innerHTML = info_element_menu_text;
                
                if(typeof(info_element.clientHeight) != 'undefined') info_element_height = convert_to_numeric(info_element.clientHeight);
                
                if ( info_element_height_temp > info_element_height ) info_element_height = info_element_height_temp;
                
                var footer_height = 0;
                if( ( info_element_height + ( info_element_border_width * 2 ) ) > footer_height ) footer_height = info_element_height + ( info_element_border_width * 2 );
                if( ( back_element_height + ( back_element_border_width * 2 ) ) > footer_height ) footer_height = back_element_height + ( back_element_border_width * 2 );
                if( ( forward_element_height + ( forward_element_border_width * 2 ) ) > footer_height ) footer_height = forward_element_height + ( forward_element_border_width * 2 );
                if( ( first_element_height + ( first_element_border_width * 2 ) ) > footer_height ) footer_height = first_element_height + ( first_element_border_width * 2 );
                if( ( menu_element_height + ( menu_element_border_width * 2 ) ) > footer_height ) footer_height = menu_element_height + ( menu_element_border_width * 2 );
                
                list_element_height = parent_client_height - ( item_padding * 4 ) - footer_height;
                
                list_element = window.document.createElement('div');
                if(typeof(list_element.style.visibility) != 'undefined') list_element.style.visibility = 'hidden';
                if(typeof(list_element.style.display) != 'undefined') list_element.style.display = 'block';
                if(typeof(list_element.style.height) != 'undefined') list_element.style.height = list_element_height + 'px';
                if(typeof(list_element.style.width) != 'undefined') list_element.style.width = parent_client_width + 'px';
                if(typeof(list_element.style.position) != 'undefined') list_element.style.position = 'absolute';
                if(typeof(list_element.style.marginLeft) != 'undefined') list_element.style.marginLeft = '0px';
                if(typeof(list_element.style.marginRight) != 'undefined') list_element.style.marginRight = '0px';
                if(typeof(list_element.style.marginTop) != 'undefined') list_element.style.marginTop = '0px';
                if(typeof(list_element.style.marginBottom) != 'undefined') list_element.style.marginBottom = '0px';
                if(typeof(list_element.style.paddingLeft) != 'undefined') list_element.style.paddingLeft = '0px';
                if(typeof(list_element.style.paddingRight) != 'undefined') list_element.style.paddingRight = '0px';
                if(typeof(list_element.style.paddingTop) != 'undefined') list_element.style.paddingTop = '0px';
                if(typeof(list_element.style.paddingBottom) != 'undefined') list_element.style.paddingBottom = '0px';
                if(typeof(list_element.style.overflow) != 'undefined') list_element.style.overflow = 'visible';
                
                list_element = main_element.appendChild(list_element);
                
                if(typeof(list_element.clientWidth) != 'undefined') list_element_width = convert_to_numeric(list_element.clientWidth);

                if(menu && typeof(menu.length) != 'undefined' && menu.length > 0)
                {
                    if(typeof(index_id) == 'undefined' && menu.length > 1)
                    {
                        page_count = menu_page_count;
                        column_count = menu_column_count;
                        item_height = ( list_element_height - ( item_border_width_menu * 2 * page_count ) - ( item_padding * ( page_count + 1 ) ) ) / page_count;
                        item_width = ( list_element_width - ( item_padding * ( menu_column_count + 1 ) ) /*- ( item_border_width_menu * 2 * menu_column_count )*/ ) / menu_column_count;
                        
                        for(var i=0; i < menu.length; i++)
                        {
                            var element = window.document.createElement('span');
                            
                            if(menu[i].start_date)
                            {
                                element.start_date = menu[i].start_date;
                            }
                            else
                            {
                                element.start_date = new Date();
                            }
                            
                            if(menu[i].end_date)
                            {
                                element.end_date = menu[i].end_date;
                            }
                            else
                            {
                                element.end_date = new Date(2099, 1, 1);
                            }
                            
                            if(typeof(element.style) != 'undefined')
                            { 
                                if(typeof(element.style.visibility) != 'undefined') element.style.visibility = 'hidden';
                                if(typeof(element.style.display) != 'undefined') element.style.display = 'inline-block';
                                if(typeof(element.style.height) != 'undefined') element.style.height = item_height + 'px';
                                if(typeof(element.style.width) != 'undefined') element.style.width = item_width + 'px';
                                
                                if(typeof(element.style.clear) != 'undefined') element.style.clear = 'none';
                                if(typeof(element.style.whiteSpace) != 'undefined') element.style.whiteSpace = 'normal';
                                
                                if(typeof(element.style.position) != 'undefined') element.style.position = 'relative';
                                if(typeof(element.style.marginLeft) != 'undefined') element.style.marginLeft = item_padding + 'px';
                                if(typeof(element.style.marginRight) != 'undefined') element.style.marginRight = 0 + 'px';
                                if(typeof(element.style.marginTop) != 'undefined') element.style.marginTop = item_padding + 'px';
                                if(typeof(element.style.marginBottom) != 'undefined') element.style.marginBottom = 0 + 'px';
                                if(typeof(element.style.paddingLeft) != 'undefined') element.style.paddingLeft = item_padding + 'px';
                                if(typeof(element.style.paddingRight) != 'undefined') element.style.paddingRight = item_padding + 'px';
                                if(typeof(element.style.paddingTop) != 'undefined') element.style.paddingTop = item_padding + 'px';
                                if(typeof(element.style.paddingBottom) != 'undefined') element.style.paddingBottom = item_padding + 'px';
                                
                                if(typeof(element.style.borderTopStyle) != 'undefined') element.style.borderTopStyle = 'solid';
                                if(typeof(element.style.borderTopColor) != 'undefined') element.style.borderTopColor = item_border_color_menu;
                                if(typeof(element.style.borderTopWidth) != 'undefined') element.style.borderTopWidth = item_border_width_menu + 'px';
                                if(typeof(element.style.borderLeftStyle) != 'undefined') element.style.borderLeftStyle = 'solid';
                                if(typeof(element.style.borderLeftColor) != 'undefined') element.style.borderLeftColor = item_border_color_menu;
                                if(typeof(element.style.borderLeftWidth) != 'undefined') element.style.borderLeftWidth = item_border_width_menu + 'px';
                                if(typeof(element.style.borderBottomStyle) != 'undefined') element.style.borderBottomStyle = 'solid';
                                if(typeof(element.style.borderBottomColor) != 'undefined') element.style.borderBottomColor = item_border_color_menu;
                                if(typeof(element.style.borderBottomWidth) != 'undefined') element.style.borderBottomWidth = item_border_width_menu + 'px';
                                if(typeof(element.style.borderRightStyle) != 'undefined') element.style.borderRightStyle = 'solid';
                                if(typeof(element.style.borderRightColor) != 'undefined') element.style.borderRightColor = item_border_color_menu;
                                if(typeof(element.style.borderRightWidth) != 'undefined') element.style.borderRightWidth = item_border_width_menu + 'px';
                                
                                if(item_background_image_menu && typeof(element.style.filter) != 'undefined') element.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src=' + item_background_image_menu + ')';
                                
                                element.index_id = i;
                                
                                element.onclick = menu_click;
                                
                                if(typeof(element.innerHTML) != 'undefined') element.innerHTML = menu[i].text;
                            }
                            
                            element = list_element.appendChild(element);
                            
                            if(typeof(element.clientwidth) != 'undefined')
                            {
                                element.client_width = convert_to_numeric(element.clientWidth) /*+ ( item_border_width_menu * 2 )*/;
                                
                                if( element.client_width > item_width )
                                {
                                    element.client_width = item_width;
                                    if(typeof(element.style.overflow) != 'undefined') element.style.overflow = 'scroll';
                                }
                            }
                            
                            if(typeof(element.clientHeight) != 'undefined')
                            {
                                element.client_height = convert_to_numeric(element.clientHeight) /*+ ( item_border_width_menu * 2 )*/;
                                
                                if( element.client_height > ( list_element_height - ( item_padding * 2 ) ) )
                                {
                                    element.client_height = list_element_height - ( item_padding * 2 );
                                    if(typeof(element.style.height) != 'undefined') element.style.height = element.client_height  + 'px';
                                    if(typeof(element.style.overflow) != 'undefined') element.style.overflow = 'scroll';
                                }
                            }
                            
                            if(typeof(element.style.display) != 'undefined') element.style.display = 'none';
                        }
                        
                        if(typeof(info_element.innerHTML) != 'undefined') info_element.innerHTML = info_element_menu_text;
                        if(menu_element && menu_element.style && typeof(menu_element.style.visibility) != 'undefined') menu_element.style.visibility = 'hidden';
                    }
                    else
                    {
                        page_count = list_page_count;
                        column_count = list_column_count;
                        item_height = ( list_element_height - ( item_border_width * 2 * page_count ) - ( item_padding * ( page_count + 1 ) ) ) / page_count;
                        item_width = ( list_element_width - ( item_padding * ( list_column_count + 1 ) ) /*- ( item_border_width * 2 * list_column_count )*/ ) / list_column_count;
                        
                        if(!index_id)
                        {
                            index_id = 0;
                        }

                        if(menu.length > index_id && menu[index_id].array && menu[index_id].array.length)
                        {
                            for(var i=0; i < menu[index_id].array.length; i++)
                            {
                                var element = window.document.createElement('span');
                                
                                if(menu[index_id].array[i].start_date)
                                {
                                    element.start_date = menu[index_id].array[i].start_date;
                                }
                                else
                                {
                                    element.start_date = new Date();
                                }
                                
                                if(menu[index_id].array[i].end_date)
                                {
                                    element.end_date = menu[index_id].array[i].end_date;
                                }
                                else
                                {
                                    element.end_date = new Date(2099, 1, 1);
                                }
                                
                                if(typeof(element.style) != 'undefined')
                                { 
                                    if(typeof(element.style.visibility) != 'undefined') element.style.visibility = 'hidden';
                                    if(typeof(element.style.display) != 'undefined') element.style.display = 'inline-block';
                                    if(typeof(element.style.height) != 'undefined') element.style.height = item_height + 'px';
                                    if(typeof(element.style.width) != 'undefined') element.style.width = item_width + 'px';
                                    
                                    if(typeof(element.style.clear) != 'undefined') element.style.clear = 'none';
                                    if(typeof(element.style.whiteSpace) != 'undefined') element.style.whiteSpace = 'normal';
                                
                                    if(typeof(element.style.position) != 'undefined') element.style.position = 'relative';
                                    if(typeof(element.style.marginLeft) != 'undefined') element.style.marginLeft = item_padding + 'px';
                                    if(typeof(element.style.marginRight) != 'undefined') element.style.marginRight = 0 + 'px';
                                    if(typeof(element.style.marginTop) != 'undefined') element.style.marginTop = item_padding + 'px';
                                    if(typeof(element.style.marginBottom) != 'undefined') element.style.marginBottom = 0 + 'px';
                                    if(typeof(element.style.paddingLeft) != 'undefined') element.style.paddingLeft = item_padding + 'px';
                                    if(typeof(element.style.paddingRight) != 'undefined') element.style.paddingRight = item_padding + 'px';
                                    if(typeof(element.style.paddingTop) != 'undefined') element.style.paddingTop = item_padding + 'px';
                                    if(typeof(element.style.paddingBottom) != 'undefined') element.style.paddingBottom = item_padding + 'px';
                                    
                                    if(typeof(element.style.borderTopStyle) != 'undefined') element.style.borderTopStyle = 'solid';
                                    if(typeof(element.style.borderTopColor) != 'undefined') element.style.borderTopColor = item_border_color;
                                    if(typeof(element.style.borderTopWidth) != 'undefined') element.style.borderTopWidth = item_border_width + 'px';
                                    if(typeof(element.style.borderLeftStyle) != 'undefined') element.style.borderLeftStyle = 'solid';
                                    if(typeof(element.style.borderLeftColor) != 'undefined') element.style.borderLeftColor = item_border_color;
                                    if(typeof(element.style.borderLeftWidth) != 'undefined') element.style.borderLeftWidth = item_border_width + 'px';
                                    if(typeof(element.style.borderBottomStyle) != 'undefined') element.style.borderBottomStyle = 'solid';
                                    if(typeof(element.style.borderBottomColor) != 'undefined') element.style.borderBottomColor = item_border_color;
                                    if(typeof(element.style.borderBottomWidth) != 'undefined') element.style.borderBottomWidth = item_border_width + 'px';
                                    if(typeof(element.style.borderRightStyle) != 'undefined') element.style.borderRightStyle = 'solid';
                                    if(typeof(element.style.borderRightColor) != 'undefined') element.style.borderRightColor = item_border_color;
                                    if(typeof(element.style.borderRightWidth) != 'undefined') element.style.borderRightWidth = item_border_width + 'px';
                                    
                                    if(item_background_image && typeof(element.style.filter) != 'undefined') element.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src=' + item_background_image + ')';
                                    
                                    if(typeof(element.innerHTML) != 'undefined') element.innerHTML = menu[index_id].array[i].text;
                                }
                                
                                element = list_element.appendChild(element);
                                
                                if(typeof(element.clientWidth) != 'undefined')
                                {
                                    element.client_width = convert_to_numeric(element.clientWidth) /*+ ( item_border_width * 2 )*/;
                                    
                                    if( element.client_width > item_width )
                                    {
                                        element.client_width = item_width;
                                        if(typeof(element.style.overflowX) != 'undefined') element.style.overflowX = 'scroll';
                                    }
                                }
                                
                                if(typeof(element.clientHeight) != 'undefined')
                                {
                                    element.client_height = convert_to_numeric(element.clientHeight) /*+ ( item_border_width * 2 )*/;
                                    
                                    if( element.client_height > ( list_element_height - ( item_padding * 2 ) ) )
                                    {
                                        element.client_height = list_element_height - ( item_padding * 2 );
                                        if(typeof(element.style.height) != 'undefined') element.style.height = element.client_height  + 'px';
                                        if(typeof(element.style.overflow) != 'undefined') element.style.overflow = 'scroll';
                                    }
                                }
                                
                                if(typeof(element.style.display) != 'undefined') element.style.display = 'none';
                            }
                            
                            if(typeof(info_element.innerHTML) != 'undefined') info_element.innerHTML = info_element_text;
                            if(menu.length > 1)
                            {
                                if(menu_element && menu_element.style && typeof(menu_element.style.visibility) != 'undefined') menu_element.style.visibility = 'visible';
                            }
                        }
                    }
                    
                    if(typeof(list_element.style.top) != 'undefined') list_element.style.top = 0 + 'px';
                    if(typeof(list_element.style.left) != 'undefined') list_element.style.left = 0 + 'px';
                    
                    if(typeof(loading_element.style.top) != 'undefined') loading_element.style.top = ( ( list_element_height / 2 ) - ( loading_element_height / 2 ) ) + 'px';
                    
                    if(typeof(forward_element.style.styleFloat) != 'undefined') forward_element.style.styleFloat = 'right';
                    if(typeof(forward_element.style.top) != 'undefined') forward_element.style.top = ( parent_client_height - forward_element_height - forward_element_border_width - item_padding ) + 'px';
                
                    if(typeof(back_element.style.styleFloat) != 'undefined') back_element.style.styleFloat = 'right';
                    if(typeof(back_element.style.top) != 'undefined') back_element.style.top = ( parent_client_height - back_element_height - back_element_border_width - item_padding ) + 'px';
                    
                    if(typeof(first_element.style.styleFloat) != 'undefined') first_element.style.styleFloat = 'right';
                    if(typeof(first_element.style.top) != 'undefined') first_element.style.top = ( parent_client_height - first_element_height - first_element_border_width - item_padding ) + 'px';

                    if(typeof(menu_element.style.styleFloat) != 'undefined') menu_element.style.styleFloat = 'right';
                    if(typeof(menu_element.style.top) != 'undefined') menu_element.style.top = ( parent_client_height - menu_element_height - menu_element_border_width - item_padding ) + 'px';

                    if(typeof(info_element.style.left) != 'undefined') info_element.style.left = '0px';
                    if(typeof(info_element.style.top) != 'undefined') info_element.style.top = ( parent_client_height - info_element_height - info_element_border_width - item_padding ) + 'px';
                    if(typeof(info_element.style.visibility) != 'undefined') info_element.style.visibility = 'visible';            
                    
                    if(typeof(forward_element.style.display) != 'undefined') forward_element.style.display = 'none';            
                    if(typeof(first_element.style.display) != 'undefined') first_element.style.display = 'none';            
                    if(typeof(back_element.style.display) != 'undefined') back_element.style.display = 'none';            
                    
                    initialized = true;   
                    
                    if( typeof(this.first) != 'undefined' )
                    {
                        this.first();
                    }
                    else
                    {
                        first();
                    }
                }
            }
        }
    }
    
    this.initialize = function( index_id )
    {
        if(this.items_to_display) list_page_count = this.items_to_display;
        if(this.menu_items_to_display) menu_page_count = this.menu_items_to_display;
        
        if(this.items_columns) list_column_count = this.items_columns;
        if(this.menu_items_columns) menu_column_count = this.menu_items_columns;
        
        if(this.item_padding) item_padding = this.item_padding;
        if(this.item_border_width) item_border_width = this.item_border_width;
        if(this.item_border_color) item_border_color = this.item_border_color;
        
        if(this.item_border_width_menu) item_border_width_menu = this.item_border_width_menu;
        if(this.item_border_color_menu) item_border_color_menu = this.item_border_color_menu;
        
        if(this.item_background_image) 
        {
            item_background_image = this.item_background_image;
            item_background_image_menu = this.item_background_image;
        }
        if(this.item_background_image_menu) item_background_image_menu = this.item_background_image_menu;
        
        if(this.first_button_border_width) first_element_border_width = this.first_button_border_width;
        if(this.first_button_border_color) first_element_border_color = this.first_button_border_color;
        if(this.first_button_text) first_element_text = this.first_button_text;
        if(this.first_button_image) first_element_background_image = this.first_button_image;
        if(this.first_element_font_color) first_element_font_color = this.first_element_font_color;
        if(this.first_element_padding) first_element_padding = this.first_element_padding;
        if(this.first_element_font_face) first_element_font_face = this.first_element_font_face;
        if(this.first_element_font_size) first_element_font_size = this.first_element_font_size;
    
        if(this.back_button_border_width) back_element_border_width = this.back_button_border_width;
        if(this.back_button_border_color) back_element_border_color = this.back_button_border_color;
        if(this.back_button_text) back_element_text = this.back_button_text;
        if(this.back_button_image) back_element_background_image = this.back_button_image;
        if(this.back_element_font_color) back_element_font_color = this.back_element_font_color;
        if(this.back_element_padding) back_element_padding = this.back_element_padding;
        if(this.back_element_font_face) back_element_font_face = this.back_element_font_face;
        if(this.back_element_font_size) back_element_font_size = this.back_element_font_size;
        
        if(this.forward_button_border_width) forward_element_border_width = this.forward_button_border_width;
        if(this.forward_button_border_color) forward_element_border_color = this.forward_button_border_color;
        if(this.forward_button_text) forward_element_text = this.forward_button_text;
        if(this.forward_button_image) forward_element_background_image = this.forward_button_image;
        if(this.forward_element_font_color) forward_element_font_color = this.forward_element_font_color;
        if(this.forward_element_padding) forward_element_padding = this.forward_element_padding;
        if(this.forward_element_font_face) forward_element_font_face = this.forward_element_font_face;
        if(this.forward_element_font_size) forward_element_font_size = this.forward_element_font_size;
        
        if(this.menu_button_border_width) menu_element_border_width = this.menu_button_border_width;
        if(this.menu_button_border_color) menu_element_border_color = this.menu_button_border_color;
        if(this.menu_button_text) menu_element_text = this.menu_button_text;
        if(this.menu_button_image) menu_element_background_image = this.menu_button_image;
        if(this.menu_element_font_color) menu_element_font_color = this.menu_element_font_color;
        if(this.menu_element_padding) menu_element_padding = this.menu_element_padding;
        if(this.menu_element_font_face) menu_element_font_face = this.menu_element_font_face;
        if(this.menu_element_font_size) menu_element_font_size = this.menu_element_font_size;
        
        if(this.info_border_width) info_element_border_width = this.info_border_width;
        if(this.info_border_color) info_element_border_color = this.info_border_color;
        if(this.info_text) info_element_text = this.info_text;
        if(this.info_menu_text) info_element_menu_text = this.info_menu_text;
        if(this.info_image) info_element_background_image = this.info_image;
        
        initialize_work();      
    }
}