function css() {

	
	$('.link-print').bind('click',function(){ window.print(); });
	$('.link-back').bind('click',function(){ history.back(); return false; });
	$('input[type=text], input[type=search]').clear();
	$('#prod-img .img, .link-zoom').fancybox();
	$('a.unclickable').click(function(e){ e.preventDefault(); });
	
	
	/*
	 * CUFON
	 *
	 * @ Aller
	 * @ Aller bold
	 *
	 */
	Cufon.replace('nav>ul>li>a', {
		fontFamily: 'Aller bold',
		hoverable: {
			a	: true,
			span: true
		},
		hover: true
		
	});
	Cufon.replace('h1, .mod>h4, .mod>h5, #cats-mod span, #prod-data h4, #compare-mod table tr:first-child th', {
		fontFamily: 'Aller',
		hoverable: {
			a	: true,
			span: true
		},
		hover: true
		
	});
	$('nav>ul>li').hover(function(){
		$(this).addClass('temp');
	}, function(){
		$(this).removeClass('temp');
		Cufon.replace('nav>ul>li>a', {
			fontFamily: 'Aller bold',
			hoverable: {
				a	: true,
				span: true
			},
			hover: true
		});
	});
	
	
	/* nav items auto adjustment */
	_navWidth = $('nav>ul').width();
	_navSize = $('nav>ul>li').size();
	_navItemsWidth = 0;
	Cufon.CSS.ready(function() {
		
		$('nav>ul>li>a').each(function(){
			
			_navItemsWidth = _navItemsWidth + parseInt($(this).width());
		});
		
		_navWidth = _navWidth-_navItemsWidth;
		
		_navItemPadding = Math.floor( (_navWidth /_navSize)/2 );
		$('nav>ul>li>a').css('padding','0 ' + _navItemPadding + 'px');
		_navItemLastPadding = _navWidth - ( _navItemPadding * (_navSize*2) );
		
		if(_navItemLastPadding%2 == 0){
			_navItemPadding = _navItemPadding + (_navItemLastPadding/2);
			$('nav>ul>li:last>a').css('padding','0 ' + _navItemPadding + 'px');
		}
		else{
			_navItemPadding = _navItemPadding + ((_navItemLastPadding-1)/2);
			$('nav>ul>li:last>a').css('padding','0 ' + (_navItemPadding + 1) + 'px 0 ' + _navItemPadding + 'px');
			
		}
	});
	
	
	
	
	_td = $('#compare-mod table tr:first-child td').height();
	$('#compare-mod table tr:first-child div').height(_td-20);
	
	$('nav div').each(function(){
		_size = $(this).children('ul').children('li').size();
		if(_size > 1 && _size < 4){
			if(_size%2 == 0)
				_size = _size/2;
			else
				_size = _size+1/2;
				
			$(this).width(221*_size)
		}
		else
		{
			_size = 4;
			$(this).width(221*_size);
		}
	});
	
	$('.link-compare').unbind().bind('click',function(e){
		e.preventDefault();
		$('form.prods-list').submit();
	});
	
	/* Prods list: link change */
	$('.link-change').bind('click',function(e){
		e.preventDefault();
		_id = $(this).attr('href').split('#')[1];
		
		$(this).toggleClass('link-change-act');
		$('#'+_id).toggle();
		
	});
	
	
	/* Product: compare-store checkbox action */
	$('#prod-img label input:checked').parent().next('a').show();
	$('#prod-img label input:checkbox').change(function(){
		$(this).parent().next('a').toggle();
	});
}

function ie() {
	/* go on for IE in generall */
	if($.browser.msie){
	
		if($.browser.version <= 6) {
			/* take care IE 6 only */
		
			$('#lang-mod li').ieClass('lang');
			$('footer ul a[title="Newsletter"]').ieAttrClass('title');
			$('li').hover(function(){
				$(this).addClass('hover');			
			}, function(){
				$(this).removeClass('hover');			
			});
			
			$('div:first-child, li:first-child, tr:first-child, td:first-child').addClass('first-child');
			
			$('nav>ul, nav>ul>li, nav>ul>li>a, .mod>h4, #product-mod>small, .mod-sort>a').addClass('straightChild');
			$('nav>ul>li').addClass('straightChild');
			$('nav li.straightChild.act').addClass('straightChild-act');
			$('nav li.straightChild:last-child').addClass('straightChild-last-child');
			
			$('#subnav .menu li:first-child+li, .frm fieldset+fieldset, .frm2 fieldset+fieldset, .link-change+.link-compare').addClass('sibling');
		
		}
		
		if($.browser.version <= 7) {
			/* take care IE 7 & lower */
			
			$('input, button').ieClass('type');
			
			$('#subnav .menu li, footer ul li').iePseudoElement('before','|');
			$('#welcome-user-mod span').iePseudoElement('after','|');
			$('#breadcrumbs li').iePseudoElement('before','\\');
			$('.col-prods-list strong a').iePseudoElement('after','<img src="images/icon-arrow.png" />');
		
			$('#content+.user-opts').addClass('user-opts-sibling');
			$('hr').wrap('<span class="hr"></span>').hide();
			
			if($('#compare-mod table').width() > $('#compare-mod').width())
				$('#compare-mod').height($('#compare-mod').height()+20);
				
			$('.mod-sort #sort-type-citeria li:nth-child(4n)').after('<span class="clear"></span>');
		}
		
		
		$('.frm .note-success, .frm2 .note-success').corners({width: 3, height: 3});
		$('.frm .note-error, .frm2 .note-error').corners({sufix: 2, width: 3, height: 3});
		
		$('div:last-child, li:last-child, tr:last-child, td:last-child').addClass('last-child');
		$('tr:odd').addClass('odd');
		$('tr:even').addClass('even');
		
		$('nav div.child li:nth-child(4n+1), .col-prods-list li:nth-child(4n), .mod-sort #sort-type-citeria li:nth-child(4n+1)').addClass('nth-child4n');
		$('.tbl tbody tr:nth-child(2n+2)').addClass('nth-child2n');
		
		/* fieldset legend bug */
		$('fieldset').each(function(){
			_fieldset = $(this).find('legend').text();
			$(this).prepend('<span class="legend aural">'+_fieldset+'</span>');
			$(this).find('legend').remove();
		});
	
		function beforePrint(){
			$('nav, footer ul, aside').wrap('<div class="hide"></div>');
			$('header').wrap('<div class="header"></div>');
			$('aside').wrap('<div class="aside"></div>');
			$('article').wrap('<div class="article"></div>');
			$('footer').wrap('<div class="footer"></div>');
			$('section#product-mod').wrap('<div id="product-mod"></div>');
			
		}
		function afterPrint(){
			$('nav, footer ul, aside, section, header, aside, article, footer, .mod-frm').unwrap();
		}
		
		window.attachEvent('onbeforeprint', beforePrint);
		window.attachEvent('onafterprint', afterPrint);
		
	}
	
}

	/* 
	 * Load HTML5 IE set 
	 * before DOM is ready
	 */
if($.browser.msie){
	var html5Set = "abbr,article,aside,nav,canvas,footer,header,section,time".split(','),i=html5Set.length;
	while (i--){
		document.createElement(html5Set[i])
	}
}

	/* 
	 * Load jQuery sets
	 */
$(document).ready(ie);
$(document).ready(css);


	/* 
	 * jQuery extras
	 */
$.fn.extend({
	iePseudoElement: function(pseudoElem, pseudoContent) {
		if(pseudoElem == 'before')
			$(this).prepend('<span class="before">'+pseudoContent+'</span>');
		else
			$(this).append('<span class="after">'+pseudoContent+'</span>');
			
	}, // iePseudoElement	
	ieClass: function(ieAttr) {
		return this.each(function(){
			$(this).addClass($(this).attr(ieAttr));
		});
	}, // ieClass	
	ieAttrClass: function(ieAttr) {
			$(this).addClass(ieAttr);
	}, // ieAttrClass	
	ieChangeClass: function(ieAttr) {
		return this.each(function(){
			$(this).attr(ieAttr,'text').addClass($(this).attr(ieAttr));
		});
	}, // ieClass	
	unwrap: function() {
		this.parent(':not(body)').each(function(){
			$(this).replaceWith( this.childNodes );
		});
		return this;
	}, // unwrap
	clear: function(){
		return this.each(function(i){
			var val;
			
			$(this).focus(function(){ 
				val = $(this).val(); 
				$(this).attr('rel',val)
				$(this).val(''); 
			}); // focus
			
			$(this).blur(function(){ 
				val = $(this).attr('rel');
				if($(this).val() == ''){
					$(this).removeAttr('rel');
					$(this).val(val); 
				}
			});	// blur
		}); // each		
	}, // clear
	fiximage: function() {
		return this.each(function(i){	
			
			ieSrc = $(this).attr('src');
			ieSrc = fi_src.replace('.png','.gif');
			$(this).attr('src',ieSrc);
		}); // each
	}, // fiximage()
	cloud: function() {
		if($('#cloud').size() < 1)
			$('body').prepend('<div id="cloud"></div>');
		
		var cloudText;
		
		$(this).mouseover(function(e){
		

			cloudText = $(this).attr('title') || $(this).text() || $(this).children().attr('alt');
			
			$('#cloud').html('<p>'+cloudText+'</p>');
			
			$(this).attr('title','');
			
		});
		
		$(this).mousemove(function(e){
			var x, y;
			try { x = e.pageX-20; y = e.pageY-30; } // FF
			catch(e) { x = event.clientX-20; y = event.clientY-40; } // IE
		
			y = y+40+'px';
			x = x+40+'px';
			if(cloudText)
				$('#cloud').css({ display: 'block', top: y, left: x})
		});
		
		$(this).mouseout(function(e){ 
			$('#cloud').removeClass().css({ display: 'none'}); 
			cloudText = $('#cloud p').text();
			$(this).attr('title',cloudText);
		});	
	}, // cloud()
	corners: function(option) {
		option = $.extend({
			nw: 1,
			ne: 1,
			sw: 1,
			se: 1,
			sufix: 1,
			width: 5,
			height: 5,
			unit: 'px',
			border: false,
			z_index: 1
		}, option);	
		
		return this.each(function(i){	
			path = 'images/';
			
			if(option.nw)
				$(this).append('<span class="corner corner-n corner-nw"></span>');
			if(option.ne)
				$(this).append('<span class="corner corner-n corner-ne"></span>');
			if(option.sw)
				$(this).append('<span class="corner corner-s corner-sw"></span>');
			if(option.se)		
				$(this).append('<span class="corner corner-s corner-se"></span>');
			
			if(option.border == false){
				cornerBorder = parseInt($(this).css('border-width'));
				cornerBorder = cornerBorder > 0 ? '-'+cornerBorder+'px' : '0';
			}
			else
				cornerBorder = '-'+option.border+'px';
			
			
			$(this).css('position','relative').children('.corner').css({
				'position'	: 'absolute',
				'width'		: option.width + option.unit,
				'height'	: option.height + option.unit,
				'z-index'	: option.z_index,
				'background': 'url('+path+'img-cor-'+option.sufix+'.png) no-repeat 0 0'
			});
			
			
			$(this).children('.corner-nw').css({
				'top'	: cornerBorder,
				'left'	: cornerBorder,
				'background-position': '0 0'
			});
			$(this).children('.corner-ne').css({
				'top'	: cornerBorder,
				'right'	: cornerBorder,
				'background-position': '100% 0'
			});
			$(this).children('.corner-sw').css({
				'bottom': cornerBorder,
				'left'	: cornerBorder,
				'background-position': '0 100%'
			});
			$(this).children('.corner-se').css({
				'bottom': cornerBorder,
				'right'	: cornerBorder,
				'background-position': '100% 100%'
			});
			
		}); // each
	} // corners
});	

