function blocking(nr,img)
{
	if (document.layers)
	{
		current = (document.layers[nr].display == 'none') ? 'block' : 'none';
		//imgSrc = (document.layers[nr].display == 'none') ? '../images/minus.gif' : '../images/plus.gif';
		document.layers[nr].display = current;
		//document.images[img].src = imgSrc;
	}
	else if (document.all)
	{
		current = (document.all[nr].style.display == 'none') ? 'block' : 'none';
		//imgSrc = (document.all[nr].style.display == 'none') ? '../images/minus.gif' : '../images/plus.gif';
		document.all[nr].style.display = current;
		//document.images[img].src = imgSrc;
	}
	else if (document.getElementById)
	{
		vista = (document.getElementById(nr).style.display == 'none') ? 'block' : 'none';
		//imgSrc = (document.getElementById(nr).style.display == 'none') ? '../images/minus.gif' : '../images/plus.gif';
		document.getElementById(nr).style.display = vista;
		//document.images[img].src = imgSrc;
	}
}

function ccExpired( month, year ) {
	var now = new Date();							// this function is designed to be Y2K compliant.
    var expiresIn = new Date(year,month,0,0,0);		// create an expired on date object with valid thru expiration date
    expiresIn.setMonth(expiresIn.getMonth()+1);		// adjust the month, to first day, hour, minute & second of expired month
    if( now.getTime() < expiresIn.getTime() ) return false;
    return true;									// then we get the miliseconds, and do a long integer comparison
}

function ccMod10( cardNumber ) { // LUHN Formula for validation of credit card numbers.
	var ar = new Array( cardNumber.length );
	var i = 0,sum = 0;


    for( i = 0; i < cardNumber.length; ++i ) {
    	ar[i] = parseInt(cardNumber.charAt(i));
    }
    for( i = ar.length -2; i >= 0; i-=2 ) { // you have to start from the right, and work back.
    	ar[i] *= 2;							 // every second digit starting with the right most (check digit)
    	if( ar[i] > 9 ) ar[i]-=9;			 // will be doubled, and summed with the skipped digits.
    }										 // if the double digit is > 9, ADD those individual digits together
    for( i = 0; i < ar.length; ++i ) {
    	sum += ar[i];						 // if the sum is divisible by 10 mod10 succeeds
    }
    return (((sum%10)==0)?true:false);
}

function getRadioValue(rgrp)
{
	var i = rgrp.length;
	do
		if (rgrp[--i].checked)
			return rgrp[i].value;
	while (i);
	return '';
}

function isNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;


   for (i = 0; i < sText.length && IsNumber == true; i++)
      {
      Char = sText.charAt(i);
      if (ValidChars.indexOf(Char) == -1)
         {
         IsNumber = false;
         }
      }
   return IsNumber;

}

function addslashes(str) {
  str=str.replace(/\'/g,'\\\'');
  str=str.replace(/\"/g,'\\"');
  str=str.replace(/\\/g,'\\\\');
  str=str.replace(/\0/g,'\\0');
  return str;
}

function stripslashes(str) {
  str=str.replace(/\\'/g,'\'');
  str=str.replace(/\\"/g,'"');
  str=str.replace(/\\\\/g,'\\');
  str=str.replace(/\\0/g,'\0');
  return str;
}

function validEmail(str)
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(str)) return true;
	else return false;
}
