//
function initCurated(colors,slugs){
	//MAGAZINE_SLUGS = parseMagazineSlugs(slugs);
	changeColors(colors);
	$("#pageContent").append('<img src="./assets/logo.png" id="logo" onload="curatedFadeIn(this)"/>');
	if(detectMobile()){
		//$("#logo").css({left:980});
		$("#logo").css({height:45,width:220});
	}
	$(".title1").css({cursor:"pointer"})
	$(".title1 span").css({color:COLOR_1});
	$("#linkedProjects span").css({color:COLOR_1});
	$(".title1").mouseover(function(){
		$(".title1 .blurb span").stop(true).animate({color:COLOR_MENU});
	});
	$(".title1").mouseout(function(){
		$(".title1 .blurb span").stop(true).animate({color:COLOR_1});
	});
	$("#linkedProjects div").mouseover(function(){
		$(this).children("span").stop(true).animate({color:"#FFFFFF"},150);
	});
	$("#linkedProjects div").mouseout(function(){
		$(this).children("span").stop(true).animate({color:COLOR_1},150);
	});	
	$("#linkedProjects div").css({cursor:"pointer"});
	navRightClickEvent = changeMagazinePage;
	navRightClickParam = 1;
	navLeftClickEvent = changeMagazinePage;
	navLeftClickParam = -1;
	$("#navRight").css({visibility:"visible"});
	$("#navLeft").css({visibility:"visible"});
	//$("#navLeft").css({visibility:"hidden"});
}
function curatedFadeIn(logo){
	tintPNG1(logo);
	$("#pageContent").stop(true).css({visibility:"visible",opacity:0}).delay(0).animate({opacity:1},300);
	$("#curatedTag").stop(true).css({visibility:"visible",opacity:0}).delay(0).animate({opacity:1},300);
	prelaoderVisibility(false);
}
function changeMagazinePage(param){
	var total = MAGAZINE_SLUGS.length;
	if(total > 0){
		var path = String($.address.path());
		var pathNames = $.address.pathNames();
		var hit;
		var url;
		var index;
		if(path == "" || (pathNames[0] == "curated" && pathNames.length == 2)){
			if(param < 0){
				url = MAGAZINE_SLUGS[(total-1)];
			}else{
				url = MAGAZINE_SLUGS[0];
			}
		}else{
			for(var i=0;i<total;i++){
				hit = path.split(MAGAZINE_SLUGS[i]);
				if(hit.length == 2){
					if(param < 0){
						index = i-1;
						if(index < 0){
							url = (pathNames[0] == curatedHomeSlug) ? "" : "/"+pathNames[0]+"/"+pathNames[1];
						}else{
							url = MAGAZINE_SLUGS[index];
						}
					}else{
						index = i+1;
						if(index < total){
							url = MAGAZINE_SLUGS[index];
						}else{
							url = (pathNames[0] == curatedHomeSlug) ? "" : "/"+pathNames[0]+"/"+pathNames[1];
						}
					}
					break;
				}
			}
		}
	}
	$.address.path(url);
}
function curatedFeaturedLink(arg){
	var url;
	var a;
	var b;
	var str1;
	var str2;
	for(var i=0;i<MAGAZINE_SLUGS.length;i++){
		str1 = MAGAZINE_SLUGS[i].toLowerCase();
		str2 = arg.toLowerCase();
		a = str1.length;
		b = a - str2.length;
		if(str1.substring(b,a) == str2){
			url = str1;
			break;
		}
	}
	$.address.path(url);
}
