// dropdown.js

var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;		
var isMac = (navigator.appVersion.indexOf("Macintosh") != -1) ? true : false;

if (!isMac || (!isIE))
{
   
// convert all characters to lowercase to simplify testing 
    var agt=navigator.userAgent.toLowerCase(); 

    // *** BROWSER VERSION *** 
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5. 
    var is_major = parseInt(navigator.appVersion); 
    var is_minor = parseFloat(navigator.appVersion); 

    // Note: Opera and WebTV spoof Navigator.  We do strict client detection. 
    // If you want to allow spoofing, take out the tests for opera and webtv. 
    var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) 
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) 
                && (agt.indexOf('webtv')==-1)); 
    var is_nav2 = (is_nav && (is_major == 2)); 
    var is_nav3 = (is_nav && (is_major == 3)); 
    var is_nav4 = (is_nav && (is_major == 4)); 
    var is_nav4up = (is_nav && (is_major >= 4)); 
    var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) || 
                          (agt.indexOf("; nav") != -1)) ); 
    var is_nav5 = (is_nav && (is_major == 5)); 
    var is_nav5up = (is_nav && (is_major >= 5)); 

    var is_ie   = (agt.indexOf("msie") != -1); 
    var is_ie3  = (is_ie && (is_major < 4)); 
    var is_ie4  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) ); 
    var is_ie4up  = (is_ie  && (is_major >= 4)); 
    var is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) ); 
    var is_ie5up  = (is_ie  && !is_ie3 && !is_ie4); 

    // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser 
    // or if this is the first browser window opened.  Thus the 
    // variables is_aol, is_aol3, and is_aol4 aren't 100% reliable. 
    var is_aol   = (agt.indexOf("aol") != -1); 
    var is_aol3  = (is_aol && is_ie3); 
    var is_aol4  = (is_aol && is_ie4); 

    var is_opera = (agt.indexOf("opera") != -1); 
    var is_webtv = (agt.indexOf("webtv") != -1);

// var bg_color = "330066";		//background color for tables
var chng_color = "999999";		//colour the cell changes to

var wasak = new Array();
for (j=1;j<6;j++){			//remember to change the number to how many menus there are (eg 5 menus = j=0;j<5;j++)
	wasak[j] = new Array()}

//menu 1

// wasak[0][0]=""

//menu 2

wasak[1][0]="FF9900#NCADC&nbsp;profile+http://www.ncadc.org.uk/about/profile.htm"
wasak[1][1]="FF9900#Winning&nbsp;campaigns+http://www.ncadc.org.uk/campaigns/winning.htm"
wasak[1][2]="FF9900#Annual&nbsp;reports+http://www.ncadc.org.uk/about/annreports.htm"
wasak[1][3]="FF9900#Disclaimer+http://www.ncadc.org.uk/about/disclaimer.htm"

//menu 3

wasak[2][0]="000000#Latest&nbsp;newszine+http://www.ncadc.org.uk/current-newszine.htm"
// wasak[2][1]="000000#Google&nbsp;news&nbsp;feeds+http://www.p2pb.org/cgi-bin/ncadc-rss2html.cgi?http://www.p2pb.org/news/gnews2rss-no-d.php?q=UK%20immigration&num=20"
// wasak[2][1]="000000#Moreover&nbsp;news&nbsp;feeds+http://www.ncadc.org.uk/cgi-bin/moreoverfeeds.cgi?UK%20immigration%20news"
wasak[2][1]="000000#IRR&nbsp;news&nbsp;feeds+http://www.ncadc.org.uk/news/irrfeeds.htm"

//menu 4

wasak[3][0]="FF9900#Campaigning&nbsp;guide+http://www.ncadc.org.uk/campaigns/guide.htm"
wasak[3][1]="FF9900#Library+http://www.ncadc.org.uk/resources/library.htm"
wasak[3][2]="FF9900#Women's&nbsp;resources+http://www.ncadc.org.uk/resources/women.html"
wasak[3][3]="FF9900#Other&nbsp;resources+http://www.ncadc.org.uk/resources/resources.htm"

//menu 5

wasak[4][0]="000000#News&nbsp;archive+http://www.ncadc.org.uk/archives/newsarchive.htm"
// wasak[4][1]="000000#Archive&nbsp;2+http://www.ncadc.org.uk/archives/archive2.htm"
// wasak[4][2]="000000#Archive&nbsp;3+http://www.ncadc.org.uk/archives/archive3.htm"
// wasak[4][3]="000000#Archive&nbsp;4+http://www.ncadc.org.uk/archives/archive4.htm"


//menu 6

wasak[5][0]="FF9900#NGOs+http://www.ncadc.org.uk/links/ngos.htm"
wasak[5][1]="FF9900#Other&nbsp;views+http://www.ncadc.org.uk/links/views.htm"


function makeLayer(){

//this function makes layers for Netscape

arg=makeLayer.arguments;
whatDiv = arg[0];
DivLeft=arg[1];
x=arg[2];

getHash = wasak[x][0].indexOf("#");
bg_color = wasak[x][0].substring(0,getHash);

layerstyle="drop";

theDiv="<layer id=\"" +whatDiv+ "\" visibility=HIDE left=" +DivLeft+ " top=23 bgcolor=#" +bg_color+ " width=80 onmouseover=\"showMenu('','document.layers[\\'"+ whatDiv +"\\']')\" onMouseout=\"hideMenu('','document.layers[\\'"+ whatDiv +"\\']')\"><layer id=topline bgcolor=\"#FF9900\"></LAYER>";

theTop = 3

for (var i=0; i < wasak[x].length; i++)
{
getHash = wasak[x][i].indexOf("#");
getPlus = wasak[x][i].indexOf("+");
bg_color = wasak[x][i].substring(0,getHash);
urlName = wasak[x][i].substring(getHash+1, getPlus);
urlAdrs = wasak[x][i].substring(getPlus +1, wasak[x][i].length)
theDiv +="<layer id=" +i+whatDiv+ "bgcolor=#" +bg_color+ " top=\"" +theTop+ "\" onMouseover=\"this.bgColor='#" +chng_color+"'\" onMouseout=\"this.bgColor='#" +bg_color+ "'\" width=80 height=15>&nbsp;<a class='drop' href="+urlAdrs+ "><font face='Arial' color='#ffffff' size='2'><b>" +urlName+ "</b></font></a>&nbsp;</layer>";
theTop = theTop+15
theDiv +="<layer id=underline bgcolor=#" +bg_color+ " top=\"" +theTop+ "\"></LAYER>";
theTop = theTop+13
}
theDiv += "<layer id=theend></layer></layer>"

document.write(theDiv);
}

//document.getElementById('" +whatDiv+ "'))

function makeDiv(){

//this function makes Divs for IE

arg=makeDiv.arguments;
x=arg[2];
whatDiv=arg[0];
DivLeft=arg[1];

getHash = wasak[x][0].indexOf("#");
bg_color = wasak[x][0].substring(0,getHash);


var IEtop=28;
if(is_ie4up)
{
  IEtop=35;
}

if (is_opera)  {
  IEtop=28;
}

theDiv="<div id=\"" +whatDiv+ "\" style=\" visibility:hidden; position:absolute; top:" +IEtop+ "px; left:" +DivLeft+ "px; background-color:#" +bg_color+ "\" onMouseover=\"showMenu('" +whatDiv+ "','',document.getElementById('" +whatDiv+ "'))\"; onMouseout=\"hideMenu('" +whatDiv+ "','',document.getElementById('" +whatDiv+ "'))\";><div id=topline bgcolor=#" +bg_color+ "></div>";

theTop=3

for (var i=0; i < wasak[x].length; i++)
{
getHash = wasak[x][i].indexOf("#");
getPlus = wasak[x][i].indexOf("+");
// bg_color = wasak[x][i].substring(0,getHash);
urlName = wasak[x][i].substring(getHash+1, getPlus);
urlAdrs = wasak[x][i].substring(getPlus +1, wasak[x][i].length)

theDiv +="<div id=" +i+whatDiv+ "bgcolor=" +bg_color+ " top=\"" +theTop+ "\" onMouseover=\"this.style.backgroundColor='#" +chng_color+ "';\" onMouseout=\"this.style.backgroundColor='#" +bg_color+ "';\" width=150 height=21>&nbsp;<a class='drop' href=" +urlAdrs+ "><font face='Arial' size='2' color='#ffffff'><b>" +urlName+ "</b><font></a>&nbsp;</div>";
theTop = theTop+22
theDiv +="<div id=underline bgcolor=#" +bg_color+ " top=\"" +theTop+ "\"></div>";
theTop = theTop+3
}
theDiv += "<div id=theend bgcolor=#" +bg_color+ " top=" +theTop+ " height=5></div></div>"


document.write(theDiv);
}


function showMenu(){

//makes the divs or layers appear when you do onmouseover on the buttons or on the div itself

if(is_ie4up)
{
arg=showMenu.arguments
DivId=eval(arg[0])
if(DivId.style.visibility=='hidden'){DivId.style.visibility = 'visible'}
}
else if(is_nav5 || is_opera)
{
arg=showMenu.arguments
DivId=eval(arg[2])
if(DivId.style.visibility=='hidden'){DivId.style.visibility = 'visible'}
}
else
{
args = showMenu.arguments;
DivID = eval(args[1]);
if (DivID) if(DivID.visibility=='hide'){DivID.visibility = 'show';}
}
}

function hideMenu(){

//does the opposite of showMenu

if(is_ie4up)
{
arg=hideMenu.arguments
DivId=eval(arg[0])
if(DivId.style.visibility=='visible'){DivId.style.visibility = 'hidden'}
}
else if(is_nav5)
{
arg=hideMenu.arguments
DivId=eval(arg[2])
if(DivId.style.visibility=='visible'){DivId.style.visibility = 'hidden'}
}
else
{
args = hideMenu.arguments;
DivID = eval(args[1]);
if (DivID) if(DivID.visibility=='show'){DivID.visibility = 'hide';}
}
}


}

var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;		
var isMac = (navigator.appVersion.indexOf("Macintosh") != -1) ? true : false;

if (!isMac || (!isIE))
{


if (is_nav5 || is_ie4up || is_opera) 

{

// makeDiv('first',12,0);
makeDiv('second',136,1);
makeDiv('third',260,2);
makeDiv('fourth',385,3);
makeDiv('fifth',510,4);
makeDiv('sixth',635,5);

}
else
{

// makeLayer('first',19,0);
makeLayer('second',136,1);
makeLayer('third',260,2);
makeLayer('fourth',385,3);
makeLayer('fifth',510,4);
makeLayer('sixth',635,5);

}

}
