/*!
 * Copyright (c) 2010-2011 Rotorz Limited. All rights reserved.
 * License:	GNU/GPLv2
 * Author:	Lea Hayes <lea@rotorz.com>
 * Website:	http://rotorz.com
*/
//CHECK FOR IE6
function is_ie6(){
     return ((window.XMLHttpRequest == undefined) && (ActiveXObject != undefined));
}

if (!is_ie6()) {

jQuery(function() {
	var navEl = jQuery('nav.primary-navigation');
	var li = navEl.find('li');

	li.each(function(index) {
		var el = jQuery(this);
		var overlay = jQuery('<div></div>');
		navEl.append(overlay);

		var pos = el.position();
		pos.left -= 27;

		var css = {
			'position'	: 'absolute',
			'left'		: (pos.left) + 'px',
			'top'		: pos.top + 'px',
			'width'		: (el.width() - 28) + 'px',
			'height'	: el.height() + 'px',
			'cursor'	: 'pointer'
		};

		if (index === 0)
			css['width'] = (el.width() - 8) + 'px';

		if (index === li.length - 1)
			css['width'] = (el.width() - 12) + 'px';
		else
			css['left'] = (pos.left + 19) + 'px';

		overlay
			.css(css)
			.click(function() {
				window.location = el.find('a').attr('href');
			})
			.mouseover(function() {
				el.addClass('state-hover');
			})
			.mouseout(function() {
				el.removeClass('state-hover');
			});
	});
})

}
