
function is_empty(str)
{
	return ( str==null || str==0 || str=="" || str.length<1 );
} // is_empty



function is_numeric(str)
{
	regularExp = new RegExp("^[0-9-.]*$");
	return regularExp.test(str);
} // is_numeric



function is_email(str)
{
	return ( ( str.indexOf("@")>0 ) && ( str.indexOf(".")>0 ) );
} // is_email


function clear_form(frm) {
	frm.reset();
}

// function to change the department based in the parameter sent
function chooseEmail(dpt)
{
	var obj = document.getElementById("contact");
	var opt;

	if ( !is_empty(dpt) )
	{
		dpt = dpt.toLowerCase();

		for(var i=0;i<obj.length;i++)
		{
			opt =obj.options[i].text;
			opt = opt.toLowerCase();

			if ( opt.indexOf(dpt) >= 0 )
			{
				obj.options.selectedIndex=i;
			}//if

		}//for
	}
}//chooseEmail


// funtion to get the url domain of the site
function getURL(uri)
{
	uri.dir = location.href.substring(0, location.href.lastIndexOf('\/'));
	uri.dom = uri.dir;
	var pos = uri.dom.lastIndexOf('\/');
	if (pos > -1)
	{
		uri.dom = uri.dom.substr(0,pos);
	}
	return uri;
}// getURL

// fuction to use target blank in xhtml strict
function transformExternalAnchors()
{
	var i,a,f;
	if ( document.getElementsByTagName )
	{

		a = document.getElementsByTagName("a");
		i = 0;

		// for using in normal href tag, you you have to add: rel="external"
		// example: <a href="http://affiliate.dptsportsgroup.com" rel="external">Affiliate program</a>
		for(i=0;i<a.length;i++)
		{
			if ( a[i].getAttribute('href') && ( a[i].getAttribute("rel")=="external" ) )
			{
				a[i].target = "_blank";
			}
		} // for

		f = document.getElementsByTagName("form");
		i = 0;

		// for using in forms, you have to add in the form tag: title="external"
		// example: 		<form action=# id="frmId" title="external"></form>
		for(i=0;i<f.length;i++)
		{
			if ( f[i].getAttribute('action') && ( f[i].getAttribute("title")=="external" ) )
			{
				f[i].target = "_blank";
			}
		} // for
	} // if
} // transformExternalAnchors

window.onload = transformExternalAnchors;

/*

Correctly handle PNG transparency in Win IE 5.5 & 6.
http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.

Use in <HEAD> with DEFER keyword wrapped in conditional comments:
<!--[if lt IE 7]>
<script defer type="text/javascript" src="png.js"></script>
<![endif]-->

*/

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

if ((version >= 5.5) && (document.body.filters))
{
   for(var i=0; i<document.images.length; i++)
   {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
      {
         var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
         img.outerHTML = strNewHTML
         i = i-1
      }
   }
}