function expandcontent(cid, aobject){
if (disabletablinks==1)
aobject.onclick=new Function("return false")
if (document.getElementById && turntosingle==0){
highlighttab(aobject)
if (previoustab!="")
document.getElementById(previoustab).style.display="none"
if (cid!=""){
document.getElementById(cid).style.display="block"
previoustab=cid
}
}
}

function highlighttab(aobject){
if (typeof tabobjlinks=="undefined")
collectddimagetabs()
for (i=0; i<tabobjlinks.length; i++)
tabobjlinks[i].className=""
aobject.className="current"
}

function collectddimagetabs(){
var tabobj=document.getElementById("ddimagetabs")
tabobjlinks=tabobj.getElementsByTagName("A")
}

function do_onload(){
collectddimagetabs()
expandcontent(initialtab[1], tabobjlinks[initialtab[0]-1])
}

function mOver(Item, bgcolor, fcolor) {
Item.style.backgroundColor=bgcolor;
Item.style.cursor="hand";
}

function mOut(Item, bgcolor, fcolor) {
Item.style.backgroundColor=bgcolor;
}

function startExpand(e,element)
{
	var fromElement = e.relatedTarget || e.fromElement;
	while (fromElement && fromElement != element && fromElement.nodeName != 'BODY')
		fromElement = fromElement.parentNode
	if (fromElement == element)
		return;
	
	var tableElement = element;
	var imgElement = tableElement.firstChild.firstChild.firstChild.firstChild.firstChild;
	
	if(!imgElement.inited)
		init(imgElement);


	//tableElement.style.width = tableElement.offsetWidth;
	tableElement.nextSibling.width = tableElement.offsetWidth;
	tableElement.nextSibling.height = tableElement.offsetHeight+1;
	tableElement.className = "gr_expanded";
	tableElement.parentNode.style.zIndex = 1;
	window.clearTimeout(imgElement.imgDelayID);
	imgElement.imgDelayID = window.setTimeout(imgElement.expand,300);
}

function endExpand(e,element)
{
	var toElement = e.relatedTarget || e.toElement;
	while(toElement && toElement != element && toElement.nodeName != 'BODY')
		toElement = toElement.parentNode;
	if(toElement == element)
		return;

	var tableElement = element;
	var imgElement = tableElement.firstChild.firstChild.firstChild.firstChild.firstChild;
	window.clearTimeout(imgElement.imgDelayID);
	hideElements(tableElement);
	imgElement.contract();
}

function init(imgElement)
{
	imgElement.originalHeight = imgElement.height;
	imgElement.originalWidth = imgElement.width;

	
	imgElement.expand = function() 
						{
							var factor = Math.round(imgElement.height*.06);
							if(imgElement.width + factor < imgElement.originalWidth*2)
							{
								imgElement.width += factor;
								imgElement.height += factor;
								imgElement.imgDelayID = window.setTimeout(imgElement.expand,18);
							}
							else
							{
								imgElement.width = imgElement.originalWidth*2;
								imgElement.height = imgElement.originalHeight*2;
								var tableElement = imgElement.parentNode.parentNode.parentNode.parentNode.parentNode;
								showElements(tableElement);
								if(tableElement.getAttribute("pushdown") == "1")
									tableElement.nextSibling.height = tableElement.offsetHeight+1;
							}
						};
	imgElement.contract = function() 
						{
							var factor = Math.round(imgElement.height*.08);
							if(imgElement.width - factor > imgElement.originalWidth)
							{
								imgElement.width -= factor;
								imgElement.height -= factor;
								imgElement.imgDelayID = window.setTimeout(imgElement.contract,15);
							}
							else
							{
								imgElement.width = imgElement.originalWidth;
								imgElement.height = imgElement.originalHeight;
								
								var parentTable = imgElement.parentNode.parentNode.parentNode.parentNode.parentNode;
								parentTable.className = "gr_expandable";
								parentTable.parentNode.style.zIndex = 0;
								parentTable.nextSibling.height = "1";
								parentTable.nextSibling.width = "1";
							}
						};
	
	imgElement.inited = true;
}

function showElements(element)
{
	var trElements = element.firstChild.childNodes;
	//show titles past 2 lines
	if(trElements[1].firstChild.firstChild.nodeName == "DIV")
		trElements[1].firstChild.firstChild.style.height = "";
	
	for(var i=0;i<trElements.length;i++)
	{
		if(trElements[i].getAttribute("hideexp") == "1")
			trElements[i].style.display = "none";
		else
		{
			if(trElements[i].style.display == "none")
			{
				trElements[i].style.display = "";
				trElements[i].rehide = true;
			}
		}
	}
}

function hideElements(element)
{
	var trElements = element.firstChild.childNodes;
	//hide titles past 2 lines
	if(trElements[1].firstChild.firstChild.nodeName == "DIV")
		trElements[1].firstChild.firstChild.style.height = "30px";

	for(var i=0;i<trElements.length;i++)
	{
		if(trElements[i].getAttribute("hideexp") == "1")
			trElements[i].style.display = "";

		if(trElements[i].rehide)
			trElements[i].style.display = "none";
	}
}
function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;

      }

function disableComp() {
	if ((document.new_account.ups_check.checked==true)&&(!document.new_account.company_name.value)){
		document.new_account.address.focus();
		sUps = window.open("ups.php", "UPS", "resizable=1,scrollbars=1,width=450,height=310");
	}
}

