function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
  {
  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
  x=x.replace(/^\s+|\s+$/g,"");
  if (x==c_name)
    {
    return unescape(y);
    }
  }
}
function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
c_value = c_value + ";path=/";
document.cookie=c_name + "=" + c_value;
}
$(document).ready(function(){
	$('#catMain').mouseenter(function(){
		$('#categoriesLinks').show();
	});
	$('#catMain').mouseleave(function(){
		$('#categoriesLinks').hide();
	});
	$('#categoriesLinks').mouseenter(function(){
		$('#categoriesLinks').show();
	});
	$('#categoriesLinks').mouseleave(function(){
		$(this).hide();
	});
	$('.close').each(function(){
		$(this).css('position','relative');
		var closeButton = document.createElement('a');
		closeButton.setAttribute('href', 'javascript:;');
		closeButton.setAttribute('style', 'position:absolute;top:0;right:5px;background:url(/images/close.png) no-repeat;width:23px;height:23px;display:block;');
		closeButton.setAttribute('title','Click to close');
		$(closeButton).click(function(){
			if($(this).parent().attr('id') == 'itseasy'){
				setCookie('itseasy','1',90);
			}
			$(this).parent().fadeOut('fast');
		});
		$(this).prepend(closeButton);
	});
	$('.zebra tr:nth-child(even)').addClass('alt')
	$('#searchInp').focus(function() {this.value='';})
	// jQuery SmoothScroll | Version 11-06-11
	$('a[href*=#]').click(function() {

		// skip SmoothScroll on links inside sliders or scroll boxes also using anchors or if there is a javascript call
		if($(this).parent().attr('class')=='scrollable_navigation' || $(this).attr('href').indexOf('javascript')>-1) return;
		
		if($(this).parent().attr('id') == 'lookBelow'){
			setCookie('lookBelow','1',7);
		}

		// duration in ms
		var duration=500;

		// easing values: swing | linear
		var easing='swing';

		// get / set parameters
		var newHash=this.hash;
		var oldLocation=window.location.href.replace(window.location.hash, '');
		var newLocation=this;
		
		// make sure it's the same location		
		if(oldLocation+newHash==newLocation)
		{
			// get target
			var target=$(this.hash+', a[name='+this.hash.slice(1)+']').offset().top;

			// adjust target for anchors near the bottom of the page
			if(target > $(document).height()-$(window).height()) target=$(document).height()-$(window).height();			
			
			// set selector
			if($.browser.safari) var animationSelector='body:not(:animated)';
			else var animationSelector='html:not(:animated)';
			
			// animate to target and set the hash to the window.location after the animation
			$(animationSelector).animate({ scrollTop: target }, duration, easing, function() {

				// add new hash to the browser location
				window.location.href=newLocation;
			});

			// cancel default click action
			return false;
		}
	});
});
