var g_childWindow = null;

function StatusOff(){ return onText(""); }
function onText(str){ window.status = str; return true }
function Yours()    { return onText("Continue with purchase");}
function YoursRequest()    { return onText("Continue with request");}

function doJump(url)
{
	if (url != "")
		top.location.href = url;	
}

function OpenChildWindow(childURL, childName, childFeatures){
	
	if (!FindChildWindow(childName))
		g_childWindow = window.open(childURL, childName, childFeatures);

	g_childWindow.focus();

	if (document.location.protocol == "http:")
		g_childWindow.document.location.href=childURL;	

}

function CloseChildWindow(){
	if (g_childWindow != null){
		if (!g_childWindow.closed)
			g_childWindow.close();
		g_childWindow = null;
	}
}

function FindChildWindow(childName){
	if ((g_childWindow != null) && (g_childWindow.closed != true)){
		g_childWindow = window.open("", childName);
		return true;
	}
	else
		return false;
}

function GetElementInDocument(inDoc, elementName)
{
	with (inDoc) {
		for (var i = 0; i < forms.length; i++) {
			if (forms[i].name == elementName) return forms[i];
			var el = GetElementInForm(forms[i], elementName)
			if (el != null) return el;
		}
	}
	return null;
}

function GetElement(elementName)
{
	if (document.getElementsByName) {
		var el = document.getElementsByName(elementName).item(0);
		if (el != null) return el;

	} else if (document.all == null) {
		var el;
		el = GetElementInDocument(document, elementName);
		if (el != null) return el;

		with (document)
			for (var i = 0; i < layers.length; i++) {
				el = GetElementInDocument(layers[i].document, elementName);
				if (el != null) return el;
			}

	} else {
		with (document)
			for (var i = 0; i < all.length; i++)
				if (all(i).name == elementName)
					return all(i);
	}	
	return null;
}

function getInsideWindowWidth()
{
	if (document.all == null)
		return window.innerWidth;
	else
		return document.body.clientWidth;
}

function safemail(name, domain, display) {
displayed=(typeof(display)=="undefined") ? name+"@"+domain : display
document.write('<a href=mailto:' + name + '@' + domain + '>' + displayed + '</a>');
}

function subjectmail(name, domain, display, subject) {
displayed=(typeof(display)=="undefined") ? name+"@"+domain : display
document.write('<a href=mailto:' + name + '@' + domain + '?subject=' + subject + '>' + displayed + '</a>');
}

function imagemail(name, domain, display, txt) {
document.write('<a href=mailto:' + name + '@' + domain + '>' + '<img src="' + display + '" border="0" alt="' + txt + name + '@' + domain + '"></a>');
}
