// Detect if browser is Netscape 3 + or IE 4 +.
bName = navigator.appName;
bVer = parseInt(navigator.appVersion);
    if ((bName == "Netscape" && bVer >= 3) || 
        (bName == "Microsoft Internet Explorer" && bVer >= 4)) br = "n3"; 
    else br = "n2";

// Create image objects, preload all active and inactive images.
    if (br== "n3") { 
    ondemandon = new Image();         
    ondemandon.src = "/schedules/public/images/ondemand_on.gif"; 
	scheduleson = new Image();
    scheduleson.src = "/schedules/public/images/schedules_on.gif";

// roll off images
    ondemandoff = new Image();          	 
    ondemandoff.src = "/schedules/public/images/ondemand_off.gif";
	schedulesoff = new Image();
    schedulesoff.src = "/schedules/public/images/schedules_off.gif";
}

// Function to activate schedules images.
function imgAct(imgName) {
    if (br == "n3") {
    document[imgName].src = eval(imgName + "on.src");
    }
	getSchDes();
}

// Function to deactivate schedules images.
function imgInact(imgName) {
    if (br == "n3") {
    document[imgName].src = eval(imgName + "off.src");
    }
	getBlack();
}

// Function to activate ondeamnd image 
function imgActOnd(imgName) {
    if (br == "n3") {
    document[imgName].src = eval(imgName + "on.src");
    }
	getOndDes();
}

// Function to deactivate ondeamnd image.
function imgInactOnd(imgName) {
    if (br == "n3") {
    document[imgName].src = eval(imgName + "off.src");
    }
	getBlack();
}

//get schedules description
var http = createRequestObject();
function createRequestObject() {
   var objAjax;
   var browser = navigator.appName;
   if(browser == "Microsoft Internet Explorer"){
      objAjax = new ActiveXObject("Microsoft.XMLHTTP");
   }else{
      objAjax = new XMLHttpRequest();
   }
   return objAjax;
}

function getSchDes(){
   http.open('get','/schedules/app/view/schedules/contentBoxSch.php');
   http.onreadystatechange = updateNewContent;
   http.send(null);
   return true;
}

function updateNewContent(){
   if(http.readyState == 4){
      document.getElementById('contentBox').innerHTML = http.responseText;
   }
}

//get ondeamnd description
var http = createRequestObject();
function createRequestObject() {
   var objAjax;
   var browser = navigator.appName;
   if(browser == "Microsoft Internet Explorer"){
      objAjax = new ActiveXObject("Microsoft.XMLHTTP");
   }else{
      objAjax = new XMLHttpRequest();
   }
   return objAjax;
}

function getOndDes(){
   http.open('get','/schedules/app/view/ondemand/contentBoxOnd.php');
   http.onreadystatechange = updateNewContent;
   http.send(null);
   return true;
}

function updateNewContent(){
   if(http.readyState == 4){
      document.getElementById('contentBox').innerHTML = http.responseText;
   }
}

//go to black
var http = createRequestObject();
function createRequestObject() {
   var objAjax;
   var browser = navigator.appName;
   if(browser == "Microsoft Internet Explorer"){
      objAjax = new ActiveXObject("Microsoft.XMLHTTP");
   }else{
      objAjax = new XMLHttpRequest();
   }
   return objAjax;
}

function getBlack(){
   http.open('get','/schedules/app/view/schedules/black.php');
   http.onreadystatechange = updateNewContent;
   http.send(null);
   return true;
}

function updateNewContent(){
   if(http.readyState == 4){
      document.getElementById('contentBox').innerHTML = http.responseText;
   }
}

//combo function
	function combo(imgName) {
		imgInact(imgName);
		
		
	}

//get channel day
var http = createRequestObject();
function createRequestObject() {
   var objAjax;
   var browser = navigator.appName;
   if(browser == "Microsoft Internet Explorer"){
      objAjax = new ActiveXObject("Microsoft.XMLHTTP");
   }else{
      objAjax = new XMLHttpRequest();
   }
   return objAjax;
}

function getMovieDetails($movieid){
   http.open('get', '/schedules/app/view/schedules/details.php?tag=' + $movieid);
   http.onreadystatechange = updateNewContent;
   http.send(null);
   return false;
   function updateNewContent(){
   if(http.readyState == 4){
      document.getElementById('contentBox').innerHTML = http.responseText;
   }
}
}

//hide divs
function hideDiv() {
		document.getElementById('day').style.display  = "none";
		document.getElementById('dayTwo').style.display  = "none";
		document.getElementById('zone').style.display  = "none";
	}
//show divs
function showCal() {
		document.getElementById('day').style.display  = "block";
		document.getElementById('dayTwo').style.display  = "block";
		document.getElementById('calHolder').style.display  = "none";
	}
function showZone() {
		document.getElementById('zone').style.display  = "block";
		document.getElementById('zoneHolder').style.display  = "none";
	}
