//COOKIE_EXPIRY_DATE = new Date();
//COOKIE_EXPIRY_DATE.setTime(COOKIE_EXPIRY_DATE.getTime() + (999 * 24 * 60 * 60 * 1000));

// Cookies
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('m.b=i(c,3,0){7(p.v>1&&(3===6||d 3!=="q")){0=m.u({},0);7(3===6){0.2=-1}7(d 0.2===\'o\'){g e=0.2,t=0.2=l r();t.z(t.C()+e)}4(n.b=[9(c),\'=\',0.j?h(3):9(h(3)),0.2?\'; 2=\'+0.2.A():\'\',0.5?\'; 5=\'+0.5:\'\',0.8?\'; 8=\'+0.8:\'\',0.f?\'; f\':\'\'].w(\'\'))}0=3||{};g a,k=0.j?i(s){4 s}:x;4(a=l y(\'(?:^|; )\'+9(c)+\'=([^;]*)\').B(n.b))?k(a[1]):6};',39,39,'options||expires|value|return|path|null|if|domain|encodeURIComponent|result|cookie|key|typeof|days|secure|var|String|function|raw|decode|new|jQuery|document|number|arguments|object|Date|||extend|length|join|decodeURIComponent|RegExp|setDate|toUTCString|exec|getDate'.split('|'),0,{}))

$.preloadImages = function(){
	for(var i = 0; i < arguments.length; i++){
		$("<img>").attr("src", arguments[i]);
	}
}
$.preloadImages("/m/ajax-loader.gif");
		
// Ctrl + arrows navigation.
$(document).keydown(function(e) {
	var link = '';
	if(e.keyCode == 0x27 && e.ctrlKey) {
		link = $('#next-link').attr('href');
	}
	if(e.keyCode == 0x25 && e.ctrlKey) {
		link = $('#previous-link').attr('href');
	}
	if (link) document.location = link;
});

$(function() {
	$(".unchosen-source").hover(function() {
		$(this).addClass("over cursor");
	}, function() {
		$(this).removeClass();
	});
	$(".chosen-source, .unchosen-source").click(function() {
		$("#logo").attr("src", "/m/ajax-loader.gif");
		window.location = $("a", $(this)).attr("href");
	});
	$("a").click(function() {
		if ($(this).attr("target") != (undefined || "_blank")) {
			$("#logo").attr("src", "/m/ajax-loader.gif");
		}
	});
	/*$("#view-type-full").click(function(){
		$.cookie('view_type', '3', {
			path: '/',
			expires: COOKIE_EXPIRY_DATE
		});
	});
	$("#view-type-text").click(function(){
		$.cookie('view_type', '2', {
			path: '/',
			expires: COOKIE_EXPIRY_DATE
		});
	});
	$("#view-type-ascetic").click(function(){
		$.cookie('view_type', '1', {
			path: '/',
			expires: COOKIE_EXPIRY_DATE
		});
	});*/
});
