var timer_expired = true;
var image_loaded = false;
var state = 'none';

var image_array = new Array(

	'bebo-banner',
	'gp2',
	'fk',
	'clubculture',
	'pappa',
	'cddj-banner-2',
	'CALMWebBanner-v4',
	
	'alan-hartley',
	'amo-and-navas',
	'andy-cato',
	'baroque',
	'bassheads',
	'chris-lake',
	'dave-seaman',
	'dean-24',
	'dean-muhsin',
	'dubfire',
	'futureproof',
	'hernan',
	'james-barton',
	'james-harcourt',
	'jed-eye',
	'joel-xavier',
	'jondi-and-spesh',
	'max-c',
	'micky-slim',
	'nils-noa',
	'pete-tong-1',
	'pete-tong-2',
	'ricky-ryan',
	'stimp',
	'streetlife-djs',
	'timo-maas',
	'toolroom',
	'veto'

	);

/*
var image_array = new Array(

	'bebo-banner'
);
*/
var link_array = new Array(

	'http://3beatrecords.bebo.com',
	'',
	'http://www.threebeatrecords.co.uk/htm/estore/search2.php?search_string=francois+k&search_what=all',
	'',
	'http://www.hinote.com.tw',
	'http://www.threebeatrecords.co.uk/search/artist/hard-backed%20cd%20sleeves',
	'http://www.thecalmzone.net',
	
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk',
	'http://www.threebeatrecords.co.uk'
	
	
	);


var ext_array = new Array(

	'gif',
	'swf',
	'gif',
	'swf',
	'gif',
	'gif',
	'gif',
	
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif',
	'gif'
	
	);
	
var total_images = image_array.length;
var i=Math.floor(Math.random()*total_images);

function loaded() {
//+'<param name="movie" value="/banners/%27+%20image_array%5Bi%5D%20+%27.swf">'
var banner=document.getElementById("banner");    
if (timer_expired) {

      image_loaded = false;

      timer_expired = false;
      setTimeout('timeout()',20000);
      if (ext_array[i] == "swf") {
	  	banner.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="468" height="60">'
          +'<param name="movie" value="/bnrs/'+image_array[i]+'".swf">'
          +'<param name=quality value=high>'
          +'<embed src="/bnrs/'+image_array[i]+'.swf" quality=high pluginspage="https://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="468" height="60"></embed>'
        +'</object>';
		image_loaded = true;
	  } else if (ext_array[i] == "gif" || ext_array[i] == "jpg") {
	  	banner.innerHTML = '<a href="'+ link_array[i] +'" target="_blank"><img src="/bnrs/'+image_array[i]+'.'+ext_array[i]+'" width="468" height="60" border="0" alt="Banner Ad">';
		image_loaded = true;
	  }
        i++;
    }
    else {
      image_loaded = true;
    }
  if (i == total_images) {
	i = 0;
  }
}

function timeout() {
  timer_expired = true;
  if (image_loaded) {
  	loaded();
  }
}

/* --- EXPAND MENU BAR ETC --------------------------------------------------------------------- */

function my_getbyid(id)
{
	itm = null;
	if (document.getElementById) {
		itm = document.getElementById(id);
	} else if (document.all) {
		itm = document.all[id];
	} else if (document.layers) {
		itm = document.layers[id];
	}	
	return itm;
}

// Show/hide toggle
function toggleview(id,closeMenu)
{
	if ( ! id ) return;
		// check for main heading
		if(closeMenu=="close") {
			// loop through all mains to check if they need closing
			for(i=1;i<=7;i++) {
				tempItem = "menuSubNav-"+i;
				killMenus(tempItem, id);
			}
		}
}

// used to determine what subs subsubs bugger off
function killMenus(objName, id) {
	if (itm = my_getbyid(objName) )	{
		// for either the section we do/'nt want
		if(id==objName) {
			if (itm.style.display == "" || itm.style.display == "none"){
				myShowHide(itm,'block');
			} else {
				myShowHide(itm,'none');
			}
		} else {
			myShowHide(itm,'none');
		}
	}
	
}

// used to either hide or show a section
function myShowHide(itm,pty) {
	if ( ! itm ) return;
	itm.style.display = pty;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
