//______ADD A MENU ITEM_______________________________
//Add a new link to the menu here by adding a new line of the form 	['filename.file ext','css class name','display name'],
//Insert it where you would like to see it displayed.
var menu_item = new Array();
menu_item= [
      ['index.html','link0', 'HOME', ''],
      
      ['', 'submenu0', 'OPTIMIZED BUILDING SOLUTIONS', ''],
			['aboutus.html','link1','About Us', ''],
			['concerns.html','link1','Client Concerns', ''],	
			['people.html','link1','Our People', ''],
			['expertise.html','link1','Our Expertise', ''],
      ['', 'submenu1', 'Resources', ''],
			['leeding.html','','LEEDing the Way to Tomorrow - Today', ''],
			['tips.html','','Tips from the Fan Man', ''],
			['dearth.pdf','','A Dearth of Fresh Air', 'subwindow'],

      ['', 'submenu0', 'OPTIMIZED BUSINESS SOLUTIONS', ''],
			['busaboutus.html','link1','About Us', ''],
			['busconcerns.html','link1','Client Concerns', ''],
			['buspeople.html','link1','Our People', ''],
			['busexpertise.html','link1','Our Expertise', ''],
      ['', 'submenu1', 'In the News', ''],


      ['contactus.html','link0', 'CONTACT US', '']
      
			];

//______ADD A WHATS NEW ITEM_______________________________
var new_item = new Array();

new_item=	[
			['image-files/partnerAds.gif','60','120', 'link-list2','','Check out Great Deals !!','Partner Ads']
			];

      
function toggle(obj) {
	var menu = document.getElementById(obj);
	if (menu.style.display == 'none'){
		menu.style.display = 'block';
	} else {
		menu.style.display = 'none';
	}
  if (obj.charAt(4) == '0' )
  {
    var i=0;
    do {
      if (obj != main_menu_list[i])
      {
	      menu = document.getElementById(main_menu_list[i]);
        menu.style.display = 'none';
      }      
    } while (++i < main_menu_list.length)
  }
}



function get_cookie(Name) {
  var search = Name + "=";
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search);
    // if cookie exists
    if (offset != -1) { 
      offset += search.length;
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1) end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end));
      }
   }
  return returnvalue;
}

function checkit()
{
  var i=0;
  var m_num = 1;
  var s_num = 1;
  do {
   if (menu_item[i][1] == 'submenu0')
   {
     menustring = 'menu0_' + m_num;
     m_num++;
	   menu = document.getElementById(menustring);
	   if (menu.style.display == 'block'){
       openones = openones + " " + menustring;
     }
   }
   else if  (menu_item[i][1] == 'submenu1')
   {
     menustring = 'menu1_' + s_num;
     s_num++;
	   menu = document.getElementById(menustring);
	   if (menu.style.display == 'block'){
       openones = openones + " " + menustring;
     }
   }
  } while (++i < menu_item.length);
  document.cookie='NCG'+"="+openones;
}



var start_printer_hide = '<div class="printer-hide">';//This prevents the menu from being shown during printing
var end_printer_hide= '</div>';
var menu_header = '<div class="nav-header">Menu</div>';
var start_menu = '<div id="menu">';
var end_menu= '</div>';

var whats_new_header= '<div class="nav-header">Partners</div>';

function mailpage()
{
		mail_str = "mailto:?subject=Check out the " + document.title;
		mail_str += "&body=I thought you might be interested in " + document.title;
		mail_str += ". You can view it at, " + location.href; 
		location.href = mail_str;
}

function addBookmark() 
{ 
			var msg = "Don't forget to bookmark us!";
			if(navigator.appName == "Netscape") {
			msg += "  (CTRL-D)";
			alert(msg);
			}

			if( window.sidebar && window.sidebar.addPanel ) {
					window.sidebar.addPanel( this.title, this.href, '' );
			} else if( window.external && ( navigator.platform == 'Win32' ||
				  ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) ) {
					window.external.AddFavorite( location.href, document.title );
			} else if( window.opera && window.print ) {
				return true;
			} else if( document.layers ) {
				window.alert( 'Please click OK then press Ctrl+D to create a bookmark' );
			} else {
				window.alert( 'Please use your browser\'s bookmarking facility to create a bookmark' );
			}
			return false;
}

var main_menu_list= new Array();

function write_menu(page_location)
{
  var content = start_printer_hide ;
  var i=0;
  var snum = 1;
  var mnum=1;
  var j = 0;
  var mnum_open = false;
  content += '<div id="masterdiv" >';
  content += '<table summary="" width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td>';

do{
    if (page_location == menu_item[i][0])
      arrow_filename = 'orange_arrow_small.gif';
    else
      arrow_filename = "white_arrow_small.gif";
  if (menu_item[i][1] == 'submenu0')
  {
    main_menu_list[j] = 'menu0_' + mnum;
    j++;
    content += '<div class="submenu0" onmouseover="this.className=\'submenu0over\'" onmouseout="this.className=\'submenu0\'" onclick="toggle(\'menu0_'+mnum+'\')"><div style="padding:8px 5px 8px 14px">'+menu_item[i][2]+'</div></div><span style="display: none;"  id="menu0_' + mnum + '">';  
      mnum_open = true;
    }
  else if (menu_item[i][1] == 'link0')
  {
    content += '<div style="position:relative;margin:0px; padding:0px"><img src="image-files/'+arrow_filename+'" style="position:absolute; left:-7px; top:4px; float:left;"><a href="'+menu_item[i][0]+'" ';
    if (menu_item[i][3] != '')
    {
      content += 'target="' + menu_item[i][3] + '" ';
    }
  content += '><div class="link0" onmouseover="this.className=\'link0over\'" onmouseout="this.className=\'link0\'"><div style="padding:8px 5px 8px 14px">'+menu_item[i][2]+'</div></div></a></div>';
  }
  else if (menu_item[i][1] == 'link1')
  {
    content += ' <div style="position:relative;margin:0px; padding:0px"><img src="image-files/'+arrow_filename+'" style="position:absolute; left:-7px; top:1px; float:left;"><a href="'+menu_item[i][0]+'"';
    if (menu_item[i][3] != '')
    {
      content += 'target="' + menu_item[i][3] + '" ';
    }
    content +='><div class="link1" onmouseover="this.className=\'link1over\'"  onmouseout="this.className=\'link1\'"><img src="image-files/pixel_trans.gif" width="10" height="1" alt="">' + menu_item[i][2] + '</div></a></div>';  } 
  else if (menu_item[i][1] == 'submenu1')
  {
    content += '<div style="position:relative;margin:0px; padding:0px"><div class="submenu1" onclick="toggle(\'menu1_'+snum+'\');"  onmouseover="this.className=\'submenu1over\'"  onmouseout="this.className=\'submenu1\'" ><img src="image-files/pixel_trans.gif" width="10" height="1" alt="">'+menu_item[i][2]+'&nbsp&nbsp;<img src="image-files/down_arrow.gif" alt="" align="middle" ></div></div>';
        content += '   	<span class="submenu" id="menu1_'+snum+'" style="display:none;">';
    snum++;  
  }
  else
  {
    content += '<a href="'+ menu_item[i][0] +'" ';
    if (menu_item[i][3] != '')
    {
      content += 'target="' + menu_item[i][3] + '" ';
    }
    
    content += '>'+menu_item[i][2]+'</a><br><img src="image-files/pixel_trans.gif" height="10" alt=""><br>';
    if ((i == (menu_item.length-1)) || (menu_item[i+1][1] != '')) 
    {
      
      content += '  	<br></span>';
    }
  }
    if (mnum_open == true)
  {
    if ((i == (menu_item.length-1)) || (menu_item[i+1][1] == 'submenu0') || (menu_item[i+1][1] == 'link0'))
    {
      content += '  </span></div>';
      mnum++;
      mnum_open = false;
    }
    
  }

}while (++i < menu_item.length);

//content += '   </div></td></tr>';
  content += '</td></tr></table></div>';
//  content += '</div>';
  //loop and add new items
  content += end_printer_hide;
  document.write( content ) ;
}


function write_partners()
{
  var content = start_printer_hide ;
  var i=0;
  do{
        content +='<div class="left-partner" >';  
  			content+='<a target="blank"  class="';
  			content+=new_item[i][3];//add css class
  			content+='" href="';
  			content+=new_item[i][4];//add file name
  			content+='">';
  			content+='<img style="border:1px solid #cccccc; padding:0px; margin:0px;" hspace="0" vspace="0" src="';
  			content+=new_item[i][0];//add image
  			content+='" height="';
  			content+=new_item[i][1];//add image height
  			content+='" width="';
  			content+=new_item[i][2];//add image width
  			content+='"><br>';
  			content+=new_item[i][5];//add display name (title of page)
  			content+='</a><br>';
  			content+=new_item[i][6];//add excerpt
  			content+=' ...<a target="blank" href="';
  			content+=new_item[i][4];//add file name
  			content+='"><i>more</i></a></div>';
  }while (++i < new_item.length);
  
  
  content += end_menu;
  content += '<br><br>' + end_printer_hide;
  document.write( content ) ;
}

function write_console()
{
  var content = start_printer_hide ;

    content += '<div id="console"><div style="border:1px solid #dddddd; padding: 3px 5px 5px 5px;">';
    content += '<a href="" class="tool" onclick="window.print();"><img src="image-files/print.gif" height=16 width=16 alt="Printer Friendly Version">&nbsp&nbsp;Print Page</a></br>';
    content += '<a href="javascript:mailpage();" class="tool"><img height=16 width=16 src="image-files/mail.gif" alt="Tell A Friend">&nbsp&nbsp;Tell A Friend</a></br>';
    content += '<a href="index.html" class="tool" title="www.ncg.com" rel="sidebar" onclick="addBookmark();"><img height=16 width=16 src="image-files/favs.gif" alt="Add to Favorites">&nbsp&nbsp;Add to Favorites</a>';
    content += '</div></div>';		
  
  
  content += '<br>' + end_printer_hide;
  document.write( content ) ;
}

