// JavaScript Document
function showFormDiv(imgId,productName)
{
	//Find Span to Replace Text
	objSpanProdName = document.getElementById('spanProdName');
	objHdnProduct = document.getElementById('hdnProduct');
	objHdnProduct.value = productName;
	objSpanProdName.innerHTML = productName;
	
	objPosImage = document.getElementById(imgId);
	posX = findPosX(objPosImage);
	posY = findPosY(objPosImage);
	divFormBubble.style.left = posX - 180;
	divFormBubble.style.top = posY - 240;
	divFormBubble.className = 'show';
}

function hideFormBubble()
{
	divFormBubble.className = 'hide';
	divFormBubble.style.left = 0;
	divFormBubble.style.top = 0;
	window.location.href=window.location.href;
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}
function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function sendFormViaEmail()
{
	objHdnProduct = document.getElementById('hdnProduct');
	product = 	objHdnProduct.value;
	end = "%0D%0A";
	message = "I am interested in the:" + end + end
	if (document.getElementById('chkFinancial').checked)
	{
		message += "- Financial" + end
	}
	
	if (document.getElementById('chkOLAP').checked)
	{
		message += "- OLAP" + end
	}
	
	if (document.getElementById('chkStats').checked)
	{
		message += "- Statistical" + end
	}
	
	if (document.getElementById('chkMaps').checked)
	{
		message += "- Maps" + end
	}
		if (document.getElementById('chkOther').checked && document.getElementById('txtExtRequest').value!='')
	{
		message += "- " + document.getElementById('txtExtRequest').value + end
	}
	message +=  end + "Extension(s) for " + product + ".";
	
	if (document.getElementById('chkFinancial').checked || document.getElementById('chkMaps').checked || document.getElementById('chkStats').checked || document.getElementById('chkOLAP').checked || document.getElementById('chkOther').checked)
	{
		parent.location='mailto:sales@softwarefx.com?cc=ivang@softwarefx.com&subject=Interest in New Extensions&body=' + message;
		window.location.href=window.location.href;
	}
	else
	{
		alert("Please select at least one Extension before you email.");
	}
}
