/**
*
*	Add browser detection
*
**/

var Browser = {
	detect: function() {
		var UA = navigator.userAgent;
		this.isKHTML = /Konqueror|Safari|KHTML/.test(UA);
		this.isGecko = (/Gecko/.test(UA) && !this.isKHTML);
		this.isOpera = /Opera/.test(UA);
		this.isMSIE = (/MSIE/.test(UA) && !this.isOpera);
		this.isMSIE7 = this.isMSIE && !(/MSIE 6\./.test(UA) && !this.isOpera);
		this.isMSIE6 = this.isMSIE && !this.isMSIE7;
		this.isIPHONE = /iPhone|iPod/.test(UA);
	}
}
Browser.detect();



/**
*
*	SUBNAVIGATION SUPPORT FOR IE6
*
**/

c_ie6subnav = Class.create({

	initialize: function() {
		
		// initialize
		this.set_event_handlers();		
	
	},
	
	set_event_handlers: function() {
	
		t = $$('ul#top-nav ul.sub-nav');
		for(i=0; i<t.length; i++) {

			myLi = t[i].up();
			myLi.onmouseover = function() { this.className = 'hover'; };
			myLi.onmouseout = function() { this.className = ''; };

		}
		
		t = $$('ul#top-nav ul.sub-nav ul.subsub-nav');
		for(i=0; i<t.length; i++) {

			myLi = t[i].up();
			myLi.onmouseover = function() { this.className = 'hover'; };
			myLi.onmouseout = function() { this.className = ''; };

		}
		
		t = $$('ul#service-nav div.sub-nav');
		for(i=0; i<t.length; i++) {
		
			myLi = t[i].up();
			myLi.onmouseover = function() { this.className = 'hover'; };
			myLi.onmouseout = function() { this.className = ''; };

		}
	
	}

});



/**
*
*	HOVER SUPPORT FOR IE6
*
**/

c_ie6hover = Class.create({

	initialize: function() {
		
		// initialize
		this.set_event_handlers();
	
	},
	
	set_event_handlers: function() {
	
		// price
		$$('div.price').each(function(a) {
			a.onmouseover = function() { this.addClassName('price-hover'); };
			a.onmouseout = function() { this.removeClassName('price-hover'); };
		});
		
		// product desc popup
		$$('div.product-box div.image').each(function(a) {
			a.onmouseover = function() { this.addClassName('image-hover'); };
			a.onmouseout = function() { this.removeClassName('image-hover'); };
		});
	
	}

});



/**
*
*	DOM LOADED
*
**/

document.observe('dom:loaded', function() {
	if(Browser.isMSIE6) {
		_ie6subnav = new c_ie6subnav();
		_ie6hover = new c_ie6hover();
	}
	

});
