// JavaScript Create Product Tables

var h = 0;
var iw = 0;
var bw = 0;
var tnp = 0;
var tw = 0;
var ntw = 0;

function tableVariables(height, image_width, body_width, thumb_amount, table_id)
{
	h = height;	
	iw = image_width;
	bw = body_width;
	if (thumb_amount == 0) {
		tw = (30 + bw + iw); }
	else {
		tw = (70 + bw + iw); }
	tnp = Math.round(((height-32)/thumb_amount));
	tableID=table_id;
	
	ptImageWidth = image_width;
	ptImageHeight = height;
	ptThumbHeight = (37 * thumb_amount);
	if (ptImageHeight < ptThumbHeight) {
	    ptImageHeight = ptThumbHeight+2; }
	ptTextWidth = body_width;
	ptTextHeight = ptImageHeight - 26;
	if (thumb_amount == 0) {
		ptThumbWidth = 0; }
	else {
		ptThumbWidth = 44; }
	ptOuterWidth = ptTextWidth + ptImageWidth + ptThumbWidth + 30;
	ptInnerWidth = ptOuterWidth - 30;
	ptOuterHeight = ptImageHeight + 40;

    ltContentHeight = height;
	ltContentWidth = image_width;
	ltWidth = image_width + 200;	
}
function beforeInfo()
{
document.write('<div id="' + tableID + '" style="height:' + (h + 15) + 'px;clear:both;"><div class="productTable" style="width:' + tw + 'px;" ><table style="width:15px" cellspacing="0"><tr><td class="ttl"></td></tr><tr><td class="tl" style="height:' + (h - 30) + 'px"></td></tr><tr><td class="tbl"></td></tr></table><table style="width:' + bw + 'px"cellspacing="0"><tr><td class="tt"></td></tr><tr><td class="bodytext" style="height:' + (h - 12) + 'px">');
}
function beforeImage()
{
document.write('</td></tr><tr><td class="tb"></td></tr></table><table style="width:' + iw + 'px" cellspacing="0"><tr><td class="tt"></td></tr><tr><td class="body" style="height:' + (h - 40) + 'px;background:url(/images/graphics/loadimage.gif) center center no-repeat;background-color:#2E2E2E;">');
}
function beforeButtons()
{
document.write('</td></tr><tr><td class="body" style="height:28px;padding:0;" >');
}
function beforeThumbnails()
{
document.write('</td></tr><tr><td class="tb"></td></tr></table><table style="width:54px" cellspacing="0"><tr><td class="ttfr" style="width:39px"></td><td class="ttr"></td></tr><tr><td class="tfr" colspan="2" style="height:' + (h - 30) + 'px" valign="top"><table class="thumbnails" cellspacing="0" style="width:54px"><tr><td valign="middle">');
}
function beforeProductThumbnails()
{
document.write('</td></tr><tr><td class="tb"></td></tr></table><table style="width:54px" cellspacing="0"><tr><td class="ttfr" style="width:39px"></td><td class="ttr"></td></tr><tr><td class="tfr" colspan="2" style="height:' + (h - 30) + 'px" valign="top"><table class="thumbnails" cellspacing="0" style="width:54px"><tr><td valign="middle"><span style="font-size:9px;color:#BFBFBF;">Products</span></td></tr><tr><td valign="middle">');
}
function betweenThumbnails()
{
document.write('</td></tr><tr><td valign="middle">');
}
function beforePhotoThumbnails()
{
document.write('</td></tr><tr><tr><td valign="middle"><span style="font-size:9px;color:#BFBFBF;">Photos</span></td></tr><td valign="middle">');
}
function beforeDefaultThumbnails()
{
document.write('</td></tr><tr><tr><td valign="middle"><span style="font-size:9px;color:#BFBFBF;">Default</span></td></tr><td valign="middle">');
}
function endTable()
{
document.write('</td></tr></table></td></tr><tr><td class="tbfr" style="width:39px"></td><td class="tbr"></td></tr></table></div></div>');
}

function noThumbs()
{
document.write('</td></tr><tr><td class="tb"></td></tr></table><table style="width:15px" cellspacing="0"><tr><td class="ttr"></td></tr><tr><td class="tr" style="height:' + (h - 30) + 'px"></td></tr><tr><td class="tbr"></td></tr></tr></table></div></div>');
}
function beforeBody()
{
document.write('<div id="' + tableID + '"><div class="productTable" style="height:' + (h + 10) + 'px;padding:5px 0;width:' + tw + 'px;" ><table style="width:15px" cellspacing="0"><tr><td class="ttl"></td></tr><tr><td class="tl" style="height:' + (h - 30) + 'px"></td></tr><tr><td class="tbl"></td></tr></table><table style="width:' + bw + 'px"cellspacing="0"><tr><td class="tt"></td></tr><tr><td style="background-color:#2E2E2E;height:' + (h - 12) + 'px">');
}
function startBorder()
{
	document.write('<div class="border1"><div class="border2"><div class="border3"><div class="border4"><div class="border5">');
}
function endBorder()
{
	document.write('</div></div></div></div></div>');
}

function ptText()
{
	document.write('<div id="' + tableID + '"><div class="pt" style="width:' + ptOuterWidth + 'px;height:' + ptOuterHeight + 'px;"><div class="ptTopLeft"></div><div class="ptTop" style="width:' + ptInnerWidth + 'px;"></div><div class="ptTopRight"></div><div class="ptLeft" style="height:' + ptImageHeight + 'px;"></div><div class="ptBody" style="height:' + ptImageHeight + 'px;width:' + ptInnerWidth + 'px;"><div class="ptText" style="width:' + ptTextWidth + 'px;"><div style="height:' + ptTextHeight + 'px;padding-right:12px;">');
}

function ptButtons(tc, pc, nmi)
{
	if(tc)
	{
	  document.write('</div><div class="ptButtons"><div id="Table' + tc + '-BN"><a href="javascript://" onclick="return(ShowA2C(\'default\', \'default\', \'' + pc + '\', document.getElementById(\'Table' + tc + '-DC\').value, document.getElementById(\'CartID\').value, \'580\', \'300\'));"><img alt="Click to buy" onmouseover=\'xpe(this,4);\' onmouseout=\'xpe(this,3);\' onmouseup=\'xpe(this,3);\' onmousedown=\'xpe(this, 5);\' src="/images/graphics/buttons/btbuynow_0.gif" name="vb67faa" border="0" /></a>');
	  if(nmi)
	  {
	    if(nmi!='nmi')
		{
		  document.write('<a href="' + nmi + '" id="Table' + tc + '-MI" name="convertLink"><img onmouseup=\'xpe(this,0);\' onmouseover=\'xpe(this,1);\' onmouseout=\'xpe(this,0)\' onmousedown=\'xpe(this,2);\' src="/images/graphics/buttons/btmoreinfo_0.gif" name="vbr7faa" border="0" alt="More Info" title="Click for more information about this product" /></a>');
		}
	  }
	  else
	  {
	    document.write('<a href="javascript://" id="Table' + tc + '-MI" onclick="thumbnailAlert();"><img onmouseup=\'xpe(this,1);\' onmousedown=\'xpe(this,2);\' src="/images/graphics/buttons/btmoreinfo_1.gif" name="vbr7faa" border="0" alt="More Info" title="Please Click Thumbnails First" /></a>');
	  }
	  document.write('</div>');
	}
	else
	{
	  document.write('</div><div class="ptButtons">');
	}
}

function ptImage()
{
	var currentUrl = decodeURIComponent(location.href);
	if (currentUrl.indexOf('/specs/') != -1 || currentUrl.indexOf('/pt/') != -1)
	{
		document.write('</div><div class="ptButtons" style="float:right;margin-right:12px;"><a name="backButtons" href="javascript:history.go(-1);"><img onmouseover=\'xpe(this,39);\' onmouseout=\'xpe(this,40);\' onmouseup=\'xpe(this,40);\' onmousedown=\'xpe(this,41);\' src="/images/graphics/buttons/btmainpage_1.gif" border="0" alt="Go Back" title="Go Back to the Product Page" /></a></div></div><div class="ptImage" style="width:' + ptImageWidth + 'px;height:' + ptImageHeight + 'px;">');
	}
	else
	{
		document.write('</div></div><div class="ptImage" style="width:' + ptImageWidth + 'px;height:' + ptImageHeight + 'px;">');
	}
}

function ptThumbnails()
{
	document.write('</div><div class="ptThumbnails">');
}

function ptEnd(multProds)
{
	var currentUrl = decodeURIComponent(location.href);
	if (currentUrl.indexOf('/specs/') != -1 && multProds > 0)
	{
	  document.write('</div></div><div class="ptRight" style="height:' + ptImageHeight + 'px;"></div><div class="ptBottomLeft"></div><div class="ptBottom" style="width:' + ptInnerWidth + 'px;"></div><div class="ptBottomRight"></div></div><div style="clear:both;"></div></div><p style="margin:0;color:white;font-size:10px;width:100%;text-align:center;">Click on the thumbnails or tabs in the Product Table above to switch between the different Product Specification Pages</p>');	
	}
	else
	{
	  document.write('</div></div><div class="ptRight" style="height:' + ptImageHeight + 'px;"></div><div class="ptBottomLeft"></div><div class="ptBottom" style="width:' + ptInnerWidth + 'px;"></div><div class="ptBottomRight"></div></div><div style="clear:both;"></div></div>');
	}
	
}

function ltStart()
{
	document.write('<div class="ltContainer"><div class="lt" style="width:' + ltWidth + 'px;"><div class="ltOuterBorder" style="width:' + (ltContentWidth - 2) + 'px; height:' + (ltContentHeight + 4) + 'px; margin-left: 4px;"></div><div class="ltOuterBorder" style="width:' + (ltContentWidth + 6) + 'px; height:' + (ltContentHeight-4) + 'px; margin-top: 4px;"></div><div class="ltOuterBorder" style="width:' + (ltContentWidth + 4) + 'px; height:' + ltContentHeight + 'px; margin-top: 2px; margin-left: 1px;"></div><div class="ltOuterBorder" style="width:' + (ltContentWidth + 2) + 'px; height:' + (ltContentHeight + 2) + 'px; margin-top: 1px; margin-left: 2px;"></div><div class="ltInnerBorder" style="width:' + (ltContentWidth - 4) + 'px; height:' + (ltContentHeight + 2) + 'px; margin-top: 1px; margin-left: 5px;"></div><div class="ltInnerBorder" style="width:' + (ltContentWidth + 4) + 'px; height:' + (ltContentHeight - 6) + 'px; margin-top: 5px; margin-left: 1px;"></div><div class="ltInnerBorder" style="width:' + (ltContentWidth + 2) + 'px; height:' + (ltContentHeight - 2) + 'px; margin-top: 3px; margin-left: 2px;"></div><div class="ltInnerBorder" style="width:' + ltContentWidth + 'px; height:' + ltContentHeight + 'px; margin-top: 2px; margin-left: 3px;text-align:center;">');
}

function ltEnd()
{
	document.write('</div></div></div></div><div style="clear: both; margin-top:' + (ltContentHeight + 14) + 'px;"></div>');
}
