<!--

function isEmail( str )

{

  // are regular expressions supported?

  var supported = 0;

  if (window.RegExp) {

    var tempStr = "a";

    var tempReg = new RegExp(tempStr);

    if (tempReg.test(tempStr)) supported = 1;

  }

  if (!supported) 

    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);

  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");

  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");

  return (!r1.test(str) && r2.test(str));

}



function trim(inputString) {

   if (typeof inputString != "string") { return inputString; }

   var retValue = inputString;

   var ch = retValue.substring(0, 1);

   while (ch == " ") { // Check for spaces at the beginning of the string

      retValue = retValue.substring(1, retValue.length);

      ch = retValue.substring(0, 1);

   }

   ch = retValue.substring(retValue.length-1, retValue.length);

   while (ch == " ") { // Check for spaces at the end of the string

      retValue = retValue.substring(0, retValue.length-1);

      ch = retValue.substring(retValue.length-1, retValue.length);

   }

   return retValue; // Return the trimmed string back to the user

} 



function isInt(inputString) {

	if(parseFloat(inputString)!="NaN")

	{

		

	}

} 



function isBlank(str, mlen)

{

	//alert("checking");

	if(!mlen) 

	{

		mlen = 1;

	}

	//alert(mlen);

	str = trim( str );

	//alert(str.length);

	if( str.length < mlen )

		return true;

	else

		return false;

}



function isImage(name)

{

	if( !name || trim(name).length < 4 )

	{

		return false

	}

	name = trim(name);

	name=name.toLowerCase();

	name = name.substr((name.length-4));



	if( name.indexOf(".gif")== -1 && name.indexOf(".jpg")== -1 && name.indexOf("jpeg")== -1 && name.indexOf(".png")== -1)

	{		return false;		}

	else

	{	return true;}

	

}



// Credit Card Validation Javascript

// copyright 12th May 2003, by Stephen Chapman, Felgall Pty Ltd



// You have permission to copy and use this javascript provided that

// the content of the script is not changed in any way.



function validateCreditCard(s) {



var v = "0123456789";

var w = "";

for (var i=0; i < s.length; i++) {

x = s.charAt(i);

if (v.indexOf(x,0) != -1)

w += x;

}

var j = w.length / 2;



if (j < 6.5 || j > 8 || j == 7) 

{

	return false;

}



return true;

}



function numbersonly(myfield, e, dec)

{

var key;

var keychar;



if (window.event)

   key = window.event.keyCode;

else if (e)

   key = e.which;

else

   return true;

keychar = String.fromCharCode(key);



// control keys

if ((key==null) || (key==0) || (key==8) || 

    (key==9) || (key==13) || (key==27) )

   return true;



// numbers

else if ((("0123456789.").indexOf(keychar) > -1))

   return true;



// decimal point jump

else if (dec && (keychar == "."))

   {

   myfield.form.elements[dec].focus();

   return false;

   }

else

   return false;

}





function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}



function MM_validateForm() { //v4.0

  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;

  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);

    if (val) { nm=val.name; if ((val=val.value)!="") {

      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');

        if (p<1 || p==(val.length-1)) errors+='- '+args[i+1]+' must contain an e-mail address.\n';

      } else if (test!='R') { num = parseFloat(val);

        if (isNaN(val)) errors+='- '+args[i+1]+' must contain a number.\n';

        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');

          min=test.substring(8,p); max=test.substring(p+1);

          if (num<min || max<num) errors+='- '+args[i+1]+' must contain a number between '+min+' and '+max+'.\n';

    } } } else if (test.charAt(0) == 'R') errors += '- '+args[i+1]+' is required.\n'; }

  } if (errors) alert('The following error(s) occurred:\n'+errors);

  document.MM_returnValue = (errors == '');

}

//-->