var config = {
    logging: true,
    paths: {
	dev: {
	    libPath: "/library/square_library/src/",
	    assetPath: "/data/assets/Dxstage/"
	},
	stage: {
	    libPath: "/library/square_library/build/",
	    assetPath: "/data/assets/deusexst/"
	},
	live: {
	    libPath: "/library/square_library/build/",
	    assetPath: "/data/assets/deusexpr/"
	}	
    }, 
    flowplayer: {
	enabled: true,
	controlType: "html",
	key: "#@d98aa64e1d2ee4a8ee3",
	video: {
	    play: {
		url: "images/buttons/btn_play.png",
		width: 88,
		height: 87
	    },
	    clip: {
		autoPlay: true,
		autoBuffering: true
	    },
	    plugins: {
		controls: null
	    },
	    canvas: {
		borderRadius: 10,
		backgroundGradient: 'none',
		opacity: 0.5
	    }
	}
    },
    overlays: true,
    effects: {
	enabled: true,
	items: {
	    "fb_icon_hover": {
		path: ".icons li .hover",
		type: "hover",
		target: "child",
		targetId: ".spacer",
		over: {
		    pulse: true,
		    onProperties: {
			opacity: 0.3
		    },
		    onOptions: {
			duration: 200
		    },
		    offProperties: {
			opacity: 0
		    },
		    offOptions: {
			duration: 500
		    }
		}
	    },
	    "fb_icon_tip": {
		path: ".icons li .tip",
		type: "tooltip",
		content: "alt", 
		fixed: true, 
		position: [-10,55],
		showEffect: 'slide',
		hideEffect: 'slide'
	    },
	    "fb_icons_load": {
		path: ".icons li",
		type: "call",
		func: function(context, count, success) {
		    $j(".sectionfacebook .icons").removeClass("loading");
		    setTimeout(function() {
			context.animate({
			    opacity: 1
			},{
			    duration: 300			    
			}).children("a").animate({
			    opacity: 1
			},{
			    duration: 100,
			    complete: function() {
				context.children().children(".spacer").animate({
				    opacity: 0
				},{
				    duration: 200
				})
			    }			    
			})
		    }, 50*count)
		}
	    },
	    "fb_icons_unload": {
		path: ".icons li",
		type: "call",
		func: function(context, count, success) {
		    setTimeout(function() {
			context.children("a").animate({
			    opacity: 0
			},{
			    duration: 100,
			    complete: context.animate({
				opacity: 0
			    },{
				duration: 300,
				complete: function() {
				    if(success && count==($j(".icons li").length-1)) {
					$j(".sectionfacebook .icons").addClass("loading");
					success.call();
				    }
				}			    
			    })
			})
		    }, 50*count)
		}
	    }
	}
    },
    facebook: {
	enabled: true,
	app_id: "217215304955205",
	onLike: function() {
	    site.pringo.loadPringoObject("facebook_campaign", null, ".campaign", function() {
		site.effects.disableEffect("fb_icon_hover");
		site.effects.disableEffect("fb_icon_tip");
		site.effects.reloadEffects();
		site.pringo.loadLinks();		
		$j(".phase4").click();
	    });
	}
    },
    pringo: {
	enabled: true,
	items: {
	    "video": {
		"type": "json",
		"pre" : function(success) {
		    site.flowplayer.unloadVideo("videoplayer");
		    $j('#viewer .preloader').height($j('#viewer .videoplayer').height());
		    $j('#viewer .videoplayer').fadeOut('fast', function() {
			$j('#viewer .preloader').fadeIn('fast', success.call());
		    });
		},
		"func": "square_videos/get",
		"post":function(data){
		    var image = new Image();

		    image.onload = function() {
			$j('#viewer .videoplayer').css('background-image', 'url('+image.src+')');
			$j('#viewer .preloader').fadeOut('fast', function() {
			    $j('#viewer .videoplayer').fadeIn('fast', function() {
				$j('#viewer h3').html(data["name"]);
				$j('#viewer .quicktime').attr("href", data["links_array"]["mov"]);
				$j('#viewer .windows').attr("href", data["links_array"]["wmv"]);
				$j('#hdvideo h3').html(data["name"]);
				$j('.overlaytrigger').attr("target", data["links_array"]["720"]);
				site.flowplayer.setVideo("videoplayer", data["links_array"]["480"]);
				//site.videos.setVideo("hdvideoplayer", data["links_array"]["720"]);
				//site.videos.playerStatus();
				site.overlays.loadOverlays();
			    });
			});
		    }

		    image.src = data["medium_screenshot_src"];
		},
		"key" : "VIDEO_ID"
	    },
	    "image": {
		"type": "json",
		"pre" : function(success) {
		    $j('#viewer .preloader').height($j('#viewer img').height());
		    $j('#viewer img').fadeOut('fast', function() {
			$j('#viewer .preloader').fadeIn('fast', function() {
			    success.call();
			})
		    } );
		},
		"func": "square_images/get",
		"post":function(data){
		    var image = new Image();

		    image.onload = function() {
			$j('#viewer img').attr('src', image.src);
			//$j('#viewer a').attr('href', data["large_large_src"]);
			$j('#viewer a').attr('target', "/?func=object&object=get_image&IMAGE_ID="+data["IMAGE_ID"]);

			$j('#viewer .preloader').fadeOut('fast', function() {
			    $j('#viewer .preloader').height(0);
			    $j('#viewer img').fadeIn('fast', function() {
				$j('#viewer h3').html(data["name"]);
				$j('#viewer a').attr('alt', data["name"]);
				$j('#viewer a').attr('title', data["name"]);
			    //$j('a.lightbox').lightBox();
			    });
			});
		    }

		    image.src = data["medium_medium_src"];
		},
		"key" : "IMAGE_ID"
	    },
	    "wallpaper": {
		"type": "json",
		"pre" : function(success) {
		    $j('#viewer .preloader').height($j('#viewer img').height());
		    $j('#viewer img').fadeOut('fast', function() {
			$j('#viewer .preloader').fadeIn('fast', function() {
			    success.call();
			})
		    } );
		},
		"func": "square_images/get",
		"post":function(data){
		    var image = new Image();

		    image.onload = function() {
			$j('#viewer img').attr('src', image.src);

			$j('#viewer .preloader').fadeOut('fast', function() {
			    $j('#viewer .preloader').height(0);
			    $j('#viewer img').fadeIn('fast', function() {
				$j('#viewer h3').html(data["name"]);
				$j('#wp1280').attr('href', "/?func=square_images/download&IMAGE_ID="+data["IMAGE_ID"]+"&size=medium");
				$j('#wp1600').attr('href', "/?func=square_images/download&IMAGE_ID="+data["IMAGE_ID"]+"&size=large");
				$j('#wp1920').attr('href', "/?func=square_images/download&IMAGE_ID="+data["IMAGE_ID"]+"&size=xlarge");
				$j('#iPhone').attr('href', "/?func=square_images/download&IMAGE_ID="+data["IMAGE_ID"]+"&size=medium");
				$j('#iPhone4').attr('href', "/?func=square_images/downloadget&IMAGE_ID="+data["IMAGE_ID"]+"&size=large");
			    });
			});
		    }

		    image.src = data["small_small_src"];
		},
		"key" : "IMAGE_ID"
	    },
	    "youtube": {
		"type": "json",
		"pre" : function(success) {
		    site.flowplayer.unloadVideo("videoplayer");
		    success.call();
		},
		"func": "square_videos/get",
		"post":function(data){
		    $j('#viewer h3').html(data["name"]);
		    site.flowplayer.setVideo("videoplayer", "api:"+data["link_youtube"], true);
		},
		"key" : "VIDEO_ID"
	    },
	    "unlock": {
		"type": "html",
		"pre" : function(success) {
		    $j(".sectionfacebook .preview .content").animate({
			opacity: 0
		    }, {
			duration: 200, 
			complete: function() {
			    $j(".sectionfacebook .preview .panel").animate({
				left: -280
			    }, {
				duration: 300, 
				complete: function() {
				    $j(".sectionfacebook .preview").addClass("loading");
				    success.call();
				}
			    });
			}
		    });
		
		},
		"func": "object&object=fb_c_selected_unlock",
		"post": function(data){
		    $j(".sectionfacebook .preview").removeClass("loading");
		    $j(".sectionfacebook .preview .content").html(data);
		    site.overlays.loadOverlays();
		    $j(".sectionfacebook .preview .panel").animate({
			left: 0
		    }, {
			duration: 300,
			complete: function() {
			    $j(".sectionfacebook .preview .content").animate({
				opacity: 1
			    }, {
				duration: 200
			    });
			}
		    });
		},
		"key" : "FBCU_ID",
		"select" : true
	    },
	    "lock": {
		"type": "html",
		"pre" : function(success) {
		    $j(".sectionfacebook .preview .content").animate({
			opacity: 0
		    }, {
			duration: 200, 
			complete: function() {
			    $j(".sectionfacebook .preview .panel").animate({
				left: -280
			    }, {
				duration: 300, 
				complete: function() {
				    $j(".sectionfacebook .preview").addClass("loading");
				    success.call();
				}
			    });
			}
		    });
		
		},
		"func": "object&object=fb_c_locked",
		"post": function(data){
		    $j(".sectionfacebook .preview").removeClass("loading");
		    $j(".sectionfacebook .preview .content").html(data);
		    $j(".sectionfacebook .preview .panel").animate({
			left: 0
		    }, {
			duration: 300,
			complete: function() {
			    $j(".sectionfacebook .preview .content").animate({
				opacity: 1
			    }, {
				duration: 200
			    });
			}
		    });
		},
		"key" : "FBCU_ID"
	    },	
	    "phase" : {
		"type": "html",
		"pre" : function(success) {
		    if($j(".icons li").length>0) {
			site.effects.effects["fb_icons_unload"].exec("fb_icons_unload", success);
		    } else {
			success.call();
		    }
		},
		"func": "object&object=facebook_campaign_unlocks",
		"post": function(data){
		    $j(".icons ul").html(data);
		    site.effects.disableEffect("fb_icon_hover");
		    site.effects.disableEffect("fb_icon_tip");
		    site.effects.reloadEffects();
		    site.pringo.loadLinks();		
		    $j(".icons li").each(function(i) {
			if($j(this).children("a").hasClass("pringo-item-lock") && $j(this).prev().children("a").hasClass("pringo-item-unlock")) {
			    $j(".icons li").removeClass("selected_icon");
			    $j(this).prev().addClass("selected_icon");
			    $j(this).prev().children("a").click();
			}
	
			if(i==($j(".icons li").length-1) && $j(this).children("a").hasClass("pringo-item-unlock")) {
			    $j(".icons li").removeClass("selected_icon");
			    $j(this).addClass("selected_icon");
			    $j(this).children("a").click();
			}	
		    });
		
		    site.effects.effects["fb_icons_load"].exec("fb_icons_load");   
		},
		"key" : "start",
		"select" : true
	    }
	}	
    },
    localExec : {
	enabled: true,
	functions: [ function() {
	    //start_countdown();
	}, function() {
	    $j(".phase4").click();
	} ]
    },
    jplayer: {
	enabled: true,
	audio: {
	    
	}
    }
}
