// JavaScript Document
//NAMESPACE EVERYTHING IN THIS FILE Module
var Module = {};
Module.OnDemandLanding = {};
Module.OnDemandLanding.module_content_1;
Module.OnDemandLanding.module_content_2;
Module.OnDemandLanding.module_content_3;
Module.OnDemandLanding.module_content_4;
Module.OnDemandLanding.module_content_5;
Module.OnDemandLanding.build_mod_1=function(){
	if(Module.OnDemandLanding.module_content_1.type == 'takeover'){
		if(Module.OnDemandLanding.module_content_1.content){
			$('bottomLeftModule1').update(Module.OnDemandLanding.module_content_1.content);
		}else if(Module.OnDemandLanding.module_content_1.takeover_type == 'new'){
			Module.OnDemandLanding.module_1 = new New_Module($('bottomLeftModule1'), 'landing_left', Module.OnDemandLanding.module_content_1.artist_id, Module.OnDemandLanding.module_content_1.loc_id);
		}else if(Module.OnDemandLanding.module_content_1.takeover_type == 'vod'){
			Module.OnDemandLanding.module_1 = new VOD_Module($('bottomLeftModule1'), 'landing_left', Module.OnDemandLanding.module_content_1.track_id, Module.OnDemandLanding.module_content_1.pic, Module.OnDemandLanding.module_content_1.teaser);
		}else if(Module.OnDemandLanding.module_content_1.takeover_type == 'news'){
			Module.OnDemandLanding.module_1 = new NEWS_MODULE($('bottomLeftModule1'), 'landing_left');
		}else if(Module.OnDemandLanding.module_content_1.takeover_type == 'highlights'){
			Module.OnDemandLanding.module_1 = new PROGRAM_Module($('bottomLeftModule1'), Module.OnDemandLanding.module_content_1.takeover_type, false, Module.OnDemandLanding.module_content_1.highlights, false, false);
		}else if(Module.OnDemandLanding.module_content_1.takeover_type == 'cover'){
			Module.OnDemandLanding.module_1 = new PROGRAM_Module($('bottomLeftModule1'), Module.OnDemandLanding.module_content_1.takeover_type, Module.OnDemandLanding.module_content_1.takeover_program, false, Module.OnDemandLanding.module_content_1.apid, Module.OnDemandLanding.module_content_1.mid);
		}else{
			$('bottomLeftModule1').hide();
		}
	}else{
		Module.OnDemandLanding.module_1 = new NCDB_Module($('bottomLeftModule1'), 'landing_left', Module.OnDemandLanding.module_content_1.type, Module.OnDemandLanding.module_content_1.artist_program_id, Module.OnDemandLanding.module_content_1.media_id);
	}
};
Module.OnDemandLanding.build_mod_2=function(){
	if(Module.OnDemandLanding.module_content_2.type == 'takeover'){
		if(Module.OnDemandLanding.module_content_2.content){
			$('bottomLeftModule2').update(Module.OnDemandLanding.module_content_2.content);
		}else if(Module.OnDemandLanding.module_content_2.takeover_type == 'new'){
			Module.OnDemandLanding.module_2 = new New_Module($('bottomLeftModule2'), 'landing_left', Module.OnDemandLanding.module_content_2.artist_id, Module.OnDemandLanding.module_content_2.loc_id);
		}else if(Module.OnDemandLanding.module_content_2.takeover_type == 'vod'){
			Module.OnDemandLanding.module_2 = new VOD_Module($('bottomLeftModule2'), 'landing_left', Module.OnDemandLanding.module_content_2.track_id, Module.OnDemandLanding.module_content_2.pic, Module.OnDemandLanding.module_content_2.teaser);
		}else if(Module.OnDemandLanding.module_content_2.takeover_type == 'news'){
			Module.OnDemandLanding.module_2 = new NEWS_MODULE($('bottomLeftModule2'), 'landing_left');
		}else if(Module.OnDemandLanding.module_content_2.takeover_type == 'highlights'){
			Module.OnDemandLanding.module_2 = new PROGRAM_Module($('bottomLeftModule2'), Module.OnDemandLanding.module_content_2.takeover_type, false, Module.OnDemandLanding.module_content_2.highlights, false, false);
		}else if(Module.OnDemandLanding.module_content_2.takeover_type == 'cover'){
			Module.OnDemandLanding.module_2 = new PROGRAM_Module($('bottomLeftModule2'), Module.OnDemandLanding.module_content_2.takeover_type, Module.OnDemandLanding.module_content_2.takeover_program, false, Module.OnDemandLanding.module_content_2.apid, Module.OnDemandLanding.module_content_2.mid);
		}else{
			$('bottomLeftModule2').hide();
		}
	}else{
		Module.OnDemandLanding.module_2 = new NCDB_Module($('bottomLeftModule2'), 'landing_left', Module.OnDemandLanding.module_content_2.type, Module.OnDemandLanding.module_content_2.artist_program_id, Module.OnDemandLanding.module_content_2.media_id);
	}
};
Module.OnDemandLanding.build_mod_3=function(){
	if(Module.OnDemandLanding.module_content_3.type == 'takeover'){
		if(Module.OnDemandLanding.module_content_3.content){
			$('bottomMiddleModule1').update(Module.OnDemandLanding.module_content_3.content);
		}else if(Module.OnDemandLanding.module_content_3.takeover_type == 'new'){
			Module.OnDemandLanding.module_3 = new New_Module($('bottomMiddleModule1'), 'landing_list', Module.OnDemandLanding.module_content_3.artist_id, Module.OnDemandLanding.module_content_3.loc_id);
		}else if(Module.OnDemandLanding.module_content_3.takeover_type == 'vod'){
			Module.OnDemandLanding.module_3 = new VOD_Module($('bottomMiddleModule1'), 'landing_list', Module.OnDemandLanding.module_content_3.track_id, Module.OnDemandLanding.module_content_3.pic, Module.OnDemandLanding.module_content_3.teaser);
		}else if(Module.OnDemandLanding.module_content_3.takeover_type == 'news'){
			Module.OnDemandLanding.module_3 = new NEWS_MODULE($('bottomMiddleModule1'), 'landing_list');
		}else if(Module.OnDemandLanding.module_content_3.takeover_type == 'highlights'){
			Module.OnDemandLanding.module_3 = new PROGRAM_Module($('bottomMiddleModule1'), Module.OnDemandLanding.module_content_3.takeover_type, false, Module.OnDemandLanding.module_content_3.highlights, false, false);
		}else if(Module.OnDemandLanding.module_content_3.takeover_type == 'cover'){
			Module.OnDemandLanding.module_3 = new PROGRAM_Module($('bottomMiddleModule1'), Module.OnDemandLanding.module_content_3.takeover_type, Module.OnDemandLanding.module_content_3.takeover_program, false, Module.OnDemandLanding.module_content_3.apid, Module.OnDemandLanding.module_content_3.mid);
		}else{
			$('bottomMiddleModule1').hide();
		}
	}else if(Module.OnDemandLanding.module_content_3.type == 'upcoming'){
			Module.OnDemandLanding.module_3 = new PROGRAM_Module($('bottomMiddleModule1'), Module.OnDemandLanding.module_content_3.type, Module.OnDemandLanding.module_content_3.program_id, false, Module.OnDemandLanding.module_content_3.artist_program_id, Module.OnDemandLanding.module_content_3.media_id);
	}else{
		Module.OnDemandLanding.module_3 = new PROGRAM_Module($('bottomMiddleModule1'), 'list', Module.OnDemandLanding.module_content_3.type, false, Module.OnDemandLanding.module_content_3.artist_program_id, Module.OnDemandLanding.module_content_3.media_id);
	}
};
Module.OnDemandLanding.build_mod_4=function(){
	if(Module.OnDemandLanding.module_content_4.type == 'takeover'){
		if(Module.OnDemandLanding.module_content_4.content){
			$('bottomMiddleModule2').update(Module.OnDemandLanding.module_content_4.content);
		}else if(Module.OnDemandLanding.module_content_4.takeover_type == 'new'){
			Module.OnDemandLanding.module_4 = new New_Module($('bottomMiddleModule2'), 'landing_list', Module.OnDemandLanding.module_content_4.artist_id, Module.OnDemandLanding.module_content_4.loc_id);
		}else if(Module.OnDemandLanding.module_content_4.takeover_type == 'vod'){
			Module.OnDemandLanding.module_4 = new VOD_Module($('bottomMiddleModule2'), 'landing_list', Module.OnDemandLanding.module_content_4.track_id, Module.OnDemandLanding.module_content_4.pic, Module.OnDemandLanding.module_content_4.teaser);
		}else if(Module.OnDemandLanding.module_content_4.takeover_type == 'news'){
			Module.OnDemandLanding.module_4 = new NEWS_MODULE($('bottomMiddleModule2'), 'landing_list');
		}else if(Module.OnDemandLanding.module_content_4.takeover_type == 'highlights'){
			Module.OnDemandLanding.module_4 = new PROGRAM_Module($('bottomMiddleModule2'), Module.OnDemandLanding.module_content_4.takeover_type, false, Module.OnDemandLanding.module_content_4.highlights, false, false);
		}else if(Module.OnDemandLanding.module_content_4.takeover_type == 'cover'){
			Module.OnDemandLanding.module_4 = new PROGRAM_Module($('bottomMiddleModule2'), Module.OnDemandLanding.module_content_4.takeover_type, Module.OnDemandLanding.module_content_4.takeover_program, false, Module.OnDemandLanding.module_content_4.apid, Module.OnDemandLanding.module_content_4.mid);
		}else{
			$('bottomMiddleModule2').hide();
		}
	}else{
		Module.OnDemandLanding.module_4 = new PROGRAM_Module($('bottomMiddleModule2'), 'list', Module.OnDemandLanding.module_content_4.type, false, Module.OnDemandLanding.module_content_4.artist_program_id, Module.OnDemandLanding.module_content_4.media_id);
	}
};
Module.OnDemandLanding.init = function(){
	try{
		Module.OnDemandLanding.module_content_1 = new CPS_Query('od_landing_1');
		Module.OnDemandLanding.module_content_2 = new CPS_Query('od_landing_2');
		Module.OnDemandLanding.module_content_3 = new CPS_Query('od_landing_3');
		Module.OnDemandLanding.module_content_4 = new CPS_Query('od_landing_4');
		Module.OnDemandLanding.module_content_1.eventManager.attachEventHandler( "module_loaded", Module.OnDemandLanding.build_mod_1);
		Module.OnDemandLanding.module_content_2.eventManager.attachEventHandler( "module_loaded", Module.OnDemandLanding.build_mod_2);
		Module.OnDemandLanding.module_content_3.eventManager.attachEventHandler( "module_loaded", Module.OnDemandLanding.build_mod_3);
		Module.OnDemandLanding.module_content_4.eventManager.attachEventHandler( "module_loaded", Module.OnDemandLanding.build_mod_4);
		Module.OnDemandLanding.module_content_1.eventManager.attachEventHandler( "module_null", function(){$('bottomLeftModule1').hide();});
		Module.OnDemandLanding.module_content_2.eventManager.attachEventHandler( "module_null", function(){$('bottomLeftModule2').hide();});
		Module.OnDemandLanding.module_content_3.eventManager.attachEventHandler( "module_null", function(){$('bottomMiddleModule1').hide();});
		Module.OnDemandLanding.module_content_4.eventManager.attachEventHandler( "module_null", function(){$('bottomMiddleModule2').hide();});
	}catch(e){
		alert(e.message);
		setTimeout(function(){Module.OnDemandLanding.init();}, 10);	
	}
}
Module.OnDemandLanding.init();