var http_radio = getHTTPObject();
var http = getHTTPObject();
//-------------------------------------------------------------------------------------
  function getHTTPObject()
  {
    var xmlhttp;
    try{xmlhttp = new XMLHttpRequest(); /* e.g. Firefox */}
    catch(e)
    {
      try{xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");  /* some versions IE */}
      catch (e)
      {
        try{xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");  /* some versions IE */}
        catch (e)
        {
          xmlhttp = false;
        }
      }
    }
    return xmlhttp;
  }
var mediaRequest;
function getGeoBlock(clientId,vars){
	mediaRequest = vars + clientId;
	var myRandom=parseInt(Math.random()*99999999);  // cache buster
	var url="includes/geoservice.php?clientId="+clientId+ "&rand=" + myRandom;
    http.open("GET", url, true);
    http.onreadystatechange = returnPermission;
    http.send(null);	
}

function returnPermission(){
	if (http.readyState == 4){
		//alert(http.responseText);
		if(http.responseText == "1"){
			getPlayer(mediaRequest);
		}else{
			window.document.location.href = "http://admin.globaldigitalbroadcast.com/blocked.php";
		}
	}
}

function getPlayer(vars){
    var myRandom=parseInt(Math.random()*99999999);  // cache buster
	var url="getPlayer.php" + "?rand=" + myRandom + vars;
    http.open("GET", url, true);
    http.onreadystatechange = showPlayer;
    http.send(null);
  }
  
 function showPlayer()
 {
 	if (http.readyState == 4){
	  //alert("show player  " + http.responseText);
	  window.document.getElementById("thePlayer").innerHTML = http.responseText;
	  
    }
 }
 
 //JAY//
 function getPlayerTrailer(vars){
    var myRandom=parseInt(Math.random()*99999999);  // cache buster
	var url="getPlayer.php" + "?rand=" + myRandom + vars;
    http.open("GET", url, true);
    http.onreadystatechange = showPlayerTrailer;
    http.send(null);
  }
  
 function showPlayerTrailer()
 {
 	if (http.readyState == 4){
	  //alert("show player  " + http.responseText);
	  parent.document.getElementById("thePlayer").innerHTML = http.responseText;
    }
 }
 //JAY//

var playstatetimer = true;
 
var psto=setTimeout('setplaystate()',30000); 
 
function setplaystate()
{
 playstatetimer = false;
 clearTimeout(psto);
}


var xmlHttp;
var myRandomNo;

function genRandomNo(){
myRandomNo = parseInt(Math.random()*99999999999);
}

function updateStats(str1,str2,str3)
{
	genRandomNo();
	xmlHttp=getHTTPObject()
	var url="../includes/updateDb.php?rand="+myRandomNo+"&s="+str1+"&p="+str2+"&c="+str3;
	xmlHttp.onreadystatechange=statsUpdated;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function statsUpdated() 
{ 
if (xmlHttp.readyState==4)
{ 
//do nothing
}
}

function updateSched(str)
{
	genRandomNo();
	xmlHttp=getHTTPObject()
	var url="f.channel.php?rand="+myRandomNo+"&id="+str;
	//alert(url);
	//url=url+"?q="+str;
	//url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=schedUpdated;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function returnToListing()
{
	var nameCheck = parent.document.getElementById('clientSchedListId').value;
	if (nameCheck!=""){	
		schedAddCheck = "";
		updateSched(nameCheck);
		//schedAddCheck = clientUrl;
	}
}

var clientUrl;
var returnTime=7000;

function schedUpdated() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		var framediv = parent.document.getElementById('schedList1');
		framediv.innerHTML=xmlHttp.responseText;
		if (schedAddCheck == "")
		{
			schedAddCheck = clientUrl;
			framediv = document.getElementById('translucentbkg');
			//framediv = window.frames[0].document.getElementById('translucentbkg');
			framediv.innerHTML=xmlHttp.responseText;
			//schedAddCheck = clientUrl + "/f.channel.php?id=" + parent.document.getElementById('clientSchedListId').value + "&play=1";
			//schedAddCheck = "off";
			//alert(schedAddCheck);
		}/*else
		{
			//if ((schedAddCheck == clientUrl + "/f.channel.php?id=" + jsGET('s') + "&play=1")
			//if ((window.frames['contentframe'].document.location.href != "https://secure2.globaldigitalbroadcast.com/ghanalifetv/f.mylogin.php") && (window.frames['contentframe'].document.location.href != "https://secure2.globaldigitalbroadcast.com/ghanalifetv/f.myaccount.php"))
			//{
				//alert(schedAddCheck);
				//framediv = window.frames['contentframe'].document.getElementById('translucentbkg');
				//framediv.innerHTML=xmlHttp.responseText;
				
			//}else{alert(schedAddCheck);}
		}*/
		//schedAddCheck = clientUrl + "/f.channel.php?id=" + jsGET('s') + "&play=1";
	}
}

function jsGET(variable){
var $_GET = new Object();
var $qry_str = location.search.substring(1);
var $k = 0;
//check there is a '=' in the string, if not exit.
if($qry_str.indexOf('=') < 1){
return false;
}
	do {
		$_GET[$qry_str.split("=")[0].replace(/&/, "")] = $qry_str.split("=")[1].split(/&|$/)[0];
		$qry_str = $qry_str.split($qry_str.split("=")[1].split(/&|$/)[0])[1];
		$k ++;
	} while($k < (location.search.split("=").length - 1));
	
	for(key in $_GET){
	if (key==variable){
	   return $_GET[key];
		} else {
	   	return false;
	   }
	}
}

var progMemory=0;

function doPlayState(oldState,newState,clientSchedId,thisclientid)
{
 if (!playstatetimer)
 {
  var outResp = "";
  switch (oldState) 
  {
    case 10 : outResp="Player Ready"; break;
    case 9 : outResp="Transitioning..."; break;
    case 8 : outResp="Media Ended"; break;
    case 7 : outResp="Waiting..."; break;
    case 6 : outResp="Buffering..."; break;
    case 5 : outResp="Rewind..."; break;
    case 4 : outResp="Fast Forward..."; break;
    case 3 : outResp="Playing..."; break;
    case 2 : outResp="Paused"; break;
    case 1 : outResp="Stopped"; break;
  }
  if (oldState == 9)
  {
	if (jsGET('s')){ //its a schedule.
		var framediv;
		framediv = parent.document.getElementById('theprogramme');
		//window.frames['contentframe'].document.getElementById('theprogramme');
		/*find value from within player.php */ //alert(parent.document.getElementById('schedList1').value);
		if((progMemory!=framediv.value)||(progMemory==0))
		{
			progMemory=framediv.value;
			updateStats(jsGET('s'),framediv.value,thisclientid);
		}
		updateSched(jsGET('s'));
	}
	if (jsGET('h')){ //its a PPV
		updateStats(clientSchedId,channelPlaying,thisclientid);
		getNextProg();
	}
  }else if (oldState == 8)
  {
	if (jsGET('h')){
		updateStats(clientSchedId,channelPlaying,thisclientid);
		//getNextProg();
		document.location.href = "player.php";
	}
	if (jsGET('s')){
		document.location.href = "player.php?s=" + jsGET('s');
	}
  }
 }
}

var channelPlaying;
setTimeout('getFirstProgId()', 20000);

function getNextProg()
{
 setTimeout('getFirstProgId()', 20000);
}

function getFirstProgId()
{
 if (jsGET('h'))
 {
	 try{channelPlaying = document.getElementById('mediaplayer1').className;}
	 catch(e){/* do nothing */}
 }
 if (jsGET('s'))
 {
	 try{parent.document.getElementById('theprogramme').value = window.frames['contentframe'].document.getElementById('theprogramme').value;}
	 catch(e){/*do nothing*/}
 }
}

//---------TAKEN FROM BUTTONS . JS-----------------------------//////////////

// JavaScript Document
var tabs = new Array("channels", "features", "search", "myaccount");
channelstab = 1;
featurestab = 0;
searchtab = 0;
myaccounttab = 0;

function setZero(){//set all tabs to 'off'
channelstab = 0;
featurestab = 0;
searchtab = 0;
myaccounttab = 0;
}
function channelpage(ses) {
	if(ses!=null && ses!=''){
		window.frames[0].location.href="f.channels.php?ses="+ses;
	}else{//not logged in
		window.frames[0].location.href="f.channels.php";
	}
	setZero();
	channelstab=1;
}
function dosearch(ses) {
	if(ses!=null && ses!=''){
		window.frames[0].location.href="f.search.php?ses="+ses;
	}else{
		window.frames[0].location.href="f.search.php";	
	}
	setZero();
	searchtab = 1;
}
function featurespage(ses) {
	if(ses!=null && ses!=''){
		window.frames[0].location.href="f.features.php?ses="+ses;
	}else{
		window.frames[0].location.href="f.features.php";
	}
	setZero();
	featurestab = 1;
}
function myaccountpage(ses) {
	if(ses!=null && ses!=''){
		window.frames[0].location.href="https://secure2.globaldigitalbroadcast.com/ghanalifetv/f.myaccount.php?ses="+ses;
	}else{
		window.frames[0].location.href="https://secure2.globaldigitalbroadcast.com/ghanalifetv/f.myaccount.php";
	}
	setZero();
	myaccounttab=1;
}
function imgOn(imgName) {
	if (document.images) {
		document[imgName].src = "images/buttons/" + imgName + "Off.gif";
	}
}
function imgOff(imgName) {
	if (document.images) {
		document[imgName].src = "images/buttons/" + imgName + "On.gif";
		for(var i=0; i<tabs.length;i++) {
		if(eval(tabs[i] + "tab")==1) {
			document[tabs[i]].src = "images/buttons/" + tabs[i] + "Off.gif";
		} else {
			document[tabs[i]].src = "images/buttons/" + tabs[i] + "On.gif";		
			}
		}
	}
}




// Browser Detect  v2.1.6
// documentation: http://www.dithered.com/javascript/browser_detect/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)

function BrowserDetect() {
   var ua = navigator.userAgent.toLowerCase(); 

   // browser engine name
   this.isGecko       = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1);
   this.isAppleWebKit = (ua.indexOf('applewebkit') != -1);

   // browser name
   this.isKonqueror   = (ua.indexOf('konqueror') != -1); 
   this.isSafari      = (ua.indexOf('safari') != - 1);
   this.isOmniweb     = (ua.indexOf('omniweb') != - 1);
   this.isOpera       = (ua.indexOf('opera') != -1); 
   this.isIcab        = (ua.indexOf('icab') != -1); 
   this.isAol         = (ua.indexOf('aol') != -1); 
   this.isIE          = (ua.indexOf('msie') != -1 && !this.isOpera && (ua.indexOf('webtv') == -1) ); 
   this.isMozilla     = (this.isGecko && ua.indexOf('gecko/') + 14 == ua.length);
   this.isFirebird    = (ua.indexOf('firebird/') != -1);
   this.isNS          = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && !this.isOpera && !this.isSafari && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
   
   // spoofing and compatible browsers
   this.isIECompatible = ( (ua.indexOf('msie') != -1) && !this.isIE);
   this.isNSCompatible = ( (ua.indexOf('mozilla') != -1) && !this.isNS && !this.isMozilla);
   
   // rendering engine versions
   this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );
   this.equivalentMozilla = ( (this.isGecko) ? parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) ) : -1 );
   this.appleWebKitVersion = ( (this.isAppleWebKit) ? parseFloat( ua.substring( ua.indexOf('applewebkit/') + 12) ) : -1 );
   
   // browser version
   this.versionMinor = parseFloat(navigator.appVersion); 
   
   // correct version number
   if (this.isGecko && !this.isMozilla) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('/', ua.indexOf('gecko/') + 6) + 1 ) );
   }
   else if (this.isMozilla) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) );
   }
   else if (this.isIE && this.versionMinor >= 4) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
   }
   else if (this.isKonqueror) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) );
   }
   else if (this.isSafari) {
      this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('safari/') + 7 ) );
   }
   else if (this.isOmniweb) {
      this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('omniweb/') + 8 ) );
   }
   else if (this.isOpera) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera') + 6 ) );
   }
   else if (this.isIcab) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab') + 5 ) );
   }
   
   this.versionMajor = parseInt(this.versionMinor); 
   
   // dom support
   this.isDOM1 = (document.getElementById);
   this.isDOM2Event = (document.addEventListener && document.removeEventListener);
   
   // css compatibility mode
   this.mode = document.compatMode ? document.compatMode : 'BackCompat';

   // platform
   this.isWin    = (ua.indexOf('win') != -1);
   this.isWin32  = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1 || ua.indexOf('xp') != -1) );
   this.isMac    = (ua.indexOf('mac') != -1);
   this.isUnix   = (ua.indexOf('unix') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1)
   this.isLinux  = (ua.indexOf('linux') != -1);
   
   // specific browser shortcuts
   this.isNS4x = (this.isNS && this.versionMajor == 4);
   this.isNS40x = (this.isNS4x && this.versionMinor < 4.5);
   this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7);
   this.isNS4up = (this.isNS && this.versionMinor >= 4);
   this.isNS6x = (this.isNS && this.versionMajor == 6);
   this.isNS6up = (this.isNS && this.versionMajor >= 6);
   this.isNS7x = (this.isNS && this.versionMajor == 7);
   this.isNS7up = (this.isNS && this.versionMajor >= 7);
   
   this.isIE4x = (this.isIE && this.versionMajor == 4);
   this.isIE4up = (this.isIE && this.versionMajor >= 4);
   this.isIE5x = (this.isIE && this.versionMajor == 5);
   this.isIE55 = (this.isIE && this.versionMinor == 5.5);
   this.isIE5up = (this.isIE && this.versionMajor >= 5);
   this.isIE6x = (this.isIE && this.versionMajor == 6);
   this.isIE6up = (this.isIE && this.versionMajor >= 6);
   
   this.isIE4xMac = (this.isIE4x && this.isMac);
}
var browser = new BrowserDetect();

//alert(browser.isGecko);

//var controller = document.mediaplayer1;

function opentelly() {
	var w = window.open("telly.php","tv_brighton","location=0, scrolling=0, status=0, width=1005, height=715, statusbar=0");
	w.focus(); 
}

function opentelly2() {
	var w = window.open("player.php","tv_brighton","location=0, scrolling=0, status=1, statusbar=1, width=852, height=382, statusbar=0");
	w.focus(); 
}


function ffwd() {
	document.mediaplayer1.controls.fastForward(); 
}

function rwd() {
	document.mediaplayer1.controls.fastReverse(); 
}

function doBuffering(end) {
	document.getElementById("buffer").style.visibility = hidden;
	document.getElementById("buffer").style.zIndex = 500;	
}

function doBuffering(start) {
	document.getElementById("buffer").style.visibility = "visible";
	document.getElementById("buffer").style.zIndex = 0;		
}

function stop() {
//	var player = document.getElementById("mediaplayer1");
//	player.stop();
//  playerStatus = document.getElementById("mediaplayer1").playState;
//  playerStatus = document.mediaplayer1.playState;
//  document.mediaplayer1.controls.pause();
	document.mediaplayer1.controls.stop();
  /**
  if (playerStatus == 6) {
    player.play();
//    document.playerCtrl.playOrPause.value = " Pause ";
  } 
  else if (playerStatus == 1) {
    player.play();
//    document.playerCtrl.playOrPause.value = " Pause ";
  } 
  else if (playerStatus == 2) {
    player.pause(); 
//    document.playerCtrl.playOrPause.value = " Play  ";
  } else if (playerStatus == 3) {
    player.play();
//    document.playerCtrl.playOrPause.value = " Pause ";
  } 
**/
} 

function play() {
//	  document.mediaplayer1.controls.play();	
	document.mediaplayer1.controls.play();
//	var player = document.getElementById("mediaplayer1");
//	player.play();
}

/**
nn=(document.layers)?true:false;
ie=(document.all)?true:false;
function keyDown(e) {
	var evt=(e)?e:(window.event)?window.event:null;
	if(evt){
		var
key=(evt.charCode)?evt.charCode:((evt.keyCode)?evt.keyCode:((evt.which)?evt.which:0));
		if(key=="70") fullScreen();
	}
}
 
document.onkeydown=keyDown;

if(nn) document.captureEvents(Event.KEYDOWN);
**/
var theevent;
function fullScreen() {
	window.name='player';
	var k = window.open("timer.php","timer","width=250, height=100, scrolling=0, scrollbars=0, status=0, location=0");
	k.moveTo((screen.availWidth/2)-125,(screen.availHeight/2)-50);
	k.focus();
}

function goFullScreen() {
//	alert("To exit full screen mode, press the <Esc> key once.");
	var player = document.getElementById("mediaplayer1");
	if (player.playState == 3) { // check wmplayer status
		player.fullScreen = true;
	}
//	return false;
}

function closeAlert() {
	theevent.close();
}

/*function channelpagelist(thechannel,isSubs,isSched,thisclient) {
	isSubs = (isSubs!=null)? isSubs : 0;
	isSched = (isSched!=null)? isSched : 0;
	if (isSubs==0){
		document.location.href="f.channel.php?id=" + thechannel + "&trailer=1";
		//alert("normal");
	}else{
		if (isSched==0){
			document.location.href="f.subscriptions.php?channel=" + thechannel;
		//alert("subscriptions");
		}else{
			document.location.href="f.subscriptions.php?channel=" + thechannel + "&is=" + isSched;
		}
	}
}

function subchannellist(thechannel) {
	document.location.href="f.channels.php?parentId=" + thechannel + "&trailer=1";
}*/

function register() {
	window.frames[0].location.href="register1.php";
}

/**
function watch(programmeId,url) { 
	if(parseFloat(cost)==0) {
		parent.getElementById("mediaplayer1").URL = "thisone";
		parent.document.mediaplayer1.URL = "thisone";
	}
}
**/

function checkRegister1(f) {
	if(!f.email.value) {
		alert("Please enter an email address.");
		return false;
	}
	if((!f.pin.value)) {
		alert("Please enter a four digit PIN number.");
		return false;
	}
	return true;
}

function checkRegister2(f) {
	if(!f.firstname.value) {
		alert("Please enter your first name.");
		return false;
	}
	if(!f.lastname.value) {
		alert("Please enter your last name.");
		return false;
	}
	if(!f.address1.value) {
		alert("Please enter your address.");
		return false;
	}
	if(!f.town.value) {
		alert("Please enter your town.");
		return false;
	}
	if(!f.zip.value) {
		alert("Please enter your postcode.");
		return false;
	}	
	return true;
}

function checkRegister3(f) {
	if(!f.cardname.value) {
		alert("Please enter the name as it appears on your card.");
		return false;
	}
	if(!f.cardno.value) {
		alert("Please enter your card number.");
		return false;
	}
	if(!f.cv2.value) {
		alert("Please enter your CV2 number (the last three digits on the signature strip of your card).");
		return false;
	}
	return true;
}

function showreel() {
	parent.document.location.href = "telly.php?showreel=1";
}

function channelpagelist(thechannel,isSubs,isSched,isSubClient,clientId,ses) {
	isSubs = (isSubs!=null)? isSubs : 0;
	isSched = (isSched!=null)? isSched : 0;
	isSubClient = (isSubClient!=null)? isSubClient : 0;
	ses = (ses!=null)? ses : 0;
	if (isSubs==0){
		var location = "f.channels.php?parentId=" + thechannel + "&trailer=1";
		if(isSubClient!=0){
			location = location + "&subclientid=" + clientId;
		}
		if(ses!=0){
			location = location + "&ses=" + ses;
		}
		document.location.href=location;
	}else{
		if (isSched==0){
			var location = "f.subscriptions.php?channel=" + thechannel;
			if(ses!=0){
				location = location + "&ses=" + ses;
			}
			document.location.href=location;
		}else{
			var location = "f.subscriptions.php?channel=" + thechannel + "&is=" + isSched;
			if(ses!=0){
				location = location + "&ses=" + ses;
			}
			document.location.href=location;
		}
	}
}

function subchannellist(thechannel,isSubClient,clientId,ses) {
	ses = (ses!=null)? ses : 0;
	isSubClient = (isSubClient!=null)? isSubClient : 0;
	var location = "f.channels.php?parentId=" + thechannel + "&trailer=1";
	if(isSubClient!=0){
			location = location + "&subclientid=" + clientId;
	}
	if(ses!=0){
		location = location + "&ses=" + ses;
	}
	document.location.href=location;
}

function subclientlist(thisclient,ses) {
	ses = (ses!=null)? ses : 0;
	var location = "f.channels.php?subclientid=" + thisclient + "&trailer=1";
	if(ses!=0){
		location = location + "&ses=" + ses;
	}
	document.location.href=location;
}

function checkWatch(ppvHash,channelId,ppvid,ppvamt,mob,subs,login,portal,clientId,url,ses)
{
	clientId = (clientId!=null)? clientId : 0;
	ses = (ses!=null)? ses : 0;
	var location = "https://secure2.globaldigitalbroadcast.com/" + url + "/checkLogin.php?h=" + ppvHash + "&channelId=" + channelId + "&ppvId=" + ppvid + "&ppvamt=" + ppvamt + "&mob=" + mob + "&s=" + subs + "&por=" + portal;
	if(clientId!=0){ 
		location = location + "&subclientid=" + clientId;
	}
	if(ses!=0){ 
		location = location + "&ses=" + ses;
	}
	document.location.href = location;
}

/*function checkWatch(ppvHash,channelId,ppvid,ppvamt,mob,subs,login,portal,url)
{
	//if ((login==1) || (ppvamt > 0) || (subs > 0))
	//{
		document.location.href = "https://secure2.globaldigitalbroadcast.com/" + url + "/checkLogin.php?h=" + ppvHash + "&channelId=" + channelId + "&ppvId=" + ppvid + "&ppvamt=" + ppvamt + "&mob=" + mob + "&s=" + subs + "&por=" + portal;
	//} else {
		//just play it
		//document.location.href = "f.ppvconfirm.php?h=" + ppvHash;
	//}
}*/

function dowatch2(ppvHash) {
	parent.document.location.href = "telly.php?h=" + ppvHash;
}

function dowatch(ppvHash, channelId) {
	document.location.href="frame.channel.php?h=" + ppvHash + "&id=" + channelId;
}

function dowatch3(ppvHash, channelId, issearch) {
	document.location.href="f.channel.php?h=" + ppvHash + "&id=" + channelId + "&search=" + issearch;
}

function dowatch5(ppvHash, channelId, issearch) {
	document.location.href="f.ppvconfirm.php?h=" + ppvHash + "&id=" + channelId + "&search=" + issearch;
}

function dowatch4(ppvHash) {
	parent.document.location.href = "player.php?h=" + ppvHash;
}

function dowatch4Mob(ppvHash) {
	document.location.href = "m.player.php?h=" + ppvHash;
	//alert("dw4 " + ppvHash);
}

function dowatch5Mob(ppvHash) {
	//alert(ppvHash);
	document.location.href = "m.ppvconfirm.php?h=" + ppvHash;
	//alert("dw5 " + ppvHash);
}

function dowatch3Mob(ppvHash)
{
	document.location.href = "m.login.php?h=" + ppvHash;
}
function dowatch6(ppvHash, channelId, issearch) {
	//document.location.href="f.channel.php?h=" + ppvHash + "&id=" + channelId + "&search=" + issearch;
	window.frames[0].location.href="f.ppvdetail.php?h=" + ppvHash + "&id=" + channelId + "&search=" + issearch;
	//alert("dw6 " + ppvHash);
}

function checkpayment(f) {
	var theamount;
	for(var i=0;i<f.amount.length;i++) {
		if(f.amount[i].checked==true) theamount = f.amount[i].value;
	}
	if(confirm("You will be billed " + theamount + " which will be credited to your account.\n\n Click 'OK' to continue or 'Cancel' to go back.")) return true;
	return false;
}

function refreshto(theurl) {
	document.location.href = theurl;
}

function playppv(thehash) {
	parent.document.location.href='player.php?h=' + thehash;
}
/*
function imgOn(imgName) {
	if (document.images) {
		document[imgName].src = "images/new/" + imgName + "_on.gif";
	}
}

function imgOff(imgName) {
	if (document.images) {
		document[imgName].src = "images/new/" + imgName + "_off.gif";
		for(var i=0; i<tabs.length;i++) {
		if(eval(tabs[i] + "tab")==1) {
			document[tabs[i]].src = "images/new/" + tabs[i] + "_on.gif";
		} else {
			document[tabs[i]].src = "images/new/" + tabs[i] + "_off.gif";		
		}
		}
	}
}
*/
/**
function highlight(theel) {
	theel.style.backgroundColor='#fff';
}
**/

function highlight(theel) {
	theel.style.backgroundColor='#D9D9D7';
	theel.style.color = '#FFF';
//	theel.style.filter = "Alpha(Opacity=100)";
//	theel.style.MozOpacity = "1";
}

/**
function unhighlight(theel) {
	theel.style.backgroundColor='transparent';
}**/

function unhighlight(theel) {
	theel.style.backgroundColor='';
	theel.style.color = '#000';
//	theel.style.filter = "Alpha(Opacity=60)";
//	theel.style.MozOpacity = "0.6";	
}

function startSchedule(src) {
	parent.document.location.href = "player.php?s=" + src;	
	
}

function startSchedule1(src)
{
parent.document.location.href = "player.php?s=" + src;	
//getPlayer(src);
}


function schedulepagelist(thechannel) {
	document.location.href="f.schedule.php?schId=" + thechannel;
}

//ADDED BY JAY
var curDateTime = new Date();
var curOffset = -(curDateTime.getTimezoneOffset()/60);
function localiseIt(inputTime){
	var now = new Date();
	now.setHours(inputTime.substr(0,inputTime.indexOf(":")));
	now.setMinutes(inputTime.substr(inputTime.indexOf(":")+1));
	now.setSeconds(0);
	var newHour = (now.getHours()+curOffset);
	var newMins = "";
	if(now.getMinutes()>59){
		newMins += (now.getMinutes()-59);
		newHour = (now.getHours()+(curOffset+1));
	}else{
		if(now.getMinutes()<10){
			newMins += "0"+now.getMinutes();
		}else{
			newMins += now.getMinutes();
		}
	}
	if(newHour>23){
		newHour -= 24;
	}
	var newTime = newHour+":"+newMins;
	document.write(newTime);
}
//JAY END
