var DHTML = (document.getElementById || document.all || document.layers);

function getObj(name) {
  if (document.getElementById) {
  		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
  } else if (document.all) {
		this.obj = document.all[name];
		this.style = document.all[name].style;
  } else if (document.layers) {
   		this.obj = document.layers[name];
   		this.style = document.layers[name];
  }
}

function switchImage(whichid) {
	if (!DHTML) return;
	imagesrc = document.images[whichid].src;
	if (imagesrc.indexOf("Open")!=-1) {
		document.images[whichid].src = imagePath + "roundButtonClosed.gif";
	} else {
		document.images[whichid].src = imagePath + "roundButtonOpen.gif";
	}
}

function hidestyle(whichid, justhide) {
if (!DHTML) return;
mainobject = new getObj(whichid);
lineobject = new getObj(whichid + '_line');
	if (mainobject.style.display=='none' && justhide!=1){
		mainobject.style.display='';
		lineobject.style.display='';
	} else {
		mainobject.style.display='none';
		lineobject.style.display='none';
	}
}

function hideAll() {
	hideAll_cablereceiver();
	hideAll_hd_tuner();
	hideAll_single_tuner();
	hideAll_dual_tuner();
}

/*-----------------functions for Cable Receiver expandable rows--------------------*/
function hideAll_cablereceiver() {
	objectnamearray = new Array("interactive_digital_programming", "hd_programming", "standard_programming", "ieee_1394");
	for (var i=0; i<objectnamearray.length; i++){
		hidestyle(objectnamearray[i],1);
	}
}

function toggle_cablereceiver() {
	objectnamearray = new Array("interactive_digital_programming", "hd_programming", "standard_programming", "ieee_1394");
	for (var i=0; i<objectnamearray.length; i++){
			hidestyle(objectnamearray[i]);
	}
}

/*-----------------functions for HD Tuner expandable rows--------------------*/
function hideAll_hd_tuner() {
	objectnamearray = new Array("input_resolutions", "output_resolutions");
	for (var i=0; i<objectnamearray.length; i++){
		hidestyle(objectnamearray[i],1);
	}
}

function toggle_hd_tuner() {
	objectnamearray = new Array("input_resolutions", "output_resolutions");
	for (var i=0; i<objectnamearray.length; i++){
			hidestyle(objectnamearray[i]);
	}
}

/*-----------------functions for Single Tuner expandable rows--------------------*/
function hideAll_single_tuner() {
	objectnamearray = new Array("pause", "replay", "single_watch_live");
	for (var i=0; i<objectnamearray.length; i++){
		hidestyle(objectnamearray[i],1);
	}
}

function toggle_single_tuner() {
	objectnamearray = new Array("pause", "replay", "single_watch_live");
	for (var i=0; i<objectnamearray.length; i++){
			hidestyle(objectnamearray[i]);
	}
}

/*-----------------functions for Dual Tuner expandable rows--------------------*/
function hideAll_dual_tuner() {
	objectnamearray = new Array("dual_watch_live", "record_live", "record_two");
	for (var i=0; i<objectnamearray.length; i++){
		hidestyle(objectnamearray[i],1);
	}
}

function toggle_dual_tuner() {
	objectnamearray = new Array("dual_watch_live", "record_live", "record_two");
	for (var i=0; i<objectnamearray.length; i++){
			hidestyle(objectnamearray[i]);
	}
}