$(document).ready(function(){
	if ($("#info").html()) $("#info").show();
	if ($("#error").html()) $("#error").show();
	$("a[href*='http://']:not([href*='"+location.hostname+"'])").each(function(){
		var href = $(this).attr("href");
		var cat = $(this).attr("linkType");
		if(!href.match("bestkeptstations.org.uk") && !href.match("gettinghere.co.uk") && !href.match("cheshirebytrain.co.uk") && !href.match("gocheshire.co.uk")){
			$(this).attr("target","_blank");
			$(this).click(function(){trackClick(cat,href);});
		} else {
			//if(location.href.match("sandbox.") || location.href.match("test.") || location.href.match("local")){
				//if ($(this).attr("href").match("www.cheshirebytrain")){$(this).attr("href",$(this).attr("href").replace("www","sandbox"));}
				//if ($(this).attr("href").match("www.gocheshire")){$(this).attr("href",$(this).attr("href").replace("www","sandbox"));}
				//if ($(this).attr("href").match("www.gettinghere")){$(this).attr("href",$(this).attr("href").replace("www","test"));}
				//}
			}
		});
	$("*").live("contextmenu",function(e){return false;});   

	$(".nav li a:last").css({"border-right": 0});
	$(".dropdown").each(function(){
	$(this).find("li:last").css({"border-bottom":0});
	$(this).parent().eq(0).hoverIntent({
		timeout: 100,
		over: function(){
			var current = $('.dropdown:eq(0)',this);
			current.slideDown(200);
		}, out: function(){
			var current = $('.dropdown:eq(0)',this);
			current.fadeOut(200);
			}
		});
	});
		
	$("a[href*='.pdf']").each(function(){$(this).attr("href","http://www.gettinghere.co.uk/pdf-fix.php?file="+$(this).attr("href"));});

	$("ul.dropdown").find("li:last").addClass("last");
	$("ul.dropdown").css({width:"180px"});
	$(".slider").myImageFader();
	
//$(".mcs_container").mCustomScrollbar("vertical",900,"easeOutCirc",1.05,"auto","yes","no",0);
		
	$(".newsjc").jCarouselLite({
		vertical: true,
		auto:4000,
		speed:1000,
		circular: true,
		visible: 1
		});  
		
/* function to fix the -10000 pixel limit of jquery.animate */
$.fx.prototype.cur = function(){
    if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
      return this.elem[ this.prop ];
		}
    var r = parseFloat( jQuery.css( this.elem, this.prop ) );
    return typeof r == 'undefined' ? 0 : r;
	}	
});

/* code to handle cookies */
/* code to handle cookies */
function set_cookie(c_name,value){
	var path = "/";
	var expiredays = 999;
	var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);document.cookie=c_name+"="+escape(value)+
((expiredays==null)?"":";expires="+exdate.toUTCString()+";path=" + path);
}
function get_cookie(c_name){
	if(document.cookie.length>0)
	{c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1)
	{c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}}
	return"";
}
function trackClick(category, action){
	if (category == undefined){ category = "Outbound Link";}
	var pageTracker = _gat._getTracker("UA-3102265-26");
	pageTracker._trackEvent(category, action);
	}
	

