// JavaScript Document

<!--
function getHeight(name, name2, name3, name4) {
	var height = document.getElementById(name).offsetHeight;

	document.getElementById(name2).style.height = (height - 3) + "px";
	if((height == 14) || (height == 39))
	{
		document.getElementById(name4).style.height = "236px";
		document.getElementById(name3).style.marginTop = "-28px";
		document.getElementById(name3).style.borderTopWidth = "26px";
	}
	else if(height == 44)
	{
		document.getElementById(name4).style.height = "238px";
		document.getElementById(name3).style.marginTop = "-25px";
		document.getElementById(name3).style.borderTopWidth = "23px";
	}
	else if(height == 59)
	{
		document.getElementById(name4).style.height = "229px";
		document.getElementById(name3).style.marginTop = "-35px";
		document.getElementById(name3).style.borderTopWidth = "33px";
	}
	else if(height == 74)
	{
		document.getElementById(name4).style.height = "259px";
		document.getElementById(name3).style.marginTop = "-32px";
		document.getElementById(name3).style.borderTopWidth = "30px";
	}
	else if(height == 89)
	{
		document.getElementById(name4).style.height = "259px";
		document.getElementById(name3).style.marginTop = "-30px";
		document.getElementById(name3).style.borderTopWidth = "28px";
	}
}

function getMainBoxHeight(mainBox, bgBox, bodyIndex, sideOtherBox, imgHeight, imgHeight2, imgHeight3, imgHeight4, imgHeight5, abort) {
	var height;	
	//alert(" sideOtherBox = " + document.getElementById(sideOtherBox).offsetHeight + " imgHeight = " + parseInt(imgHeight) + " imgHeight2 = " + parseInt(imgHeight2) + " imgHeight3 = " + parseInt(imgHeight3));
	if(document.getElementById(sideOtherBox))
	{
		textHeight = document.getElementById(sideOtherBox).offsetHeight;
	}
	else
	{
		textHeight = 0;
	}
	
	if((document.getElementById(mainBox).offsetHeight - 52) < (textHeight + 220 + parseInt(imgHeight) + parseInt(imgHeight2) + parseInt(imgHeight3) + parseInt(imgHeight4) + parseInt(imgHeight5)))
	{
		height = textHeight + 250 + parseInt(imgHeight) + parseInt(imgHeight2) + parseInt(imgHeight3) + parseInt(imgHeight4) + parseInt(imgHeight5);
	}
	else
	{
		height = document.getElementById(mainBox).offsetHeight - 20;
	}
	
	if(abort == 'no' && textHeight < 100)
		height -= 30;
		
	document.getElementById(bgBox).style.height = (height + 51) + "px";
	
	if((height+320) > document.getElementById(bodyIndex).offsetHeight)
	{
		document.getElementById(bodyIndex).style.height = (height+310) + "px";	
	}			
			
	var top = 100;
	var i = 0;
	
	for(i = 0; i < (height-80); i += 10)
	{
		 var newdiv = document.createElement("div");
		 var newID = "bg" + i;
		 newdiv.setAttribute("id",newID);
		 newdiv.style.width = "620px";		 
       	 newdiv.style.height = "10px";
		 newdiv.style.backgroundImage = "url(images/fullProductMiddle.png)";
		 newdiv.style.position = "absolute";
		 newdiv.style.left = "0px"		 
		 newdiv.style.top = (top + i) + "px";		 
		 document.getElementById(bgBox).appendChild(newdiv);
	}
	
	var newdiv = document.createElement("div");
	var newID = "bg" + i;
	newdiv.setAttribute("id",newID);
	newdiv.style.width = "620px";		 
	newdiv.style.height = "100px";
	newdiv.style.backgroundImage = "url(images/fullProductBottom.png)";
	newdiv.style.position = "absolute";
	newdiv.style.left = "0px"		 
	newdiv.style.top = (top + i - 32) + "px";
	document.getElementById(bgBox).appendChild(newdiv);
}

function getRelatedBoxHeight(relatedMainBox, relatedBGBox, heights, mainBox, bodyIndex, count, id0, id1, id2, id3) {	
	if(count == 4)
	{
		var height = heights + document.getElementById(id0).offsetHeight + document.getElementById(id1).offsetHeight + document.getElementById(id2).offsetHeight + document.getElementById(id3).offsetHeight + 295;
	}
	if(count == 3)
	{
		var height = heights + document.getElementById(id0).offsetHeight + document.getElementById(id1).offsetHeight + document.getElementById(id2).offsetHeight + 235;
	}
	else if(count == 2)
	{
		var height = heights + document.getElementById(id0).offsetHeight + document.getElementById(id1).offsetHeight + 175;
	}
	else if(count == 1)
	{
		var height = heights + document.getElementById(id0).offsetHeight + 125;
	}
	
	document.getElementById(relatedBGBox).style.height = height + "px";
		
	var top = 100;
	var i = 0;
	
	if((height+180) > document.getElementById(bodyIndex).offsetHeight)
	{
		document.getElementById(bodyIndex).style.height = (height+210) + "px";
	}
	
	for(i = 0; i < (height-185); i += 10)
	{
		 var newdiv = document.createElement("div");
		 var newID = "rbg" + i;
		 newdiv.setAttribute("id",newID);
		 newdiv.style.width = "210px";		 
       	 newdiv.style.height = "10px";
		 newdiv.style.backgroundImage = "url(images/relatedBoxMiddle.png)";
		 newdiv.style.position = "absolute";
		 newdiv.style.left = "0px"		 
		 newdiv.style.top = (top + i) + "px";		 
		 document.getElementById(relatedBGBox).appendChild(newdiv);
	}
	
	 var newdiv = document.createElement("div");
	 var newID = "rbg" + i;
	 newdiv.setAttribute("id",newID);
	 newdiv.style.width = "210px";		 
	 newdiv.style.height = "100px";
	 newdiv.style.backgroundImage = "url(images/relatedBoxBottom.png)";
	 newdiv.style.position = "absolute";
	 newdiv.style.left = "0px"		 
	 newdiv.style.top = (top + i - 15) + "px";
	 document.getElementById(relatedBGBox).appendChild(newdiv);
	 //alert(height + " " + heights);
}

function getSearchResultsHeight(first, last, total, bodyIndex, bottomPageNos)
{
	if(last - first < 4)
	{
		document.getElementById(bodyIndex).style.height = 650 + "px";	
		document.getElementById(bottomPageNos).style.top = 592 + "px";		 
	} 
	else if(last - first < 8)
	{
		document.getElementById(bodyIndex).style.height = 924 + "px";	
		document.getElementById(bottomPageNos).style.top = 866 + "px";	
	} 
	else
	{
		document.getElementById(bodyIndex).style.height = 1251 + "px";	
		document.getElementById(bottomPageNos).style.top = 1193 + "px";	
	}
}

function getNoResultsHeight(bodyIndex, bottomPageNos)
{
		document.getElementById(bodyIndex).style.height = 650 + "px";	
		document.getElementById(bottomPageNos).style.top = 592 + "px";	
}

function getThumbHeight(place, title, imgHeight)
{
	document.getElementById(place).style.top = (document.getElementById(title).offsetHeight + imgHeight - 30) + "px";
}

function setShadowHeight(middleShadow, bodyIndex)
{
	document.getElementById(middleShadow).style.height = (document.getElementById(bodyIndex).offsetHeight - 136) + "px";
}

function adjustPosition(totalWidth, num, jsArray, width)
{
	var i = 0;
	var space = Math.abs((width - totalWidth) / (num - 2));
	var leftSpacing = 0;
	var difference = 0;
	
	if(space < 3)
	{
		difference = 12;
	}
	else if(space < 6)
	{
		difference = 17;
	}
	else if(space < 9)
	{
		difference = 22;
	}
	else
	{
		difference = 27;
	}
	
	for(i = 0; i < (num - 1); i++)
	{
		var spacer = 'spacer' + (i + 1);
		var product = 'product' + (i + 1);
		leftSpacing += parseFloat(jsArray[i]) + space;
		document.getElementById(spacer).style.width = space + "px";
		document.getElementById(product).style.left = (leftSpacing - difference - (i/2)) + "px";
	}	
	
	$(document).ready(function(){    
		$('#productsFadePanel').delay(900).fadeOut('slow');
	});	
}
//-->
