// Variables ============================================================================
// Set different variables to customize menu

var mouseover_menus = '#c0c0c0';
var mouseout_menus  = '#dddddd';

var mouseover_items = '#f0f0f0';
var mouseout_items  = '#f9f9f9';


// Write menus here
var menus = new Array (
                    "Land Force",
                    "Naval Force",
                    "Air force",
                    "Air Defense",
                    "Cypriot Army",
                    "Special equipment",
                    "Parades-Exercises",
                    "Military History",
                    "Defence Industry",
                    "Military Video",
                    "Military Posters",
                    "Affiliates & Contacts"
                    );

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 (                    
                    "Home|http://www.greekmilitary.net",
                    "Greek Soldiers|http://greekmilitary.net/greektroops.htm",
                    "Greek Tanks|http://greekmilitary.net/greekmbtanks.htm",
                    "Greek AFV |http://greekmilitary.net/armouredvechiles.htm",
                    "Greek Artillery|http://greekmilitary.net/artillery.htm"                    
                    );
                    

items[1]  = new Array (
                    "Greek Navy|http://greekmilitary.net/navy.htm",
                    "Greek Navy 2|http://greekmilitary.net/navy2.htm"              
                    );
                    
items[2]  = new Array (                    
                    "F-16 Falcon|http://greekmilitary.net/GreekF16.htm",
                    "Mirage 2000|http://greekmilitary.net/Mirage2000.htm",
                    "Mirage F-1|http://greekmilitary.net/Mirage F1.htm",
                    "F-4 Phantom|http://greekmilitary.net/GreekF4.htm",
                    "F-5 A/B|http://greekmilitary.net/F-5 AB.htm",
                    "A-7 Corsair II|http://greekmilitary.net/GreekA7.htm",
                    "C130 Hercules|http://greekmilitary.net/C130Hercules.htm",
                    "EMB-145H|http://greekmilitary.net/EMB-145H.htm",
                    "P3 Orion|http://greekmilitary.net/P3Orion.htm",
                    "T-2E Buckeye|http://greekmilitary.net/T-2E Buckeye.htm",
                    "T-6A Texan II|http://greekmilitary.net/T-6A Texan II.htm"
                    );

items[3]  = new Array (                    
                    "Air defense Systems|http://greekmilitary.net/airdefence.htm"
                    );
                    

items[4]  = new Array (                    
                    "Cypriot Soldiers|http://www.greekmilitary.net/cypriottroops.html",
                    "Cypriot AFV|http://www.greekmilitary.net/cypriotafv.html",
                    "Cypriot MBT|http://www.greekmilitary.net/cypriotmbt.html",
                    "Cypriot Artillery|http://www.greekmilitary.net/cypriotartillery.html",
                    "Cypriot Helicopters|http://www.greekmilitary.net/cypriotairforce.html"
                    );
                    

items[5]  = new Array (                    
                    "Surveillance|http://greekmilitary.net/survailance.htm",
                    "UAV|http://greekmilitary.net/uav.htm",
                    "Anti Tank|http://greekmilitary.net/Antitank.htm",
                    "Other|http://greekmilitary.net/bombs.htm"
                    );

items[6]  = new Array (                    
                    "Nato 2006|http://greekmilitary.net/nato2006.htm",
                    "Parade 2005|http://greekmilitary.net/grkarmyparade2005.htm",
                    "Parade 2006|http://greekmilitary.net/grkarmyparade2006.htm",
                    "Parade 2008|http://greekmilitary.net/army2008parade.htm"
                    );
                    
items[7]  = new Array (                    
                    "World War Two|http://greekmilitary.net/WW2.htm",
                    "The Spartans of 1974|http://greekmilitary.net/Spartans74.html",
                    "The Metaxas line|http://greekmilitary.net/metaxas.html"
                    );

items[8]  = new Array (                    
                    "Defence Industry|http://www.greekmilitary.net/GreekDefenceIndustry.html"
                    );
                    
items[9]  = new Array (                    
                    "Greek Forces Video|http://www.youtube.com/user/DaGrkWebMaster"
                    );

items[10]  = new Array (                    
                    "Greek Forces Posters|http://www.greekmilitary.net/GrkArmyPromo.htm"
                    );

items[11]  = new Array (                    
                    "Links Page|http://greekmilitary.net/greatgreeklinks.htm",
                    "Contact US|http://greekmilitary.net/emails.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[1] != 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