// JavaScript Document

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 = function()
				{
					if(document.getElementById('sub_'+this.id.split('_')[0]))
						document.getElementById('sub_'+this.id.split('_')[0]).style.display = 'block'
				}
				
				a[i].onmouseout = function()
				{
						if( document.getElementById('sub_'+this.id.split('_')[0]))
							document.getElementById('sub_'+this.id.split('_')[0]).style.display = 'none'
				}
			}
			
			if(a[i].className == 'subtier' )
			{
				a[i].onmouseover = a[i].onfocus = function()
				{
					if(document.getElementById(this.id)){
						document.getElementById(this.id).style.display = 'block';						   
					}
					
					//Tier Nav
					/*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()
				{
					//Tier Nav
					/*newid = this.id.split('_')[1]
					if( document.getElementById('tier_'+newid))
					thesub = document.getElementById('tier_'+newid)
					thesub.style.display = 'none'*/
				}
			}
		}
	}
	
	var gasDD = document.getElementById('ico_gasDD')
	var ico_gas = document.getElementById('ico_gas')
	
	ico_gas.onmouseover = ico_gas.onfocus = function()
	{
		//alert('yes')
		gasDD.style.display = 'block';
		opacity('ico_gasDD', 0, 100, 500);
	}
	
	ico_gas.onmouseout = ico_gas.onblur = function()
	{
		//gasDD.style.display = 'none';
		opacity('ico_gasDD', 100, 0, 500);
	}
	
	var coffeeDD = document.getElementById('ico_coffeeDD')
	var ico_coffee = document.getElementById('ico_coffee')
	
	ico_coffee.onmouseover = ico_coffee.onfocus = function()
	{
		//alert('yes')
		opacity('ico_coffeeDD', 0, 100, 500)
	}
	
	ico_coffee.onmouseout = ico_coffee.onblur = function()
	{
		opacity('ico_coffeeDD', 100, 0, 500)
	}
	
	var foodDD = document.getElementById('ico_foodDD')
	var ico_food = document.getElementById('ico_food')
	
	ico_food.onmouseover = ico_food.onfocus = function()
	{
		//alert('yes')
		opacity('ico_foodDD', 0, 100, 500)
	}
	
	ico_food.onmouseout = ico_food.onblur = function()
	{
		opacity('ico_foodDD', 100, 0, 500)
	}
	
	//var shopbox = document.getElementById('shopBox')
//	
//	shopbox.onmouseover = shopbox.onfocus = function()
//	{
//		opacity('shopBox',100,0,500)
//		shopbox.innerHTML = "<a href='/Scripts/list.asp?idCategory=1'><img src='/images/box_shop.png' style='width:184px; height:161px;' ></a>"
//		opacity('shopBox',0,100,500)
//		clearTimeout
//	}
//	
//	shopbox.onmouseout = shopbox.onblur = function()
//	{
//		opacity('shopBox',0,100,500)
//		shopbox.innerHTML = "<a href='/Scripts/list.asp?idCategory=1'><img src='/images/box_shop2.png' style='width:184px; height:161px;' ></a>"
//		opacity('shopBox',100,0,500)
//		clearTimeout
//	}
	 

	 
	 
	
	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'
			}
		}
	
}
