var mp;

$(document).ready(function(){
	mp = new MavenPlayer('panews'); 
	mp.setParameter('checkSystemId','maven_system_reqs'); 
	mp.setQueryParamsAsVariables(false);

	mp.setVariable('partner', partner); //Should never change
	mp.setVariable('channel', ch); //Peform to update per channel
	mp.setVariable('subchannel', sch); //Peform to update per channel
	mp.setVariable('sschannel', ssch); //Peform to update per channel
	mp.setVariable('pagename', pg); //Peform to update per channel
	mp.setVariable('t', '0');
	mp.setVariable('l', 'non-customer');
	mp.setVariable('tile', ord); //Peform to pull from VM JS value - used to SYNC MPU
	mp.setVariable('package', '');
	mp.setVariable('vidsync', ''); //Peform to update is Ad Trafic request
	mp.setVariable('plytype', 'large'); //Peform to ensure matches player type/size  -  values small | medium | lrge

	var mvnvid = gup('mvnvid');
	var mvnpid = gup('mvnpid');
	
	if (mvnpid !== '') {
		mp.setVariable ('overridePlaylistId', mvnpid);     //Optional
	}
	
	if (mvnvid !== '') {
		mp.setVariable('MAVEN_VIDEOID', mvnvid); //Optional
	}
	
	mp.write('maven_player');

	$(document).bind('contextmenu',function(e) {
		return maven.PlayerObjectUtil.doContextMenu(); 
	});
});  

function show_maven_video(video_id) {
	mp.setVariable('MAVEN_VIDEOID',video_id);
	mp.write('maven_player');
}

function gup(name) {
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec(window.location.href);
	if (results == null) {
		return "";
	}
	else {
		return results[1];
	}
}