function hideAll(exceptPos){
	obj = document.getElementById("content1");
	pos = 1;
	while(obj){
		if(pos != exceptPos){
			obj.style.display = "none";
		}
		obj = document.getElementById("content"+(++pos));
	}
}

function changeStatus(pos){
	obj = document.getElementById("content"+pos);
	if(obj){
		if(obj.style.display == "none"){
			obj.style.display = "";
		}else{
			pos = 0;
		}
	}
	hideAll(pos);
}

function toggleHD(pack)
{
	HDTVsobj = document.getElementById("HD0");
	if(HDTVsobj.style.display == "none")
		{
			HDTVsobj.style.display = "";
			document.getElementById("HDready"+pack).click();
		}else
		{
			HDTVsobj.style.display = "none";
		}
}
function toggleOrder()
{	
	Errobj = document.getElementById("orderBtn");
	linkObj = document.getElementById("order_Btn");
	if(Errobj.src == "http://www.dishnetwork.com/redirects/quickorder/images/btn_ordernow.gif")
		{
			Errobj.src = "images/btn_ordernowInactive.gif";
			Errobj.style.cursor = "wait";
			linkObj.href="#";
		}else
		{
			Errobj.src = "images/btn_ordernow.gif";
			Errobj.style.cursor = "pointer";
			linkObj.href="full_confirmation.shtml";
		}
}

function countHD()
{
	var sdTV = document.getElementById("TVdropdown");
	var hdTV = document.getElementById("HDdropdown");
	var sdCount = document.getElementById("TVdropdown").selectedIndex;
	sdCount++;
	if (sdCount>=3)
	{
		hdTV.innerHTML = '<select><option selected value="1">1</option><option value="2">2</option><option value="3">3</option></select>';
	}
	else if (sdCount==2)
	{
		hdTV.innerHTML = '<select><option selected value="1">1</option><option value="2">2</option></select>';
	}
	else if (sdCount==1)
	{
		hdTV.innerHTML = '<select><option selected value="1">1</option></select>';
	}
	
}

function toggleCalander()
{
	Calobj = document.getElementById("CalMore");
	CalClickobj = document.getElementById("CalClick");
	if(Calobj.style.display == "none")
		{
			Calobj.style.display = "";
			CalClickobj.style.display = "none";
		}else
		{
			Calobj.style.display = "none";
		}
}
		
function tvOpen(openBelow)
{	
	i=openBelow;
	firstHD = document.getElementById("sdhd1");
	
	if (i==4){showTV(1);showTV(2);showTV(3);
		showTV(4);
		if(firstHD.style.display==""){showHDcolumn(1);showHDcolumn(2);showHDcolumn(3);
		showHDcolumn(4);
		}
		else if(firstHD.style.display=="none"){hideHDcolumn(1);hideHDcolumn(2);hideHDcolumn(3);
		hideHDcolumn(4);}
	}
	else if (i==3){showTV(1);showTV(2);showTV(3);
		hideTV(4);
		if(firstHD.style.display==""){showHDcolumn(1);showHDcolumn(2);showHDcolumn(3);
		hideHDcolumn(4);
		}
		else if(firstHD.style.display=="none"){hideHDcolumn(1);hideHDcolumn(2);hideHDcolumn(3);
		hideHDcolumn(4);}
	}
	else if (i==2){showTV(1);showTV(2);hideTV(3);
		hideTV(4);
		if(firstHD.style.display==""){showHDcolumn(1);showHDcolumn(2);hideHDcolumn(3);
		hideHDcolumn(4);
		}
		else if(firstHD.style.display=="none"){hideHDcolumn(1);hideHDcolumn(2);hideHDcolumn(3);
		hideHDcolumn(4);}
	}
	else if (i==1){showTV(1);hideTV(2);hideTV(3);
		hideTV(4);
		if(firstHD.style.display==""){showHDcolumn(1);hideHDcolumn(2);hideHDcolumn(3);
		hideHDcolumn(4);
		}
		else if(firstHD.style.display=="none"){hideHDcolumn(1);hideHDcolumn(2);hideHDcolumn(3);
		hideHDcolumn(4);}
	}			
}

function HDtvOpen()
{
	firstHD = document.getElementById("HD1radioBtn");
	essChk = document.getElementById("hdChk1");
	ultChk = document.getElementById("hdChk2");
	if(firstHD.checked==false)
	{
		firstHD.checked=true;
		showHDcolumn(1);
		showHDcolumn(2);
		showHDcolumn(3);
		showHDcolumn(4);
	}
	else {firstHD.checked=false;
		hideHDcolumn(1);
		hideHDcolumn(2);
		hideHDcolumn(3);
		hideHDcolumn(4);
	}
	if(essChk.checked==true)
	{
		popHDinfo();
	}
	else if (ultChk.checked==true)
	{
		popHDinfo();
	}
}

function showTV(pos)
{
	obj = document.getElementById("HD"+pos);
	//obj2 = document.getElementById("DVR"+pos);
	if (obj)
	{
		if(obj.style.display == "none")
		{
			obj.style.display = "";
			//obj2.style.display = "";
		}else
		{
					//pos = 0;
		}
	}
}

function showHDcolumn(pos)
{
	obj = document.getElementById("sdhd"+pos);
	if (obj)
	{
		if(obj.style.display == "none")
		{
			obj.style.display = "";
			//obj2.style.display = "";
		}else
		{
					//pos = 0;
		}
	}
}
function hideHDcolumn(pos)
{
	obj = document.getElementById("sdhd"+pos);
	if (obj)
	{
		if(obj.style.display == "")
		{
			obj.style.display = "none";
			//obj2.style.display = "";
		}else
		{
					//pos = 0;
		}
	}
}

function hideTV(thisPos)
{
	obj = document.getElementById("HD"+thisPos);
	//obj2 = document.getElementById("DVR"+thisPos);
	if (obj)
	{
		if(obj.style.display == "")
		{
			obj.style.display = "none";
			//obj2.style.display = "none";
		}
		else
		{
					//pos = 0;
		}
	}	
}

function showEtc()
{
	obj = document.getElementById("billingEtc");
	if (obj)
	{
		obj.style.display = "";
	}
	contBtn = document.getElementById("contBtn");
	if (contBtn)
	{
		contBtn.style.display="none";
	}
}

function popTheHD(whichPak)
{		
	ourImage = new Image();
	picSrc = 'http://www.dishnetwork.com/redirects/quickorder/images/HDchannelLineup_popup_'+whichPak+HDimageSwitch+'.jpg';
	ourImage.src=picSrc
	picWd = ourImage.width+40;
	picHt = ourImage.height+35;
	window.open(picSrc,'dishHD'+whichPak,'menubar=0,status=0,scrollbars=1,status=0,toolbar=0,location=0,directories=0,resizeable=0,width='+picWd+',height='+picHt);	
}

function  popHDinfo()
{
	ourImage = new Image();
	picSrc = 'images/popup_HD.gif';
	ourImage.src=picSrc
	picWd = ourImage.width+40;
	picHt = ourImage.height+35;
	window.open(picSrc,'HDReady','menubar=0,status=0,scrollbars=1,status=0,toolbar=0,location=0,directories=0,resizeable=0,width='+picWd+',height='+picHt);
}

function clearSpecial()
{
		obj = document.getElementById("specialIntructions");
		if (obj)
		{
		txt = obj.innerHTML;
		if (txt=='If you have any special instructions for your installation ("Doorbell does not work", etc.), please type them here.')
		{
			txt = "";
			obj.innerHTML = txt;
		}
		}
}
function getFlashMovieObject(movieName){

	if (navigator.appName.indexOf("Microsoft")!=-1)
	{ return document.getElementById(movieName);	}
	else 
	{
		if (window.document[movieName]){ 	return window.document[movieName]; }
		else
		if (document.embeds){
			if (document.embeds[0]) {	return document.embeds[0];}
			else {alert("No Embeds object.");
				if (document.getElementById(movieName)){return document.getElementById(movieName);}
			
			}
		}		
		else {alert("No object returned.");}
	}
}

function switchBanner(pack){
	var flashMovie = getFlashMovieObject("pppBanner");
	if (flashMovie){
			flashMovie.TGotoLabel("/", pack);
	}
	else{alert("No object.");}
}
function getArgs()
{
	HDimageSwitch = 200;
	fullURL = parent.document.URL;
	showPkg = fullURL.substring(fullURL.indexOf('?')+3,fullURL.length);
	pkg100 = document.getElementById("pack100");
	pkg200 = document.getElementById("pack200");
	pkg250 = document.getElementById("pack250");
	if (showPkg=="HD")
	{
		HDobj = document.getElementById("HD0");
		HDobj.style.display = "";
		HDpkg = document.getElementById("hdUlt");
		HDpkg.checked = true;
	}
	else if (showPkg=="AT100")
	{
		//switchBanner('AT100');
		pkg100.checked = true;
		HDimageSwitch = 100;
	}
	else if (showPkg=="AT200")
	{
		//switchBanner('AT200');
		pkg200.checked = true;
		HDimageSwitch = 200;
	}
	else if (showPkg=="AT250")
	{
		//switchBanner('AT250');
		pkg250.checked = true;
		HDimageSwitch = 250;
	}
}
function modifyHDImage(thePack)
{
	HDimageSwitch = thePack;
}