/*---------------------------------------------------------------------------------------------------------------------
Copyright (C) 2003 Multimedia Solutions Corporation.
All rights reserved.

Description:	GENERAL FUNCTIONS
				Juan F. Sarria
Date:			04/23/2003
Modified:		12/10/2003
----------------------------------------------------------------------------------------------------------------------*/

var scrollHeight = 0;

var MM_contentVersion = 4;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
		for (var i = 0; i < words.length; ++i)
		{
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i]; 
		}
	var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}

function GetScrollHeight() {
	scrollHeight = (document.all) ? document.body.scrollHeight: document.height;
}

function LocateFooter() {
	var iBottom = 0;

	if (document.all) { // IE
		iBottom = (document.body.clientHeight > scrollHeight) ? document.body.clientHeight: scrollHeight;
		document.all["lyfooter"].style.pixelTop = iBottom - parseInt(document.all["lyfooter"].style.height);
	}
	else if (document.layers) { // NS
		iBottom = (self.innerHeight > scrollHeight) ? self.innerHeight: scrollHeight;
		document.layers["lyfooter"].top = parseInt(iBottom - document.layers["lyfooter"].document.height);
	}
	else if (document.getElementById) { //NS6
		iBottom = (self.innerHeight > scrollHeight) ? self.innerHeight: scrollHeight;
		document.getElementById("lyfooter").style.top = (parseInt(iBottom - parseInt(document.getElementById("lyfooter").style.height))) + "px";		
	}
}

function isEmailAddress(string) {
	var addressPattern =/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return addressPattern.test(string);
}

function isZipCode(string) {
	var ZipCodePattern = /^\d{5,}\-{0,1}\d*/;
	return ZipCodePattern .test(string);
}

function ltrim(str)
{	
	if (typeof(str) == "boolean") return '';
	if(str == null) return '';
	while(str.charAt(0) == ' ') str = str.substring(1, str.length);
	return str;
}
function rtrim(str)
{
	if (typeof(str) == "boolean") return '';
	if(str == null) return '';
	while(str.charAt(str.length - 1) == ' ') str = str.substr(0, str.length - 1);
	return str;
}
function trim(str) {
  var tmpstr = ltrim(str);

  return rtrim(tmpstr);
}