<!--
var sc_project=346521; 
var sc_partition=1; 
var sc_invisible=1; 

function popraffle()
{
    win=window.open('gift_certificate.asp','AltPic','width=460,height=600,resizable=yes,scrollbars=yes');
    if (!win.opener) { win.opener=self; }
    win.focus();
    return false;
}


function browse(category)
{
  self.location = "http://"+ location.host + "/gallery.asp?curCat="+category;
}

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
}

function clickAll(obj, nam)
{
  if( obj.form[nam] != undefined )
  {
    if(obj.form[nam].length != undefined )
    {
      for( i = 0 ; i < obj.form[nam].length; i ++ )
        obj.form[nam][i].checked = obj.checked
    }
    else
      obj.form[nam].checked = obj.checked
  }
}

function replaceAll(oldStr,findStr,repStr) {
  var srchNdx = 0;  // srchNdx will keep track of where in the whole line
                    // of oldStr are we searching.
  var newStr = "";  // newStr will hold the altered version of oldStr.
  while (oldStr.indexOf(findStr,srchNdx) != -1)  
                    // As long as there are strings to replace, this loop
                    // will run. 
  {
    newStr += oldStr.substring(srchNdx,oldStr.indexOf(findStr,srchNdx));
                    // Put it all the unaltered text from one findStr to
                    // the next findStr into newStr.
    newStr += repStr;
                    // Instead of putting the old string, put in the
                    // new string instead. 
    srchNdx = (oldStr.indexOf(findStr,srchNdx) + findStr.length);
                    // Now jump to the next chunk of text till the next findStr.           
  }
  newStr += oldStr.substring(srchNdx,oldStr.length);
                    // Put whatever's left into newStr.             
  return newStr;
}

function setSelect(obj,val)
{
  for( i = 0 ; i < obj.length; i++)
  {
    if( obj[i].value == val )
    {
      obj.selectedIndex = i ;
      break;
    }
  }
}

function mod10( 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 expired( 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 validateCard(cardNumber,cardType,cardMonth,cardYear) {
	if( cardNumber.length == 0 ) {
		alert("Please enter a valid card number.");
		return false;				
	}
	for( var i = 0; i < cardNumber.length; ++i ) {
		var c = cardNumber.charAt(i);


		if( c < '0' || c > '9' ) {
			alert("Please enter a valid card number. Use only digits. do not use spaces or hyphens.");
			return false;
		}
	}
  var length = cardNumber.length;			//perform card specific length and prefix tests

	switch( cardType ) {

		case '3':

  		if( length != 15 ) {
  			alert("Please enter a valid American Express Card number.");
  			return;
  		}
  		var prefix = parseInt( cardNumber.substring(0,2));
  
  
			if( prefix != 34 && prefix != 37 ) {
				alert("Please enter a valid American Express Card number.");
				return;
			}
			break;
    
    case '4':
  
			if( length != 16 ) {
				alert("Please enter a valid Discover Card number.");
				return;
			}
			var prefix = parseInt( cardNumber.substring(0,4));

			if( prefix != 6011 ) {
				alert("Please enter a valid Discover Card number.");
				return;
			}
			break;
    
    case '2':


			if( length != 16 ) {
				alert("Please enter a valid MasterCard number.");
				return;
			}
			var prefix = parseInt( cardNumber.substring(0,2));


			if( prefix < 51 || prefix > 55) {
				alert("Please enter a valid MasterCard Card number.");
				return;
			}
			break;

    case '1':

			if( length != 16 && length != 13 ) {
				alert("Please enter a valid Visa Card number.");
				return;
			}
			var prefix = parseInt( cardNumber.substring(0,1));

			if( prefix != 4 ) {
				alert("Please enter a valid Visa Card number.");
				return;
			}
			break;
    }
  
  if( !mod10( cardNumber ) ) {
  	alert("Sorry! this is not a valid credit card number.");
  	return false;
  }
  if( expired( cardMonth, cardYear ) ) {							// check if entered date is already expired.
  	alert("Sorry! The expiration date you have entered would make this card invalid.");
  	return false;
  }
  
  return true;
}

function isEmail (emailStr)
{
  var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  
  if( filter.test(emailStr) )
    return true;
  else
    return false;
}

function gotopage(i)
{
  var loc = new String(document.location);
  var baseArr = loc.split("?");
  
  if( baseArr.length == 1)
    newurl = loc + "?page="+i;
  else
  {
    var newurl = baseArr[0]+"?";
    var locArr = baseArr[1].split("&");
    
    for( var j = 0 ; j < locArr.length; j++)
      if( locArr[j].substring(0,5) == "page=" )  locArr[j] = "page="+i;

    newurl += locArr.join("&");
    
    if( newurl.indexOf("page=")==-1) newurl += "&page="+i;
  }
  
  document.location = newurl;
}

//-->