// JavaScript Document
var iframeservice = null;
var iframestore = null;
var iframeabout = null
var iframemerchant = null;

document.observe("dom:loaded", function() {
	
	if ($('about') != null) {
		$('about').observe('mouseover', function(){
			$('about').select('ul').each(function(item){
				item.show();
				// only utilize if browser is IE6
				if (navigator.appVersion.indexOf("MSIE 6") > 0 && iframeabout == null) {
					var left = 'auto';
					var dimensions = item.getDimensions();
					var width = dimensions.width + 'px';
					var height = dimensions.height + 'px';
					var html = '<iframe class="bgiframe" frameborder="0" src="javascript:false;" ' +
					'style="display:block; position:absolute; z-index:9999; ' +
					'top: 58px; left: 25px;' +
					' width:' +
					width +
					'; height:' +
					height +
					';"/>';
					
					iframeabout = Element.extend(document.createElement(html));
					$('about').insertBefore(iframeabout, item);
				}
				else 
					if (navigator.appVersion.indexOf("MSIE 6") > 0 && iframeabout != null) {
						iframeabout.show();
				}
			});
		});
		
		$('about').observe('mouseout', function(){
			$('about').select('ul').each(function(item){
				item.hide();
			});
			if (navigator.appVersion.indexOf("MSIE 6") > 0 && iframeabout != null) {
				iframeabout.hide();
			}
		});
	}
	
	if ($('merchantresources') != null) {
		$('merchantresources').observe('mouseover', function(){
			$('merchantresources').select('ul').each(function(item){
				item.show();
				// only utilize if browser is IE6
				if (navigator.appVersion.indexOf("MSIE 6") > 0 && iframemerchant == null) {
					var left = 'auto';
					var dimensions = item.getDimensions();
					var width = dimensions.width + 'px';
					var height = dimensions.height + 'px';
					var html = '<iframe class="bgiframe" frameborder="0" src="javascript:false;" ' +
					'style="display:block; position:absolute; z-index:9999; ' +
					'top: 58px; left:' +
					left +
					'; width:' +
					width +
					'; height:' +
					height +
					';"/>';
					
					iframemerchant = Element.extend(document.createElement(html));
					$('merchantresources').insertBefore(iframemerchant, item);
				}
				else 
					if (navigator.appVersion.indexOf("MSIE 6") > 0 && iframemerchant != null) {
						iframemerchant.show();
					}
			});
		});
		
		$('merchantresources').observe('mouseout', function(){
			$('merchantresources').select('ul').each(function(item){
				item.hide();
			});
			if (navigator.appVersion.indexOf("MSIE 6") > 0 && iframemerchant != null) {
				iframemerchant.hide();
			}
		});
	}
	
	if ($('serviceandsupport') != null) {
		$('serviceandsupport').observe('mouseover', function(){
			$('serviceandsupport').select('ul').each(function(item){
				item.show();
				// only utilize if browser is IE6
				if (navigator.appVersion.indexOf("MSIE 6") > 0 && iframeservice == null) {
					var left = 'auto';
					var dimensions = item.getDimensions();
					var width = dimensions.width + 'px';
					var height = dimensions.height + 'px';
					var html = '<iframe class="bgiframe" frameborder="0" src="javascript:false;" ' +
					'style="display:block; position:absolute; z-index:9999; ' +
					'top: 58px; left:' +
					left +
					'; width:' +
					width +
					'; height:' +
					height +
					';"/>';
					
					iframeservice = Element.extend(document.createElement(html));
					$('serviceandsupport').insertBefore(iframeservice, item);
				}
				else 
					if (navigator.appVersion.indexOf("MSIE 6") > 0 && iframeservice != null) {
						iframeservice.show();
					}
			});
		});
		
		$('serviceandsupport').observe('mouseout', function(){
			$('serviceandsupport').select('ul').each(function(item){
				item.hide();
			});
			if (navigator.appVersion.indexOf("MSIE 6") > 0 && iframeservice != null) {
				iframeservice.hide();
			}
		});
	}

	if ($('store') != null) {
		$('store').observe('mouseover', function(){
			$('store').select('ul').each(function(item){
				item.show();
				if (navigator.appVersion.indexOf("MSIE 6") > 0 && iframestore == null) {
					var left = 'auto';
					var dimensions = item.getDimensions();
					var width = dimensions.width + 'px';
					var height = dimensions.height + 'px';
					var html = '<iframe class="bgiframe" frameborder="0" src="javascript:false;" ' +
					'style="display:block; position:absolute; z-index:9999; ' +
					'top: 58px; left:' +
					left +
					'; width:' +
					width +
					'; height:' +
					height +
					';"/>';
					iframestore = Element.extend(document.createElement(html));
					$('store').insertBefore(iframestore, item);
				}
				else 
					if (navigator.appVersion.indexOf("MSIE 6") > 0 && iframestore != null) {
						iframestore.show();
					}
			});
		});
		
		$('store').observe('mouseout', function(){
			$('store').select('ul').each(function(item){
				item.hide();
			});
			if (navigator.appVersion.indexOf("MSIE 6") > 0 && iframestore != null) {
				iframestore.hide();
			}
		});
	}
});
