// JavaScript Document

var bar

window.onload = init;

function init()
{
	var a = document.getElementsByTagName("DIV")
	
	for( i=0; i<a.length;i++ )
	{
		if( a[i].className )
		{
			if( a[i].className == 'nav2' )
			{
				a[i].onmouseover = a[i].onfocus = function(){

					if(gblElement != 'sub_' + this.id.split('_')[0]){
						var hide = document.getElementById(gblElement);
						if(document.getElementById('sub_'+this.id.split('_')[0])){
						
						
						if(hide){hide.style.display = 'none';}
						
						//document.getElementById('sub_'+this.id.split('_')[0]).style.display = 'block'
						//bar = document.getElementById('sub_'+this.id.split('_')[0])
						num = this.id.split('_')[0]
						var over = document.getElementById('sub_' + num);
						widthCount = 0;
						//opacityCount = 0;
						over.style.display = 'block';
						slideOut('sub_' + num);
						//fadeIn('sub_' + num);
						//alert('over');
						//opacity('sub_'+num, 0, 100, 500)
						}else{if(hide){hide.style.display = 'none';gblElement = '';}}
					}
						
						//var thesub = document.getElementById('sub_'+this.id.split('_')[0])
						//opacity('thesub', 0, 100, 500)*/
				}
				
				a[i].onblur = function(){
					

						if( document.getElementById('sub_'+this.id.split('_')[0])){
							//document.getElementById('sub_'+this.id.split('_')[0]).style.display = 'none'
							numtwo = this.id.split('_')[0]
							var out = document.getElementById('sub_' + numtwo);
							//out.style.opacity = 0;
							out.style.display = 'none';
							
							//opacity('sub_'+numtwo, 100, 0, 500)
						}
							
							//var thesub2 = document.getElementById('sub_'+this.id.split('_')[0])
							//opacity('thesub2', 100, 0, 500)
				}
			}
			
			if( a[i].className == 'topnav' )
			{
				a[i].onmouseover = a[i].onfocus = function()
				{
					if(document.getElementById('sub_'+this.id.split('_')[0]))
						//document.getElementById('sub_'+this.id.split('_')[0]).style.display = 'block'
						//bar = document.getElementById('sub_'+this.id.split('_')[0])
						num = this.id.split('_')[0]
						opacity('sub_'+num, 0, 100, 500)
						//var thesub = document.getElementById('sub_'+this.id.split('_')[0])
						//opacity('thesub', 0, 100, 500)
				}
				
				a[i].onmouseout = a[i].onblur = function()
				{
						if( document.getElementById('sub_'+this.id.split('_')[0]))
							//document.getElementById('sub_'+this.id.split('_')[0]).style.display = 'none'
							numtwo = this.id.split('_')[0]
							opacity('sub_'+numtwo, 100, 0, 500)
							//var thesub2 = document.getElementById('sub_'+this.id.split('_')[0])
							//opacity('thesub2', 100, 0, 500)
				}
			}
			
			/*if(a[i].className == 'subtier' )
			{
				a[i].onmouseover = a[i].onfocus = function()
				{
					newid = this.id.split('_')[1]
					if( document.getElementById('tier_'+newid))
					thesub = document.getElementById('tier_'+newid)
					thesub.style.display = 'block'
				}
				
				a[i].onmouseout = a[i].onblur = function()
				{
					newid = this.id.split('_')[1]
					if( document.getElementById('tier_'+newid))
					thesub = document.getElementById('tier_'+newid)
					thesub.style.display = 'none'
				}
			}*/
		}
	}
	
	
	/*var a = document.getElementsByTagName("A")
		for( i=0;i<a.length;i++ )
		//alert("yes")
		{
			if( a[i].href.indexOf('.pdf') != -1 || a[i].href.indexOf('.PDF') != -1 )
			{

				a[i].style.paddingRight = '18px'
				a[i].style.background = 'url(/images/ico_pdf.gif) top right no-repeat'
			}
			
			if( a[i].href.indexOf('mailto:') != -1 || a[i].href.indexOf('MAILTO:') != -1 )
			{
				//a[i].style.paddingRight = '18px'
				//a[i].style.background = 'url(/images/ico_mail.gif) top right no-repeat'
			}
			
			if( a[i].href.indexOf('maps.google.com') != -1 || a[i].href.indexOf('MAPS.GOOGLE.COM') != -1 )
			{
				a[i].style.paddingRight = '18px'
				a[i].style.background = 'url(/images/ico_maps.gif) top right no-repeat'
			}
		}*/
	
}
