var currentNum = 0;
var visibleDiv = 0;
var subMenuOn = 0;

var pathName = '';

//---------------------------------------------------------------------------------------------
function getHeader(pageVal)
{
  if (pageVal == 1) pathName = '../';
  else if ( pageVal == 2 ) pathName = '../../';
  
  var str = '';
  str += '<table id="headerTable" cellspacing="0" cellpadding="0">';
  str += '<tr>';
  str += '<td id="logoTD">';
  str += '<img src="' + pathName + 'images/algoLogicLogo.gif" onclick="home(' + pageVal + ')" />';
  str += '</td>';
  str += '<td id="subtitleTD" width="518">';
  str += '<div id="subtitle">Algorithms in Logic</div>';
  str += '</td>';
  str += '<td id="searchTD" width="318" height="100">&nbsp;';
  /*
  str += '<input type="button" value="Account" /><br>';
  str += '<input type="text" size="20" /> ';
  str += '<input type="button" value="&nbsp;Search&nbsp;" />';
  */
  str += '</td>';
  str += '</tr>';
  str += '<tr>';
  str += '<td colspan="3" id="navBarTD">';
  str += '<table id="navBar">';
  str += '<tr>';
  str += '<td class="navTD" id="navHome" onclick="home(' + pageVal + ')">Home</td>';

// onmouseOver="over(1)" onmouseOut="outDrop(1)"

  str += '<td class="navTD" id="navSolutions" onmouseOver="over(3)" onmouseOut="outDrop(3)">Solutions</td>';	  
  str += '<td class="navTD" id="navProducts" onmouseOver="over(4)" onmouseOut="outDrop(4)">Products</td>';
  //str += '<td class="navTD" id="navServices" onmouseOver="over(5)" onmouseOut="outDrop(5)">Services</td>';
  str += '<td class="navTD" id="navAbout" onmouseOver="over(2)" onmouseOut="outDrop(2)">About</td>';	
  str += '</tr>';
  str += '</table>';
  str += '</td>';
  str += '</tr>';
  str += '</table>';
  document.getElementById('headerDiv').innerHTML = str;
  str = '';
  // var linkPath = '';
  
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  // 	 	HOME TAB
/*
  str += '<div id="dropHome" class="dropBox" onmouseOver="over(1)" onmouseOut="outDrop(1)">';
  str += '<table class="dropTable">';
  str += '<tr><td class="selection"><a href="'+ pathName + 'index.php">Welcome</a></td></tr>';
  str += '<tr><td class="selection"><a href="'+ pathName + 'templatePage.php">Who We Are</a></td></tr>';
  str += '<tr><td class="selection"><a href="'+ pathName + 'about/whatWeDo.php">What We Do</a></td></tr>';		
  str += '</table>';
  str += '</div>';
*/
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  // 		SOLUTIONS TAB
  str += '<div id="dropSolutions" class="dropBox" onmouseOver="over(3)" onmouseOut="outDrop(3)">';
  str += '<table class="dropTable">';
  
  // linkPath = new String( pathName + 'solutions/finance.php');
  // alert( "link: " + linkPath );
  str += '<tr><td class="selectionClickable" onclick="getLink(21)">';
  str += '<a href="'+ pathName + 'solutions/finance.php">Accelerated Finance</a></td></tr>';
  str += '<tr><td class="selectionClickable" onclick="getLink(22)">';
  str += '<a href="'+ pathName + 'solutions/datacenter.php">Packet Processing</a></td></tr>';
  str += '<tr><td class="selectionClickable" onclick="getLink(23)">';
  str += '<a href="'+ pathName + 'solutions/skg.php">Embedded Hardware</a></td></tr>';
  str += '</table>';
  str += '</div>';	

  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  //		PRODUCTS TAB
  str += '<div id="dropProducts" class="dropBox" onmouseOver="over(4)" onmouseOut="outDrop(4)">';
  str += '<table class="dropTable">';
  str += '<tr><td class="selection" onmouseOver="over(41)">';
  str += 'Supported Platforms</td></tr>';
  str += '<tr><td class="selection" onmouseOver="over(42)">';
  str += 'Accelerated Finance IP</td></tr>';
  str += '<tr><td class="selection" onmouseOver="over(43)">';
  str += 'Packet Processing IP</td></tr>';
  str += '<tr><td class="selectionClickable" onclick="getLink(34)">';
  str += '<a href="'+ pathName +'products/embedded/skg.php">Embedded SKG</a></td></tr>';	
  str += '</table>';
  str += '</div>';

  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  //		ABOUT TAB
  str += '<div id="dropAbout" class="dropBox" onmouseOver="over(2)" onmouseOut="outDrop(2)">';
  str += '<table class="dropTable">';
  str += '<tr><td class="selectionClickable" onclick="getLink(41)">';
  str += '<a href="'+ pathName + 'about/whoWeAre.php">Who We Are</a></td></tr>';
  str += '<tr><td class="selectionClickable" onclick="getLink(42)">';
  str += '<a href="'+ pathName + 'about/whatWeDo.php">What We Do</a></td></tr>';
  /*
  str += '<tr><td class="selectionClickable" onclick="getLink(43)">';
  str += '<a href="'+ pathName + 'about/partners.php">Partners</a></td></tr>';
  */
  str += '<tr><td class="selectionClickable" onclick="getLink(44)">';
  str += '<a href="'+ pathName + 'about/careers.php">Careers</a></td></tr>';
  str += '<tr><td class="selectionClickable" onclick="getLink(45)">';
  str += '<a href="'+ pathName + 'about/contact.php">Contact Us</a></td></tr>';  
  str += '</table>';
  str += '</div>';
  
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  // 		SUBTABLES
  str += '<div id="dropPlatforms" class="dropBox" onmouseOver="over(41)" onmouseOut="outDrop(41)">';
  str += '<table class="dropTable">';
  str += '<tr><td class="selection" onclick="getLink(311)">';
  str += '<a href="'+ pathName +'products/platforms/netASAPdc.php">NetASAPdc</a></td></tr>';
  str += '<tr><td class="selection" onclick="getLink(312)">';
  str += '<a href="'+ pathName +'products/platforms/netFPGA10g.php">NetFPGA 10G</a></td></tr>';
  str += '</table>';
  str += '</div>';

  str += '<div id="dropFinanceIP" class="dropBox" onmouseOver="over(42)" onmouseOut="outDrop(42)">';
  str += '<table class="dropTable">';
  str += '<tr><td class="selection" onclick="getLink(321)">';
  str += '<a href="'+ pathName +'products/financeIP/ouch.php">OUCH</a></td></tr>';
  str += '<tr><td class="selection" onclick="getLink(322)">';
  str += '<a href="'+ pathName +'products/financeIP/xprs.php">XPRS</a></td></tr>';
  str += '<tr><td class="selection" onclick="getLink(323)">';
  str += '<a href="'+ pathName +'products/financeIP/arca.php">ArcaDirect</a></td></tr>';
  str += '<tr><td class="selection" onclick="getLink(324)">';
  str += '<a href="'+ pathName +'products/financeIP/fix.php">FIX</a></td></tr>';  
  str += '</table>';
  str += '</div>';

  str += '<div id="dropSearchIP" class="dropBox" onmouseOver="over(43)" onmouseOut="outDrop(43)">';
  str += '<table class="dropTable">';
  str += '<tr><td class="selection" onclick="getLink(331)">';
  str += '<a href="'+ pathName +'products/searchIP/tse-1.php">TSE-1</a></td></tr>';
  str += '<tr><td class="selection" onclick="getLink(332)">';
  str += '<a href="'+ pathName +'products/searchIP/tse-2.php">EMSE-2</a></td></tr>';
  str += '<tr><td class="selection" onclick="getLink(333)">';
  str += '<a href="'+ pathName +'products/searchIP/netASAP.php">NetASAP Datapath</a></td></tr>';
  str += '</table>';
  str += '</div>';

  
  document.getElementById('dropMenuDiv').innerHTML=str;
}

//---------------------------------------------------------------------------------------------------------------
function getFooter(pageVal)
{

  var imageStr = 'images';
  if (pageVal == 1 ) imageStr = '../images';
  else if (pageVal == 2 ) imageStr = '../../images';

  var str = '';
  str += '<table id="footerTable" border="0">';
  str += '<tr bgcolor="darkred">';
  str += '<td class="footerTD"><a href="' + pathName + 'about/contact.php">Feedback</a></td>';
  //str += '<td class="footerTD"><a href="">Privacy Policy</a></td>';
  //str += '<td class="footerTD"><a href="">Terms of Use</a></td>';
  str += '<td class="footerTD"><a href="' + pathName +'about/careers.php">Careers</a></td>';
  str += '<td id="socialTD"">';
  str += '<a href="http://www.facebook.com/pages/Algo-Logic/210996302626"><img src="';
  str += imageStr + '/f_logo.gif" height="30" /></a>';
  str += '&nbsp;';
  str += '<a href="http://www.linkedin.com/company/algo-logic-systems"><img src="';
  str += imageStr + '/LinkedIn_Logo30px.png" height="30"/></a></td>';
  str += '</tr>';
  str += '<tr>';
  str += '<td class="footerTD" id="copyTD" colspan="3" style="color:darkred">Copyright &copy; 2011 Algo-Logic  All Rights Reserved</td>';
  str += '</tr>';
  str += '</table>';
  document.getElementById('footerDiv').innerHTML = str;
}

function home( pageVal )
{
  if ( pageVal == 1 )
    location.href = '../index.php';

  else if ( pageVal == 2 )
    location.href = '../../index.php';
	
  else if ( pageVal == 0 ) return;
}

//------------------------------------------------------------------------------
function getLink(pageNum)
{
  switch(pageNum)
  {
    case 21:
	  location.href= pathName  + 'solutions/finance.php';
	  break;
	  
	case 22:
	  location.href= pathName  + 'solutions/datacenter.php';
	  break;

    case 23:
	  location.href= pathName  + 'solutions/skg.php';
	  break;	
 	
	case 311:
	  location.href = pathName + 'products/platforms/netASAPdc.php';
	  break;	
	case 312:
	  location.href = pathName + 'products/platforms/netFPGA10g.php';	
	  break;	
	case 321:
	  location.href = pathName + 'products/financeIP/ouch.php';	
	  break;	
    case 322:
	  location.href = pathName + 'products/financeIP/xprs.php';	
	  break;	
	case 323:
	  location.href = pathName + 'products/financeIP/arca.php';	
	  break;	
	case 324:
	  location.href = pathName + 'products/financeIP/fix.php';	
	  break;	
	case 331:
	  location.href = pathName + 'products/searchIP/tse-1.php';	
	  break;
    case 332:
	  location.href = pathName + 'products/searchIP/tse-2.php';	
	  break;
    case 333:
	  location.href = pathName + 'products/searchIP/netASAP.php';	
	  break;
	case 34:
      location.href = pathName + 'products/embedded/skg.php';	
	  break;
    case 41:
	  location.href = pathName + 'about/whoWeAre.php';	
	  break;
    case 42:
	  location.href = pathName + 'about/whatWeDo.php';	
	  break;
    case 43:
	  location.href = pathName + 'about/partners.php';	
	  break;
    case 44:
	  location.href = pathName + 'about/careers.php';	
	  break;
    case 45:
	  location.href = pathName + 'about/contact.php';	
      break;
	default: 
	  location.href = pathName + 'index.php';
      break;
  }
}

//------------------------------------------------------------------------------
function over(num)
{
  //checkCurrentNum(num);
  // alert( "over " + num );
  currentNum = num;
  //if ( visibleDiv > 0 ) checkCurrentNum(num);
  var str = getTagId(num);
  // alert( "str: " + str );
  
  /*
  if ( subMenuOn > 0 && num < 10 )
  {
    outdrop(subMenuOn + 10 );
	//submenuOn = 0;
  }
  */
  
  if ( num < 10 )
  {
    document.getElementById("nav" + str).style.background = 'white';
    document.getElementById("nav" + str).style.border = 'solid 1px darkred';
    document.getElementById("nav" + str).style.color='black';
  }

  else 
  {
    var mainDiv = Math.floor(num/10);
    // alert( "mainDiv: " + mainDiv );
    over(  mainDiv );
    // alert( "else fin ");
  }
  document.getElementById("drop" + str).style.visibility= 'visible';

  visibleDiv = num;
}
	
//------------------------------------------------------------------------------	  
function outDrop(num)
{
  //alert( "out Drop" );
  var str = getTagId(num);
  //alert( "str: " + str );
  document.getElementById("drop" + str).style.visibility = 'hidden';

  if ( num < 10 )
  {
    // document.getElementById("nav" + str ).style.backgroundImage = 'url(../images/navBarBackgroundRounded.jpg)';
    document.getElementById("nav" + str ).style.background='darkred';
    document.getElementById("nav" + str).style.color='white';
	
    getBorder(str); 
    //outNav(num);
	
    if (num == 4)
    {
      var i;
      for (i=1; i < 4; i++)
	  {        str = getTagId((num*10)+i);
        document.getElementById("drop" + str).style.visibility = 'hidden';
      }
    }
  }
  else
  {
    var mainDiv = Math.floor(num/10);
    //alert( "mainDiv: " + mainDiv );
    outDrop(  mainDiv );
    // alert( "else fin ");
  }
}

function blank() { return; }
	  
//------------------------------------------------------------------------------
function getTagId(num)
{
  //alert( "getTagId: " + num );
  var str = '';
  // var val = Math.parseInt(num);
  switch(num)
  {
    case 1:      str = "Home";
      break;    case 2:
      str = "About";
      break;
    case 3:
      str = "Solutions";      break;
    case 4:
      str = "Products";      break;    case 5:
      str = "Services";
      break;
    case 41:
      str = "Platforms";
      break;
    case 42:
      str = "FinanceIP";
      break;
    case 43:
      str = "SearchIP";
      break;

  }
  return str;
}
	  
//------------------------------------------------------------------------------	  
function getBorder(str)
{
  document.getElementById("nav" + str).style.border = 'none';
  if (str == "Home" )
    document.getElementById("nav" + str).style.borderRight = '1px solid white';
  else if ( str == 'Services' )
    document.getElementById("nav" + str).style.borderLeft = '1px solid white'; 
  else
  {
    document.getElementById("nav" + str).style.borderRight = '1px solid white';
    document.getElementById("nav" + str).style.borderLeft = '1px solid white';
  }
}

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// 		REMOVED


  /*
  str += '<div id="dropServices" class="dropBox" onmouseOver="over(5)" onmouseOut="outDrop(5)">';
  str += '<table class="dropTable">';
  str += '<tr><td class="selection"><div class="innerTD"><a href="'+ pathName +'templatePage.php">Past Projects</a></div></td></tr>';
  str += '<tr><td class="selection" onmouseOver="over(10)" onmouseOut="outDrop(10)">';
    str += '<div class="innerTD"><a href="'+ pathName +'templatePage.php">IP Catalog</a></div></td></tr>';
  str += '<tr><td class="selection"><div class="innerTD"><a href="'+ pathName +'templatePage.php">IP Integration</a></div></td></tr>'
  str += '<tr><td class="selection"><div class="innerTD"><a href="'+ pathName +'templatePage.php">Custom IP Development</a></div></td></tr>';
  str += '<tr><td class="selection"><div class="innerTD"><a href="'+ pathName +'templatePage.php">Supported Platforms</a></div></td></tr>';
  str += '</table>'; 
  str += '</div>';
  */

