// Variables ============================================================================
// Set different variables to customize menu

var mouseover_menus = '#ffcc00';
var mouseout_menus  = '#ffcc33';

var mouseover_items = '#cccccc';
var mouseout_items  = '#ffffff';


// Write menus here
var menus = new Array (
                    "Home|http://www.djentertainment.co.nz/html",
                    "Contact|http://www.djentertainment.co.nz/html/contact.html",
                    "Corporates",
					"Weddings",
					"Schools",
					"Birthdays",
										"Our DJ's|http://www.djentertainment.co.nz/html/dj.html",
										"Reference|http://www.djentertainment.co.nz/html/references.html",
										"Music|http://www.djentertainment.co.nz/html/music.html",
										"Our Equipment",
										"Photos|http://www.djentertainment.co.nz/html/photos.html",
										"Jukebox / Karaoke|http://www.djentertainment.co.nz/html/jukebox.html",
										"Get Info Pack|http://www.djentertainment.co.nz/html/getinfopack.html",
										"Links|http://www.djentertainment.co.nz/html/links.html"
                    );

var items = new Array();

// Write menu Items here respectively. If any menu item don't have sub items, then leave its respective array blank
items[0]  = new Array ("|http://www.djentertainment.co.nz/html");
                    

items[1]  = new Array ("|http://www.djentertainment.co.nz/html/contact.html");
                    
items[2]  = new Array (                    
                    "Conferences|http://www.djentertainment.co.nz/html/corporates.html",
                    "Work Socials|http://www.djentertainment.co.nz/html/corporates.html",
                    "Xmas Parties|http://www.djentertainment.co.nz/html/corporates.html"
                    );
                    
items[3]  = new Array (                    
                    "Planning Options|http://www.djentertainment.co.nz/html/planning_options.html",
										"Ceremony Options|http://www.djentertainment.co.nz/html/ceremony_options.html",
                    "Reception Options|http://www.djentertainment.co.nz/html/celebration_options.html",
										"Our Wedding Story|http://www.djentertainment.co.nz/html/weddings.html"
                    );

items[4]  = new Array (                    
                    "Themes & Ideas|http://www.djentertainment.co.nz/html/schools.html",
                    "High Schools|http://www.djentertainment.co.nz/html/school_dj_package.html",
                    "School Balls|http://www.djentertainment.co.nz/html/schoolballdj.html",
                    "Primary/Intermediate|http://www.djentertainment.co.nz/html/school_primary.html"
                    );

items[5]  = new Array (                    
                    "Birthday Packages|http://www.djentertainment.co.nz/html/birthdays.html",
                    "18th Birthday|http://www.djentertainment.co.nz/html/birthday18th.html",
                    "21st Birthdays|http://www.djentertainment.co.nz/html/birthday21st.html",
                    "30th Birthdays|http://www.djentertainment.co.nz/html/birthday30th.html",
										"40th Birthdays|http://www.djentertainment.co.nz/html/birthday40th.html"
                    );

items[6]  = new Array (                    
                    "|http://www.djentertainment.co.nz/html/dj.html");

items[7]  = new Array (                    
                    "|http://www.djentertainment.co.nz/html/references.html"
                    );

items[8]  = new Array (                    
                    "|http://www.djentertainment.co.nz/html/music.html"
                    );

items[9]  = new Array (                    
                    "Music Equipment|http://www.djentertainment.co.nz/html/equipmentsales.html",
                    "Lighting Effects|http://www.djentertainment.co.nz/html/lighting.html"
                    );

items[10]  = new Array (                    
                    "|http://www.djentertainment.co.nz/html/photos.html"
                    );

items[11]  = new Array (                    
                    "|http://www.djentertainment.co.nz/html/jukebox.html");

items[12]  = new Array (                    
                    "Get Info Pack|http://www.djentertainment.co.nz/html/getinfopack.html"
                    );
items[13]  = new Array (                    
                    "Links|http://www.djentertainment.co.nz/html/links.html"
                    );


// Functions ============================================================================
// Don't Edit Below


// Menu Title Mouse Over-Mouse Out
function menu_over(x)
    {
        if(document.getElementById||(document.all && !(document.getElementById)))
            {
                x.style.backgroundColor=mouseover_menus;
            }
     }

function menu_out(x)
    {
        if(document.getElementById||(document.all && !(document.getElementById)))
            {
                x.style.backgroundColor=mouseout_menus;
            }
    }

// Item Mouse Over-Mouse Out
function item_over(x)
    {
        if(document.getElementById||(document.all && !(document.getElementById)))
            {
                x.style.backgroundColor=mouseover_items;
            }
    }

function item_out(x)
    {
        if(document.getElementById||(document.all && !(document.getElementById)))
            {
                x.style.backgroundColor=mouseout_items;
            }
    }
 
 
 
// Statement to collapse items;
function collapse(id)
    {
        if (document.getElementById(id).style.display=="")
            {
                document.getElementById(id).style.display = "none";
                return;
            }
        for (i=0; i<menus.length; i++)
            {
                var others = document.getElementById(i+1);
                others.style.display = "none";
            }
        document.getElementById(id).style.display = "";
    }
 
// Statement to open links
function go(url)
    {
        window.location=url;
    }
 
                     
                         
// Writes menu
function write_menu()
    {
        document.write('<div id="navigation_bar">');
        
        for(x=0; x<menus.length; x++)
            {
                document.write('<div>');
                
                // Spilts menus into array for menu name and url
                var menu_array  = menus[x].split("|");
                // If menus url is not available the just makes expand and collapse effect on menu
                if (!menu_array[1])
                    {
                        var menu  = '<div id="menu" onMouseOver=menu_over(this); onMouseOut=menu_out(this); onClick="collapse(\''+(x+1)+'\')">'+menus[x]+'</div>';
                    }
                else
                    {
                        var menu  = '<div id="menu" onMouseOver=menu_over(this); onMouseOut=menu_out(this); onClick="collapse(\''+(x+1)+'\'); go(\''+menu_array[1]+'\')"><a href="'+menu_array[1]+'">'+menu_array[0]+'</a></div>';
                    }
                document.write(menu); 
                    
                // Checks if current menu has items then writes items
                if(items[x] !='')
                    {
                        // If menu is not current then sets its display to none
                        if (menu_array[0] != current_menu)
                            {
                                document.write('<div style="display:none" id="'+(x+1)+'">');
                            }
                        else
                            {
                                document.write('<div style="display:" id="'+(x+1)+'">');
                            }
                                
                            // Writes Items
                            for(y=0; y<items[x].length; y++)
                                {
                                    // Splits current item into name and url
                                    var item_array   = items[x][y].split("|");
                                    
                                    // If item name is not current then acts with it as a ordinary item
                                    if (item_array[0] != current_item)
                                        {
                                            document.write('<div id="item" onMouseOver=item_over(this); onMouseOut=item_out(this); onClick="go(\''+item_array[1]+'\')"><a href="'+item_array[1]+'">'+item_array[0]+'</a></div>');
                                        }
                                    // Or if it current, then removes hyperlink and change it background color to current items background color
                                    else
                                        {
                                            document.write('<div id="current_item">'+item_array[0]+'</div>');
                                        }
        
                                }
                        }
                        
                    document.write('</div>');            
                document.write('</div>');
            }
            
        document.write('</div>');
    }
    
function stoperror()
    {
        return true
    }
    
window.onerror=stoperror