function chooseMenu(which)
{
	window.location.href = which;
}

function showMainMenuOptions(which,whichDD)
{
	//alert(which + " | " + whichDD);
	document.getElementById(which).style.display = "block";
	curOn = whichDD.replace("DD", "On")
	document.getElementById(whichDD).style.backgroundImage = "url(/menu/" + curOn + ".png)"
}

function hideMainMenuOptions(which,whichDD)
{
	document.getElementById(which).style.display = "none";
	curOff = whichDD.replace("DD", "Off")
	document.getElementById(whichDD).style.backgroundImage = "url(/menu/" + curOff + ".png)"
}

function tier2On(which)
{
	document.getElementById(which).style.backgroundImage = "url(/menu/tier2on.png)"
	showHand(which);
}

function tier2Off(which)
{
	document.getElementById(which).style.backgroundImage = "url(/menu/tier2off.png)"
}

function showHand(which)
{
	document.getElementById(which).style.cursor = "pointer";
}

function showDisclaimer()
{
	document.getElementById("boilerPlateLink").style.display = "none";
	document.getElementById("boilerPlateCopy").style.display = "block";
}

function hideDisclaimer()
{
	document.getElementById("boilerPlateCopy").style.display = "none";
	document.getElementById("boilerPlateLink").style.display = "block";
}
function viewMore(which)
{
	document.getElementById("smViewButton" + which).style.display = "none";
	document.getElementById("smViewMore" + which).style.display = "block";
}
function changeTabs(which,group)
{
	if(group == "topTabs")
	{
		document.getElementById("topBoxTab").value = "topTab" + which;
		
		for(x=0;x<=document.getElementById("topTabCount").value;x++)
		{
			document.getElementById("topTabItems" + x).style.display = "none";
		}
		document.getElementById("topTabItems" + which).style.display = "block";
		
		if(document.getElementById("topTab" + which).innerHTML != "DETAILS " && document.getElementById("topTab" + which).innerHTML != "DETAILS" && document.getElementById("topTab" + which).innerHTML != "VIDEOS" && document.getElementById("topTab" + which).innerHTML != "VIDEOS ")
		{
			document.getElementById("newImagesGrp").style.display = "block";
		}
		else
		{
			document.getElementById("newImagesGrp").style.display = "none";
		}
		if(document.getElementById("topTab" + which).innerHTML == "OFFERS")
		{
			changeOffers(0,document.getElementById("offersCnt").value)
		}
	}
	else if(group == "bottomTabs")
	{
		//alert(document.getElementById("bottomTab" + which).innerHTML + " : " + which)
		document.getElementById("bottomBoxTab").value = "bottomTab" + which;
		
		for(x=0;x<=document.getElementById("bottomTabCount").value;x++)
		{
			document.getElementById("bottomTabItems" + x).style.display = "none";
		}
		document.getElementById("bottomTabItems" + which).style.display = "block";
		
		if(document.getElementById("bottomTab" + which).innerHTML == "TRACKS")
		{
			document.getElementById("tracks1").style.display = "block";
			document.getElementById("tracksImg1").style.color = "#f26522";
			document.getElementById("tracksGrp" + which).innerHTML = document.getElementById("tracksImages").innerHTML;
		}
		else if(document.getElementById("bottomTab" + which).innerHTML == "TRACKS 2WD")
		{
			document.getElementById("tracks2wd1").style.display = "block";
			document.getElementById("tracksImg2wd1").style.color = "#f26522";
			document.getElementById("tracksGrp" + which).innerHTML = document.getElementById("tracksImages2WD").innerHTML;
		}
		else if(document.getElementById("bottomTab" + which).innerHTML == "ATTACHMENTS")
		{
			//alert(document.getElementById("attFlag").value)
			for(x=0;x<=document.getElementById("attCnt").value;x++)
			{
				curImage = document.getElementById("attATTID" + x).innerHTML;
				if(document.getElementById("attFlag").value != "true")
				{
					document.getElementById("attATTID" + x).innerHTML = "<img " + curImage + " />";
				}
				document.getElementById("attATTID" + x).style.display = "block";
			}
			document.getElementById("attFlag").value = "true";
			
		}
	}
	resetTabs(group)
	if(document.getElementById("whichAtt").value != "")
	{
		showAttList()
	}
	if(document.getElementById("whichFE").value != "")
	{
		showFEList()
	}
	if(document.getElementById("whichOGS").value != "")
	{
		showOGSList()
	}
	if(document.getElementById("whichJR").value != "")
	{
		showPRList()
	}
}
function setTabsStart(topStart,bottomStart)
{
	document.getElementById("image1").style.display = "block";
	document.getElementById("vl1").style.display = "block";
	document.getElementById("curImg1").style.color = "#f26522";

	document.getElementById("topTab" + topStart).style.backgroundColor = "#F26522";	
	document.getElementById("bottomTab" + bottomStart).style.backgroundColor = "#F26522";
	document.getElementById("topBoxTab").value = "topTab" + topStart;
	document.getElementById("bottomBoxTab").value = "bottomTab" + bottomStart;

	document.getElementById("topTabItems" + topStart).style.display = "block";
	document.getElementById("bottomTabItems" + bottomStart).style.display = "block";

	//document.getElementById("imagesGrp0").innerHTML = document.getElementById("curImages").innerHTML;
	document.getElementById("curImages").innerHTML = "";
	
	//if(topStart == 4)
	//{
		//changeTabs(4,'topTabs')	
	//}
	if(topStart != 0)
	{
		changeTabs(topStart,'topTabs')	
	}
}

function mouseover(which)
{
	document.getElementById(which).style.backgroundColor = "#F26522";
	showHand(which);
}

function resetTabs(which)
{
	if(which == "topTabs")
	{
		for(x=0;x<=document.getElementById("topTabCount").value;x++)
		{
			document.getElementById("topTab" + x).style.backgroundColor = "#9D9FA2";
		}
		curTopBoxTab = document.getElementById("topBoxTab").value;
		document.getElementById(curTopBoxTab).style.backgroundColor = "#F26522";
	}
	else if(which == "bottomTabs")
	{
		for(x=0;x<=document.getElementById("bottomTabCount").value;x++)
		{
			document.getElementById("bottomTab" + x).style.backgroundColor = "#9D9FA2";
		}
		curBottomBoxTab = document.getElementById("bottomBoxTab").value;
		document.getElementById(curBottomBoxTab).style.backgroundColor = "#F26522";	
	}
}

function changeImg(which,total)
{
	for(x=1;x<=total;x++)
	{
		document.getElementById("image" + x).style.display = "none";
		document.getElementById("vl" + x).style.display = "none";
		document.getElementById("curImg" + x).style.color = "#404040";
	}
	document.getElementById("image" + which).style.display = "block";
	document.getElementById("vl" + which).style.display = "block";
	document.getElementById("curImg" + which).style.color = "#f26522";
}

function changeTracks(which,total)
{
	for(x=1;x<=total;x++)
	{
		document.getElementById("tracks" + x).style.display = "none";
		document.getElementById("tracksImg" + x).style.color = "#404040";
	}
	document.getElementById("tracks" + which).style.display = "block";
	document.getElementById("tracksImg" + which).style.color = "#f26522";
}
function showPR(which)
{
	curContent = document.getElementById(which).innerHTML;
	var re = /stopimg /gi;
	var re2 = /stopimg2/gi;
	var re3 = /stopimg3/gi;
	var re4 = /stopimg4/gi;
	newContent = curContent.replace(re,"<img ");
	newContent = newContent.replace(re2,'style="padding-right: 20px;" align="left" />');
	newContent = newContent.replace(re3,'style="padding-left: 20px;" align="right" />');
	newContent = newContent.replace(re4,'.jpg" />');	
	document.getElementById("whichJR").value = which;
	document.getElementById("prList").style.display = "none";
	document.getElementById(which).innerHTML = newContent;
	document.getElementById(which).style.display = "block";
}
function showPRList()
{
	curWhichJR = document.getElementById("whichJR").value;
	document.getElementById(curWhichJR).style.display = "none";
	document.getElementById("prList").style.display = "block";
	document.getElementById("whichJR").value = "";
}
	
function showAttDet(which)
{
	curImage = document.getElementById("attBig" + which).innerHTML;
	//alert(document.getElementById("attBig" + which).innerHTML)
	document.getElementById("whichAtt").value = "attDet" + which;
	document.getElementById("attList").style.display = "none";
	document.getElementById("attDet" + which).style.display = "block";
	document.getElementById("attBig" + which).innerHTML = "<img " + curImage + " />";
}

function showAttList()
{
	curWhichAtt = document.getElementById("whichAtt").value;
	document.getElementById(curWhichAtt).style.display = "none";
	document.getElementById("attList").style.display = "block";
	document.getElementById("whichAtt").value = "";
}
	
function showFEDet(which)
{
	document.getElementById("whichFE").value = which;
	document.getElementById("feList").style.display = "none";
	document.getElementById(which).style.display = "block";
}

function showFEList()
{
	curWhichFE = document.getElementById("whichFE").value;
	document.getElementById(curWhichFE).style.display = "none";
	document.getElementById("feList").style.display = "block";
	document.getElementById("whichFE").value = "";
}
	
function showOGSDet(which)
{
	document.getElementById("whichOGS").value = which;
	document.getElementById("ogsList").style.display = "none";
	document.getElementById(which).style.display = "block";
}

function showOGSList()
{
	curWhichOGS = document.getElementById("whichOGS").value;
	document.getElementById(curWhichOGS).style.display = "none";
	document.getElementById("ogsList").style.display = "block";
	document.getElementById("whichOGS").value = "";
}
	
function showVid(which)
{
	document.getElementById("videos").innerHTML = document.getElementById(which).innerHTML;
}
var t;

function expand()
{
	document.getElementById("curOffersList").style.display = "none";
	clearTimeout(t);
	document.getElementById("offerDetails").style.display = "none";
	document.getElementById("finePrint").style.display = "block";
}

function shrink()
{
	document.getElementById("curOffersList").style.display = "block";
	document.getElementById("finePrint").style.display = "none";
	document.getElementById("offerDetails").style.display = "block";
}

function changeOffers(which,total)
{
	for(x=0;x<=total;x++)
	{
		document.getElementById("curOffer" + x).style.color = "#404040";
	}
	document.getElementById("curOffer" + which).style.color = "#f26522";
	document.getElementById("mainOffer").innerHTML = document.getElementById("offer" + which).innerHTML;
	//alert(document.getElementById("mainOffer").innerHTML)
}
