
var timeOut = null, numMenus = 0;
var menus = new Object();
var ns4 = false; // true if the browser supports layers
var ie4 = false; // falsetrue if the browser supports document.all
var otherDOM = false; // true if ns6
var ie5plus = false; // true if browser is IE 5+
var adjustSpacing = false; // true if we need to adjust menu spacing
var activeMenuHeading = -1; // holds number of the active menu (heading)
var lineUpsubMenu = 0; 

 var num1= 0 ;
 var SymRealOnLoad;
var SymRealOnUnload;
 var Rainbow;
   var colourarr =new Array() ; 
  // var colourNum ;

//take main page 
function MM_reloadPage(init) {  //reloads the window if Nav4 resized

  if (init==true) with (navigator) {
	 
	  if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
	
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
//MM_reloadPage(true);
//-->


     function XYpoint(x)
       {
          lineUpsubMenu = x;
             }


    function detectBrowser()
         {
//lineUpsubMenu = 200;
           if (document.layers)
              ns4 = true;
              else if (document.all)
                    {
                        ie4 = true;

                if (navigator.userAgent.indexOf("MSIE 4") != -1)
                       ie5plus = false;
                            else
                      ie5plus = true;
            if (((navigator.userAgent.indexOf("MSIE 5.5") == -1) &&
                 (navigator.userAgent.indexOf("MSIE 6") == -1)) ||
                  (navigator.userAgent.indexOf("Mac") != -1))
                   adjustSpacing = true;
                   }
                   else if (document.getElementById)
                      {
                      otherDOM = true;
                     adjustSpacing = true;
                    }
                }

   function showMenu(which,x,y)
           { // accepts an integer indicating which menu to show and x/y if not ns4
            if (ns4)
                {
              document.layers["menuHeading" + which].bgColor = "darkblue";
              document.layers["menu" + which].visibility = "show";
              document.layers["menu" + which].moveAbove(document.layers["mainContent"]);
                   } else if (ie4)
                      {
                     document.all("menu" + which).style.left = x;
                     document.all("menu" + which).style.top = y+lineUpsubMenu;
                     document.all("menu" + which).style.visibility = "visible";
                       }
                       else if (otherDOM)
                              {
                     document.getElementById("menu" + which).style.left = x;
                     document.getElementById("menu" + which).style.top = y+lineUpsubMenu;
                     document.getElementById("menu" + which).style.visibility = "visible";
                      }
         }

                 function hideMenu(which)
                    { // accepts an integer indicating which menu to hide
                 if (ns4)
                         {
                 document.layers["menuHeading" + which].bgColor = "blue";
                 document.layers["menu" + which].visibility = "hide";
                 document.layers["menu" + which].moveBelow(document.layers["mainContent"]);
                      } else if (ie4)
                           {
                              document.all("menu" + which).style.visibility = "hidden";
                                    }
                                     else if (otherDOM)
                                           {
                                          document.getElementById("menu" + which).style.visibility = "hidden";
                                                 }
                                                    }

    function addItem(menuName, item, action, lin)
           {
             if (!menus[menuName])
                     {
                  var newMenu = new Object();
                      newMenu.name = menuName;	
				      //newnMenu.line = lin ;
                      newMenu.num = numMenus++;
                      newMenu.items = new Array();
                      newMenu.actions = new Array();
					  newMenu.line = new Array() ;  
                      menus[menuName] = newMenu;
                      }
// IE4 doesn't support push() so add manually
                 menus[menuName].items[menus[menuName].items.length] = item;
                 menus[menuName].line[menus[menuName].actions.length] = lin;
				 menus[menuName].actions[menus[menuName].actions.length] = action;
       }
	   
function createMenuHeadings()
{	
if (ns4)
{
document.write('<layer name="background" bgcolor="blue" width="95%" z-index="20" top="0" left="10" height="20"> &nbsp;</layer>');
}
else if (ie4 || otherDOM)
{
document.write('<div class="menuBar">');
}
for (var menu in menus)
{
var theMenu = menus[menu];
if (ns4)
  document.write('<layer name="menuHeading' + theMenu.num + '"onmouseout="timeOut = setTimeout(\'hideMenu(' + theMenu.num + ')\', 500)" width="80" bgcolor="blue" top="10" height="21" left="' + ((theMenu.num * 100) + 10) + '" z-index="20"><a class="menuHeadingNS4" href="javascript:showMenu(' + theMenu.num + ')">' + theMenu.name + '</a></layer>');
else if (ie4 || otherDOM)
	if(theMenu.line == 1)
	document.write('<a  id="menuHeading' + theMenu.num + '" href="' + theMenu.actions[0] + '"  onmouseout="menuHeadingMouseOut(' + theMenu.num + ')" onmouseover="menuHeadingMouseOver(' + theMenu.num + ')" class="menuHeading" >' + theMenu.name + '</a>');	       
		 else
  document.write('<a onclick="menuHeadingMouseClick(event, ' + theMenu.num + '); return false" onmouseout="menuHeadingMouseOut(' + theMenu.num + ')" onmouseover="menuHeadingMouseOver(' + theMenu.num + ')" class="menuHeading" id="menuHeading' + theMenu.num + '">' + theMenu.name + '</a>');
  
if (adjustSpacing)
 document.write('&nbsp; &nbsp; &nbsp;');
}
if (ie4 || otherDOM)
document.write('</div>');
}

function createMenus()
{
createMenuHeadings();
for (var menu in menus)
{
var theMenu = menus[menu];
if (ns4)
 document.write('<layer class="menuNS4" onmouseover="clearTimeout(timeOut)" onmouseout="timeOut = setTimeout(\'hideMenu(' + theMenu.num + ')\',500)" visibility="hide" name="menu' + theMenu.num + '" top="31" left="' + ((theMenu.num * 100) + 10) + '" bgcolor="lightblue" z-index="0" width="100">');
else if (ie4 || otherDOM)
 document.write('<div class="menu" id="menu' + theMenu.num + '" onmouseover="clearTimeout(timeOut)" onmouseout="timeOut = setTimeout(\'menuHeadingDeactivate(); hideMenu(' + theMenu.num + ')\',500)">');
for (var i=0; i<theMenu.items.length; i++)
{
if (ns4)
document.write('<a class="menuItemNS4" href="' + theMenu.actions[i] + '">' + theMenu.items[i] + '</a><br>');
else if (ie4 || otherDOM)
document.write('<a style="width: 160px" class="menuItem" href="' + theMenu.actions[i] + '">' + theMenu.items[i] + '</a>');
if (ie4 && !ie5plus)
document.write('<br>');
}
if (ns4)
document.write('</layer>');
else if (ie4 || otherDOM)
document.write('</div>');
}
}

function menuHeadingMouseOver(menuHeading)
{
if (ie4)
document.all("menuHeading" + menuHeading).style.borderColor="lightblue darkblue darkblue lightblue";
else if (otherDOM)
document.getElementById("menuHeading" + menuHeading).style.borderColor="lightblue darkblue darkblue lightblue";
}

function menuHeadingMouseOut(menuHeading)
{
if (ie4 || otherDOM)
{
if (activeMenuHeading != -1 && activeMenuHeading == menuHeading)
	timeOut = setTimeout('hideMenu(' + activeMenuHeading + '); menuHeadingDeactivate();',500);
else
{
if (ie4)
document.all("menuHeading" + menuHeading).style.borderColor="blue";
else
document.getElementById("menuHeading" + menuHeading).style.borderColor="blue";
}
}
}

function menuHeadingActivate(menuHeading)
{
if (ie4)
{
document.all("menuHeading" + menuHeading).style.background = "lightblue";
document.all("menuHeading" + menuHeading).style.color = "darkblue";
document.all("menuHeading" + menuHeading).style.borderColor = "darkblue blue lightblue darkblue";
}
else if (otherDOM)
{
document.getElementById("menuHeading" + menuHeading).style.background = "lightblue";
document.getElementById("menuHeading" + menuHeading).style.color = "darkblue";
document.getElementById("menuHeading" + menuHeading).style.borderColor = "darkblue blue lightblue darkblue";
}
activeMenuHeading = menuHeading;
}

function menuHeadingDeactivate()
{
if (activeMenuHeading != -1)
{
if (ie4)
{
document.all("menuHeading" + activeMenuHeading).style.borderColor= "blue";
document.all("menuHeading" + activeMenuHeading).style.background = "blue";
document.all("menuHeading" + activeMenuHeading).style.color = "white";
}
else if (otherDOM)
{
document.getElementById("menuHeading" + activeMenuHeading).style.borderColor= "blue";
document.getElementById("menuHeading" + activeMenuHeading).style.background = "blue";
document.getElementById("menuHeading" + activeMenuHeading).style.color = "white";
}
activeMenuHeading = -1;
}
}

function menuHeadingMouseClick(event, which)
{
if (activeMenuHeading != -1)
{
clearTimeout(timeOut);
hideMenu(activeMenuHeading);
menuHeadingDeactivate();
}
if (ie4 || otherDOM)
menuHeadingActivate(which);
if (event.srcElement)
{
x = event.srcElement.offsetLeft;
y = event.srcElement.offsetTop + event.srcElement.offsetHeight;
}
else if (otherDOM)
{
// NS6 specific
x = document.getElementById("menuHeading" + which).offsetLeft;
y = document.getElementById("menuHeading" + which).offsetTop + document.getElementById("menuHeading" + which).offsetHeight;
}
if (adjustSpacing)
{ x += 5; y +=7; }
showMenu(which, x, y);
}


  
function window_onload() 
{
MM_reloadPage(true);
SetupColours() ; 
   window.setInterval("RainbowColor()",300);
}


function RainbowColor() {
   Rainbow = MCol.style;    
  if (num1 >46){num1=0;
 // colourNum=0 ;
  }
 // Rainbow.color = '#'+ String(000099) ;
   Rainbow.color = colourarr[num1];
   num1=num1+1 ; 
  // colourNum =colourNum+10 ; 
}
   
function SetupColours()
{
  
colourarr[0]="#000066" ; 
colourarr[1]="#000080" ; 
colourarr[2]="#000099" ; 
colourarr[3]="#0000cc" ; 
colourarr[4]="#0000ff" ; 
colourarr[5]="#0033ff" ; 
colourarr[6]="#003399" ; 
colourarr[7]="#006600" ; 
colourarr[8]="#006633" ; 
colourarr[9]="#009900" ; 
colourarr[10]="#00cc00" ; 
colourarr[11]="#00ff00" ; 
colourarr[12]="#00ff33" ; 
colourarr[13]="#669933" ; 
colourarr[14]="#800000" ; 
colourarr[15]="#990066" ; 
colourarr[16]="#9900cc" ; 
colourarr[17]="#9900ff" ; 
colourarr[18]="#9933ff" ; 
colourarr[19]="#993399" ; 
colourarr[20]="#cc0000" ; 
colourarr[21]="#ff0000" ; 
colourarr[22]="#ff3300" ; 
colourarr[23]="#ff3333" ; 
colourarr[24]="#ff6600" ; 
colourarr[25]="#ff6633" ; 
colourarr[26]="#ffcc00" ; 
colourarr[27]="#ffcc33" ; 
colourarr[28]="#ffcc66" ; 
colourarr[29]="#ffff00" ; 
colourarr[30]="#ffff33" ; 
colourarr[31]="#00ff00" ; 
colourarr[32]="#00ff33" ; 
colourarr[33]="#99ff00" ; 
colourarr[34]="#cccc66" ; 
colourarr[35]="#cccc33" ; 
colourarr[36]="#cc9966" ; 
colourarr[37]="#cc9933" ; 
colourarr[38]="#cccccc" ; 
colourarr[39]="#bbbbbb" ; 
colourarr[40]="#aaaaaa" ; 
colourarr[41]="#aaa888" ; 
colourarr[42]="#aaa000" ; 
colourarr[43]="#aa0888" ; 
colourarr[44]="#aa0000" ; 
colourarr[45]="#a85555" ; 
colourarr[46]="#a00000" ; 

 
}


function todaydte(){
var dateA = new Date();
var days = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat") ; 
var mons= new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
var dy = dateA.getDay() ; 
var dd = dateA.getDate();
var mm= dateA.getMonth();
var yr= dateA.getYear();
var todate = days[dy] + ", " + dd + " " + mons[mm]; 
todate=todate.bold() ;
document.write(todate) ;
}

function isReady(form) {
    if (isEmail(form.email) == false) {
        alert("Please enter an email address.");
		 form.email.focus();
        return false;
    }
	
	if (isFilled(form.Contact_Name) == false) {        // A full name?
        alert("Please enter your name.");
        form.Contact_Name.focus();
        return false;
    }
	
    return true;
}
function isEmail(elm) {
    var pattern = /^[a-zA-Z0-9\-.]+\@[a-zA-Z0-9 \-\.]+\.([a-zA-Z]{2,3})$/;
    if (pattern.test(elm.value)) {
        return true;
    }
    else {
        return false;
    }
}    

//function isEmail2(elm) {
   // if (elm.value.indexOf("@") != "-1" &&
     //   elm.value.indexOf(".") != "-1") {
      //  return true;
    //}
  //  else {
   //     return false;
   // }
//}

// Check for blank fields
function isFilled(elm) {
    if (elm.value == "" || elm.value == null) {
        return false;
    }
    else {
        return true;
    }
}

function NOLINE(form){
if(form.value == "0"){

 alert("you have selected "+ form.length) ; }
 else
 { alert("test") ; }

}
// error

function WindowRealonLond()
{
SymRealOnLoad = window.onload;
window.onload = SymOnLoad;
}


function SymOnUnload()
{
  window.open = SymWinOpen;
  if(SymRealOnUnload != null)
     SymRealOnUnload();
}

function SymOnLoad()
{
  if(SymRealOnLoad != null)
     SymRealOnLoad();
  window.open = SymRealWinOpen;
  SymRealOnUnload = window.onunload;
  window.onunload = SymOnUnload;
}