window.onload = initAbce;

function initAbce()
{
	if (document.getElementById("abce"))
	{
        document.getElementById("abce").onclick = abce;
		}
}

function abce()
{
        document.getElementById("abce").href='http://www.britishinformation.com/imgs/abceMarch09.pdf';
}

// JavaScript Document
/* Custom News Widget */

function switchbutton(chosendiv)
{
        var i,divbuttons=['button1','button2','button3'],divtext=['newsdiv1','newsdiv2','newsdiv3'];
        for(i =0; i <'3' ;i++)
        {
                if (divbuttons[i] != chosendiv)
                {
                        document.getElementById(divbuttons[i]).className='notSelectLink'; 
                        document.getElementById(divtext[i]).style.display = 'none'; 
                }
                else {document.getElementById(divbuttons[i]).className = 'selectLink'; document.getElementById(divtext[i]).style.display = 'inline';}
        }
}

function switchbutton2(chosendiv)
{
        var i,divbuttons=['buttonb1','buttonb2','buttonb3'],divtext=['stuffdiv1','stuffdiv2','stuffdiv3'];
        for(i =0; i <'3' ;i++)
        {
                if (divbuttons[i] != chosendiv)
                {
                        document.getElementById(divbuttons[i]).className='notSelectLink'; 
                        document.getElementById(divtext[i]).style.display = 'none'; 
                }
                else {document.getElementById(divbuttons[i]).className = 'selectLink'; document.getElementById(divtext[i]).style.display = 'inline';}
        }
}

function NewsImage(imgdat)
{
        document.write('<img src="' + decode64(imgdat) + '" height="49" width="66">');
}

function decode64(input)
{
     var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
     var output = "";
     var chr1, chr2, chr3 = "";
     var enc1, enc2, enc3, enc4 = "";
     var i = 0;

     // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
     var base64test = /[^A-Za-z0-9\+\/\=]/g;

     input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

     do {
        enc1 = keyStr.indexOf(input.charAt(i++));
        enc2 = keyStr.indexOf(input.charAt(i++));
        enc3 = keyStr.indexOf(input.charAt(i++));
        enc4 = keyStr.indexOf(input.charAt(i++));

        chr1 = (enc1 << 2) | (enc2 >> 4);
        chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
        chr3 = ((enc3 & 3) << 6) | enc4;

        output = output + String.fromCharCode(chr1);

        if (enc3 != 64) {
           output = output + String.fromCharCode(chr2);
        }
        if (enc4 != 64) {
           output = output + String.fromCharCode(chr3);
        }

        chr1 = chr2 = chr3 = "";
        enc1 = enc2 = enc3 = enc4 = "";

     } while (i < input.length);

     return unescape(output);
}

// POP UP WINDOWS
function openScript(url, width, height) {
        Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=0,menubar=0,status=0' );

 	// calculate the center of the page
        x = (screen.availWidth - width) / 2;
        y = (screen.avaiHeight - height) / 2;
     
        // move to the center of the page
        Win.moveTo(x, y);
}


