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

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

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


// Write menus here
var menus = new Array (
					"Main",
                    "Action",
                    "Culture",
					"News",
					"Life",
                    "Play"
                    );

var items = new Array();

// Write menu Items here respectively. If any menu item don't have sub items, then leave its respective array blank
//Home
items[0]  = new Array (                    
                    "Home Page|http://www.insitemag.net/home.htm",
					"Action|http://www.insitemag.net/action.htm",
					"Culture|http://www.insitemag.net/culture.htm",
					"News|http://www.insitemag.net/news.htm",
					"Life|http://www.insitemag.net/life.htm",
					"Play|http://www.insitemag.net/play.htm",
					"Video|http://www.insitemag.net/video.htm",
					"Get Involved|http://www.insitemag.net/contributors.htm",
					"About|http://www.insitemag.net/about.htm"
                                    
                    );
                    
//Action
items[1]  = new Array (
					"Everything You Can Do I Can Do Better by Tanya Davison 02-07 | http://www.insitemag.net/070202-013-action-school.htm",
					"What Is The Point In Half Term? By Jack Cooper 02-07 | http://www.insitemag.net/070202-012-action-halfterm.htm",
					"They’re All Celebrities, Get Me Out Of Here by Nick Edmonson 02-07 | http://www.insitemag.net/070202-011-action-celeb.htm",
					"Is It Cool To Be Depressed? By Becky Shewell 02-07 | http://www.insitemag.net/070202-009-action-depression.htm",
					"Killer Dogs On Loose by Paul Rogers 02-07 | http://www.insitemag.net/070202-008-action-dogs.htm",
                    "Why Don’t Folks March Anymore? 02-07 | http://www.insitemag.net/070202-002-action-march.htm",
					"National Rail: What’s the bother? 02-07 | http://www.insitemag.net/070202-002-010-action-railways.htm"
                                   
                    );
//Culture                  
items[2]  = new Array (
					"Lovin' Fairylove by Amy Nicholass 02-02 | http://www.insitemag.net/070205-001-culture-fairies.htm",
					"London Image by Becky Shewell 02-07 | http://www.insitemag.net/070201-010-culture-londonpic.htm",
					"Drumin’ Up Delight by Amy Nicholass 02-07 | http://www.insitemag.net/070201-009-culture-glennie.htm",
					"Starlight Express by Becky Shewell 02-07 | http://www.insitemag.net/070201-008-culture-starexpress.htm",
					"The Best Feel Good Songs Ever! by Becky Shewell 02-07 | http://www.insitemag.net/070201-007-culture-upsongs.htm",
					"Casino Royale Review by Sean Wyer 02-07 | http://www.insitemag.net/070201-006-culture-casino.htm",
					"Stop The Clocks by George Learmond 02-07 | http://www.insitemag.net/070201-005-action-oasis.htm",
					"Kasabian Have Arrived by Paul Rogers 02-07 | http://www.insitemag.net/070201-004-culture-kasabian.htm",
					"He’s Got the Keys to the World by Paul Rogers 02-07 | http://www.insitemag.net/070201-003-culture-ashcroft.htm",
                    "Delightful Dance! by Amy Nicholass 02-07 | http://www.insitemag.net/070201-002-culture-ghosh.htm"
                    );
//News                  
items[3]  = new Array (  
					"Digital Stories To entertain You 08-08 | http://www.insitemag.net/080814-001-news-photostories.htm",
					 
					"Herefordshire Young Farmers' Drama Fest 02-07 | http://www.insitemag.net/070202-007-news-hfyfcdrama.htm",
					"Team Challenge In Kington by Naomi Allaway 02-07 | http://www.insitemag.net/070202-006-news.tchallenge.htm",
					"Ross Rocks! 02-07 | http://www.insitemag.net/070202-005-news-rossrocks.htm",
					"Herefordshire Youth Council Election Week 2007 | http://www.insitemag.net/070202-004-news-youthcouncil.htm",
                    "Get Your Skates On! | http://www.insitemag.net/070202-003-news-skatepark.htm",
					"Young Artist Brightens Up Hospital 02-07 | http://www.insitemag.net/070202-002-news-painting.htm",
					"New InSITE Website Launched 02-07 | http://www.insitemag.net/070202-001-news-newsite.htm",
                    "Auto Redirect|http://dscripts.awardspace.com/scripts.php?type=php&name=auto_redirect"
                    );
//Life
items[4]  = new Array (                    
                    "Digital Stories To entertain You 08-08 | http://www.insitemag.net/080814-001-news-photostories.htm"
                   
                    );
//Play
items[5]  = new Array (                    
                    "Pong 02-07 | http://www.insitemag.net/070202-014-play-pong.htm"
                    );



// 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.top.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