function convertCalculate(intConvertType)
{
// 1 sq metre = 0.0929 sq. feet
// 1 sq feet = 10.764 sq metre

var txtToConvert;
var txtToShow;
var intMultiply;
var strAlert;

if (intConvertType == 1)
	{
	txtToConvert = document.getElementById("txtMetres");
	txtToShow = document.getElementById("txtFeet");
	intMultiply = 10.764;
	strAlert = "Please enter sq. metres in digits to calculate the equivalent sq. feet";
	}
else
	{
	txtToConvert = document.getElementById("txtFeet");
	txtToShow = document.getElementById("txtMetres");
	intMultiply = 0.0929;
	strAlert = "Please enter sq. feet in digits to calculate the equivalent sq. metres";
	}

if (isNaN(txtToConvert.value) || txtToConvert.value == "")
	{
	alert("Please enter sq. metres in digits to calculate the equivalent sq. feet");
	}
else
	{
	txtToShow.value = txtToConvert.value * intMultiply;
	}
}


// ****** POPUP DIV ****** //
function getStyleObject(objectId)
{
if(document.getElementById && document.getElementById(objectId))
	{
	// W3C DOM
	return document.getElementById(objectId).style;
	}
else if (document.all && document.all(objectId))
	{
	// MSIE 4 DOM
	return document.all(objectId).style;
	}
else if (document.layers && document.layers[objectId])
	{
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
	}
else
	{
	return false;
	}
}


function changeObjectVisibility(objectId, newVisibility)
{
var styleObject = getStyleObject(objectId);

if(styleObject)
	{
	styleObject.visibility = newVisibility;
	return true;
	}
else
	{
	// we couldn't find the object, so we can't change its visibility
	return false;
	}
}
// ****** POPUP DIV ****** //





var xOffset = 30;
var yOffset = -5;

function showPopup (targetObjectId, eventObj)
{
if(eventObj)
	{
	hideCurrentPopup();
	eventObj.cancelBubble = true;
	
	if( changeObjectVisibility(targetObjectId, 'visible') )
		{
		window.currentlyVisiblePopup = targetObjectId;
		return true;
		}
	else
		{
		return false;
		}
	}
else
	{
	return false;
	}
}


function hideCurrentPopup()
{
if(window.currentlyVisiblePopup)
	{
	changeObjectVisibility(window.currentlyVisiblePopup, 'hidden');
	window.currentlyVisiblePopup = false;
	}
}


// ***********************
// hacks and workarounds *
// ***********************

window.onload = initializeHacks;
document.onclick = hideCurrentPopup;

function initializeHacks()
{
if ((navigator.appVersion.indexOf('MSIE 5') != -1) && (navigator.platform.indexOf('Mac') != -1) && getStyleObject('blankDiv'))
	{
	window.onresize = explorerMacResizeFix;
	}

resizeBlankDiv();
createFakeEventObj();
}


function createFakeEventObj()
{
if (!window.event)
	{
	window.event = false;
	}
}


function resizeBlankDiv()
{
if ((navigator.appVersion.indexOf('MSIE 5') != -1) && (navigator.platform.indexOf('Mac') != -1) && getStyleObject('blankDiv'))
	{
	getStyleObject('blankDiv').width = document.body.clientWidth - 20;
	getStyleObject('blankDiv').height = document.body.clientHeight - 20;
	}
}


function explorerMacResizeFix()
{
location.reload(false);
}