var SubMenuTop = 25;
var menuTextTop = 0;
var mainMenuHeight = 16;
var mainMenuTop= 0;
var backGroundColor = "#0071A6";
var oldTop = 0;


var counter= 0;
var a=0;
var b=1;
var ob=0;
var goToNews =0;

var colors=new Array(                     
                   "FFFFFF", "FFFFFF", "FFFFFF", "FFFFFF",
                   "FFFFFF", "FFFFFF", "F6F6F6", "EEEEEE",
                   "E6E6E6", "DEDEDE", "D6D6D6", "CECECE",
                   "C6C6C6", "BEBEBE", "B6B6B6", "AEAEAE",
                   "A6A6A6", "9E9E9E", "969696", "8E8E8E",          
                   "868686", "7E7E7E", "767676", "6E6E6E",
                   "666666", "5E5E5E", "565656", "4E4E4E",
                   "464646", "3E3E3E", "363636", "2E2E2E",
                   "262626", "1E1E1E", "161616", "0E0E0E",
                   "060606", "000000"
                    );

/** maximum letters with spaces are 37 please dont write more than it **/ 
var obj= new Array("لن تغيب عن قلوبنا يا زايد الخير");

var txt;

function menu(){

txt = '<table style="position: absolute; z-index: 1; top:' + mainMenuTop + '; border-style: ridge; border-width: thin; border-color: #C6DFFF" bgcolor=' + backGroundColor + ' width="100%" >' +
         '<tr>' + 
           '<td valign="top" width="558" height=' + mainMenuHeight + '>' +
             '<table style="font-size:13; font-WEIGHT:BOLD" >' + 
               '<tr align=center>' + 
                 '<td id = k1 width = "40" style="left: 2%;  position: absolute" onmouseover="overlightM(this); show(subMenu1)" onmouseout="outdarkM(this); showAndHide(k1, subMenu1, -300)" > <a href = body.html style="color: #FFFFFF; text-decoration: none" > Main </a> </td>' + 

                 '<td id = k2 width = "55" style="left: 12%; position: absolute" onmouseover="overlightM(this); show(subMenu2)" onmouseout="outdarkM(this); showAndHide(k2, subMenu2, -300)" style="color: #FFFFFF; text-decoration: none"> Services </td>' +

                 '<td id = k3 width = "90" style="left: 23%; position: absolute" onmouseover="overlightM(this); show(subMenu3)" onmouseout="outdarkM(this); showAndHide(k3, subMenu3, -300)" style="color: #FFFFFF; text-decoration: none"> Contact </td>' +

                 '<td id = k4 width = "45" style="left: 38%; position: absolute" onmouseover="overlightM(this); show(subMenu4)" onmouseout="outdarkM(this); showAndHide(k4, subMenu4, -300)" style="color: #FFFFFF; text-decoration: none"> About</td>' +
                 
                 //'<td id = k5 width = "45" style="left: 48%; top: 0; position: absolute" onmouseover="overlightM(this); show(subMenu5)" onmouseout="outdarkM(this); showAndHide(k5, subMenu4, -300)" style="color: #FFFFFF; text-decoration: none"><a href = faq.html style="color: #FFFFFF; text-decoration: none"><font face="arial" size="3"> عربي</a></td>' +

               '</tr>' +
             '</table>' +
           '</td>' +
         '</tr>' +

       '<td height="1">' +
         '<font face="Andalus" size="2">' +

         '<table id= subMenu1 cellspacing= 0 height = 70 width= 40 style="left: 2%; top: -300; position: absolute; border-collapse: collapse" onmouseout= "hide(this, -300)"> <tr bgcolor="#FFFFff"> ' +
         '</table>' +

         '<table id= subMenu2 cellspacing= 0 height = 70 width= 55 style="left: 12%; top: -300; border-collapse: collapse; position: absolute; z-index: -1" onmouseout= "hide(this, -300)" > <tr bgcolor="#FFFFff"> ' +
           '<a style="color:#000000; text-decoration: none" onmouseover=outdarkSub(this) onmouseout=overlightSub(this) href = facilities.html ><center>Facilities</a><br>' +
           '<a style="color:#000000; text-decoration: none" onmouseover=outdarkSub(this) onmouseout=overlightSub(this) href = export.html >Export</a><br>' +
           '<a style="color:#000000; text-decoration: none" onmouseover=outdarkSub(this) onmouseout=overlightSub(this) href = reexport.html >Re-export</a><br>' +
           '<a style="color:#000000; text-decoration: none" onmouseover=outdarkSub(this) onmouseout=overlightSub(this) href = import.html >Import</a><br>' +
           '<a style=" position: none; color:#000000; text-decoration: none" onmouseover=outdarkSub(this) onmouseout=overlightSub(this) href = transit.html >Transit</a>' +
         '</tr>' +

       '</table>' +

       '<table id= subMenu3 cellspacing= 0 height = 35 width= 90 style="left: 23%; top: -300; position: absolute; border-collapse: collapse" onmouseout= "hide(this, -300)"> <tr bgcolor="#FFFFff"> ' +
           '<a style="color:#000000; text-decoration: none" onmouseover=outdarkSub(this) onmouseout=overlightSub(this) href = map.html ><center>Fujairah Map</a><br>' +
           '<a style="color:#000000; text-decoration: none" onmouseover=outdarkSub(this) onmouseout=overlightSub(this) href = customsaddress.html >Our numbers</a><br>' +
           '<a style="color:#000000; text-decoration: none" onmouseover=outdarkSub(this) onmouseout=overlightSub(this) href = clearingagents.html >Clearing Agents</a><br>' +
         '</tr>' +
       '</table>' +

     '<table id= subMenu4 cellspacing= 0 height = 45 width= 40 style="left: 38%; top: -300; position:absolute; border-collapse: collapse" onmouseout= "hide(this, -300)"> <tr bgcolor="#FFFFff"> ' +
           '<a style="color:#000000; text-decoration: none" onmouseover=outdarkSub(this) onmouseout=overlightSub(this) href = uae.html ><center>UAE</a><br>' +
           '<a style="color:#000000; text-decoration: none" onmouseover=outdarkSub(this) onmouseout=overlightSub(this) href = fuj.html >Fujairah</a><br>' +
          
     '</table>' +
     
     //'<table id= subMenu5 cellspacing= 0 height = 70 width= 40 style="left: 48%; top: -300; position: absolute; border-collapse: collapse" onmouseout= "hide(this, -300)"> <tr bgcolor="#FFFFff"> ' +
     //'</table>' +

     '</font>' +  
 '</table>';
comment.innerHTML= txt;  
}

function moveMenu(){
    
   y = getPageScrollY(); // get new top for menu and news
   
   mainMenuTop = y; // put new top for menu
   menuTextTop = y; // put new top for news
 
   menu(); // reprint the menu after scrolling
 
}

function getPageScrollY() {

  //if (isMinNS4)
    //return(window.pageYOffset);
 // if (isMinIE4)
    return(document.body.scrollTop);
  return(-1);
}

function seeNews(){
  goToNews = 1;
}

function strobeEffect(){

  if(goToNews == 0){
    color=colors[a];
   
    aah='<a style="TOP: ' + menuTextTop + '; position: absolute; z-index: 1; VISIBILITY: visible; left:50%" href=news' + ob + '.html target=main onFocus=seeNews()><font face="rod" size= 2 color = #' + color + '>';
    aab='</font></a></td>';
      
    mid=obj[ob];
    aa=aah+mid+aab;
     
    comment0.innerHTML= aa;
    a+=b; 

    if (a == 37)
    {
      b-=2;
      ob+=1;
    }
 
    if (ob > obj.length - 1)
      ob=0

    if (a==0) b+=2;
  }
      
  
  xx=setTimeout("strobeEffect()",120); 
  goToNews = 0;
}

function show(c)
{
  c.style.top = SubMenuTop;
}

 function showAndHide(cellId, c, k)
 {
   var x = event.offsetX
   var y = event.offsetY

    if ( y < 0 || x < 0 || x > cellId.width)
      c.style.top = k;  
 }
  
 function hide(c, k) 
 {
   var x = event.offsetX
   var y = event.offsetY

   if ( x < 0 || x >= c.width || y >= c.height)
     c.style.top = k;
 }
  
function makeMenu()
{
  strobeEffect() // show the news
  menu(); //comment.innerHTML= txt;  // show the menu
}

function overlightM(i)
{
  i.style.backgroundColor="#137EB1"
 // i.style.color="red";
}
   
function outdarkM(i)
{
  i.style.backgroundColor="#0071a6"
 // i.style.color="WHITE";
}

function overlightSub(i)
{
  i.style.backgroundColor="#FFFFff"
  i.style.color="black";
}
   
function outdarkSub(i)
{
  i.style.backgroundColor="#6699FF"
  i.style.color="white";
}


function pageScroll() {
   window.scrollBy(0,55); // horizontal and vertical scroll increments
}
