if (document.getElementsByTagName && document.getElementsByClassName  ) {
	// Create a link to the Javascript-only stylesheet

	var $link_element1 = document.createElement('link');
	$link_element1.setAttribute("rel","stylesheet");
	$link_element1.setAttribute("href","/css/javascript_only.css");
	$link_element1.setAttribute("media","screen");
	

	// Append this stylesheet link to the document

	var $head_element = document.getElementsByTagName('head')[0];
	$head_element.appendChild($link_element1);



}

var linkTitle=''

function init(){

	
	$$('#sectionMenu>li').each( function(link) {
	
		
		linkTitle=link.getAttribute('title');
			link.onmouseover = function() {
						// hide all panels
						$$('.sectionPanel').each(Element.hide);
						// show relevant outer panel		
						linkTitle=this.getAttribute('title');
						if ($(linkTitle + 'Panel')) {$(linkTitle + 'Panel').style.display="block";}

						
						this.className='on';
						// show relevant inner panel
						if ($(linkTitle + 'SectionPanel')) {$(linkTitle + 'SectionPanel').style.display="block";}
			}
			
			link.onmouseout = function() {
						this.className='';
						 // $$('.sectionPanel').each(Element.hide);
						 // $(linkTitle + 'Panel').hide();
						 $$('.sectionPanel').each(Element.hide);
			}
			

			

	
	});
	
	
	
	
	
	$$('#searchMenu li').each( function(link) {
		linkTitle=link.getAttribute('title');
			link.onmouseover = function() {
						$$('#searchMenu li').each( function(onLink) {
							onLink.className='';							
						});
						
						// hide all panels
						$$('.searchPanel').each(Element.hide);
						// show relevant outer panel		
						linkTitle=this.getAttribute('title');
						if ($(linkTitle + 'Panel')) {$(linkTitle + 'Panel').style.display="block";}

						
						this.className='on';
						// show relevant inner panel
						if ($(linkTitle + 'SearchPanel')) {$(linkTitle + 'SearchPanel').style.display="block";}
			}
			link.onmouseout = function() {
						
						
			}
			
	});
	
			$$('p.close').each( function(closeButton) {
				closeButton.onclick = function() {	
							$$('.searchPanel').each(Element.hide);
						// restore link classes to off	
						$$('#searchMenu li').each( function(onLink) {
							onLink.className='';
							
						})
						
						$$('#adminMenu>li').each( function(onLink) {
							onLink.className='';
							
						})
							
				}
			});
			
			
	//			 adminMenu
	
		$$('#adminMenu>li').each( function(link) {
		linkTitle=link.getAttribute('title');
			link.onmouseover = function() {
						$$('#adminMenu li').each( function(onLink) {
							onLink.className='';							
						});
						
						// hide all panels
						$$('.searchPanel').each(Element.hide);
						// show relevant outer panel		
						linkTitle=this.getAttribute('title');
						if ($(linkTitle + 'Panel')) {$(linkTitle + 'Panel').style.display="block";}

						
						this.className='on';
						// show relevant inner panel
						if ($(linkTitle + 'SearchPanel')) {$(linkTitle + 'SearchPanel').style.display="block";}
			}
			link.onmouseout = function() {
						
						
			}
			
	});
	
	




	
	//replace tab links
	if ($('tabs') && $('board')){	
		new Fabtabs('tabs');
		var tabLinks=$$('#tabs li a');
		tabLinks[0].setAttribute('href', '#bermuda');
		tabLinks[1].setAttribute('href', '#america');
		tabLinks[2].setAttribute('href', '#asia');
		
	}
	
	//replace tab links
	if ($('tabs') && $('annualReports')){
		new Fabtabs('tabs');
		var tabLinks=$$('#tabs li a');
		tabLinks[0].setAttribute('href', '#bermuda');
		tabLinks[1].setAttribute('href', '#europe');
		tabLinks[2].setAttribute('href', '#warRisks');
		
	}
	if ($('tabs') && $('rules')){
		new Fabtabs('tabs');
		
	}	
		
	
	if ($('basic_container')){ bas_cal = new Epoch('epoch_basic','flat',document.getElementById('basic_container'));
		alert(Epoch.mode);
	}
		
	
	


}



// Set the country interval counter;
var countrySwitchInterval=0;

// set interval length
var interval=4;
// Set the country number;
var country=0;	
	
	

function showClock(){
	// Clock

	var url='/inc/clock.aspx';
	
	var params='c=' + country;
	var target1='datetime';

	
	var myAjax=new Ajax.Updater
	(
	target1,
	url,
	{method: 'get', parameters:params}
	);
	
	
	
	countrySwitchInterval++;	

	if (countrySwitchInterval>interval){
		countrySwitchInterval=0;
		country++;

			new Effect.Fade('datetime', {duration:.5});
			setTimeout("new Effect.Appear('datetime', {duration:.5});",1000);
			if (country>2){
			country=0;			
			}
		
	};

	// timezoneCount++;
	setTimeout("showClock()", 1000 );
	
}	

var timezoneCount=0;
Event.observe(window, 'load', init, false);
// Event.observe(window, 'load', show_clock, false);
Event.observe(window, 'load', showClock, false);


