/*
	Standard JavaScript functions collection
	(C) 2001 Tuukka Haapasalo / MMD Group Ltd.
	Coupl'a functions grabbed from www.javascripts.com...
*/

function winOpen(URL)
{
	var info;
	info = window.open(URL, info, 'toolbar=0,width=650,height=600,location=0,scrollbars=1,resizable=1,menubar=0')
	info.focus(); 
	return info;
}

function alertJump(text, URL)
{
	window.alert(text);
	self.location = URL;
	return(true);
}

function winOpenSize(URL, width, height, extra)
{
	var info;
	info = window.open(URL, info, 'toolbar=0,width='+width+',height='+height+',location=0,resizable=1,menubar=0,'+extra)
	info.focus(); 
	return info;
}

function jumpIf(text, URL)
{
	if (confirm(text) == true) 
	{ 
		self.location = URL; 
		return true; 
	}
}

function parentJumpChoose(text, URLT, URLF)
{
	if (confirm(text) == true) 
	{ 
		parent.location = URLT; 
		return true; 
	}
	else
	{
		parent.location = URLF; 
		return true; 
	}
}

function jumpChoose(text, URLT, URLF)
{
	if (confirm(text) == true) 
	{ 
		self.location = URLT; 
		return true; 
	}
	else
	{
		self.location = URLF; 
		return true; 
	}
}

function scrollWindow() 
{
	this.scroll(0, 128000);
	this.scroll(0, 128000);
}

function doSlideShow(imageName, base, imageCount, current)
{
	var newNum;
	var runFunc;
	newNum = current + 1;
	if (newNum > imageCount) { newNum = 1; }
	document.images[imageName].src = base + newNum + ".jpg";
	setTimeout("doSlideShow('"+imageName+"', '"+base+"', "+imageCount+", "+newNum+");", 7000);
}

function explode(splitter, theStr)
{
	var table = new Array();
	cPos = 0;
	while ((spPos = theStr.indexOf(splitter)) >= 0)
	{
		table.length = table.length+1;
		table[cPos] = theStr.substring(0, spPos);
		cPos++;
		theStr = theStr.substring(spPos+1, theStr.length);
	}
	table[cPos] = theStr;
	return(table);
}

function checkRequired(element)
{
	if (element.value == "") return false;
	return true;
}

function sendForm(fName, message)
{
	var reqs = fName.elements["required"];
	if (reqs)
	{
		fields = explode(",", reqs.value);
		for(i = 0; i < fields.length; i++)
		{
			element = fName.elements[fields[i]];
			if (element)
			{
				if (!checkRequired(element))
				{
					window.alert(message+": "+fields[i]);
					return false;
					break;
				}
			}
		}
	}
	return true;
}

function isNetscape(v) 
{
	return isBrowser("Netscape", v);
}

function isMicrosoft(v) 
{
	return isBrowser("Microsoft", v);
}

function isBrowser(b,v) 
{
   /*
   ** Check if the current browser is compatible
   **  b  browser name
   **  v  version number (if 0 don't check version)
   ** returns true if browser equals and version equals or greater
   */
	browserOk = false;
	versionOk = false;

	browserOk = (navigator.appName.indexOf(b) != -1);
	if (v == 0) versionOk = true;
	else versionOk = (v <= parseInt(navigator.appVersion));
	return browserOk && versionOk;
}


function WM_imageSwap(daImage, daSrc)
{
	var objStr, obj;
	window.alert('Swapping ' + daImage + ' to ' + daSrc);
	/*
		WM_imageSwap()
		Changes the source of an image.

		Source: Webmonkey Code Library
		(http://www.hotwired.com/webmonkey/javascript/code_library/)

		Author: Shvatz
		Author Email: shvatz@wired.com

		Usage: WM_imageSwap(originalImage, 'newSourceUrl');

		Requires: WM_preloadImages() (optional, but recommended)
		Thanks to Ken Sundermeyer (ksundermeyer@macromedia.com) for his help
		with variables in ie3 for the mac. 
	*/

	// Check to make sure that images are supported in the DOM.
	if(document.images)
	{
		// Check to see whether you are using a name, number, or object
		if (typeof(daImage) == 'string') 
		{
			// This whole objStr nonsense is here solely to gain compatibility
			// with ie3 for the mac.
			objStr = 'document.' + daImage;
			obj = eval(objStr);
			obj.src = daSrc;
		}
		else if ((typeof(daImage) == 'object') && daImage && daImage.src) 
		{
			daImage.src = daSrc;
		}
	}
}
