//-- catbasket.js
//-----------------------------------------------------------
//-----------------------------------------------------------
// Regular Expressions


function validateValue( strValue, strMatchPattern ) {
/*********************************/
var objRegExp = new RegExp( strMatchPattern);
 
 //check if string matches pattern
 return objRegExp.test(strValue);
}

function validateEmail( strValue) {
var objRegExp  = /^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]*)(\.[a-z]{2,3}(\.[a-z]{2}){0,2})$/i;
  //check for valid email
  return objRegExp.test(strValue);
}

function trimAll( strValue ) {
 var objRegExp = /^(\s*)$/;

    //check for all spaces
    if(objRegExp.test(strValue)) {
       strValue = strValue.replace(objRegExp, '');
       if( strValue.length == 0)
          return strValue;
    }
  
   //check for leading & trailing spaces
   objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
   if(objRegExp.test(strValue)) {
       //remove leading and trailing whitespace characters
       strValue = strValue.replace(objRegExp, '$2');
    }
  return strValue;
}

//-------------------------------------------------------------------

function validp()
 {
   var nameCode = bName();
  if (nameCode == 2)
     {i = document.commande.listfrais.selectedIndex;
      zone =( document.commande.listfrais[i].value);
     }
else {zone = document.commande.listfrais.value;}
    if ( zone > 0 ) { return true;}
  else alert('Choisir la zone de livraison !');
           return false;}

//-------------------------------------------------------------------

function  validateNumeric( strValue ) {
  var objRegExp  =  /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/; 
  //check for numeric characters 
  return objRegExp.test(strValue);
}

function validateInteger( strValue ) {
  var objRegExp  = /(^-?\d\d*$)/;
  //check for integer characters
  return objRegExp.test(strValue);
}

function validateNotEmpty( strValue ) {
   var strTemp = strValue;
   strTemp = trimAll(strTemp);
   if(strTemp.length > 0){
     return true;
   }  
   return false;
}

function removeCommas( strValue ) {
  var objRegExp = /,/g; //search for commas globally
 
  //replace all matches with empty strings
  return strValue.replace(objRegExp,'');
}

function delHeadspace( strValue ) {
   //check for leading & trailing spaces
   objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
   if(objRegExp.test(strValue)) {
       //remove leading and trailing whitespace characters
       strValue = strValue.replace(objRegExp, '$2');
                               }
  return strValue;
}

//-------------------------------------------------------------------

function bName() {
      if (navigator.appName == "Microsoft Internet Explorer")     return 1;

      if (navigator.appName == "Netscape")      return 2;
// return 0 for other browsers
   return 0;
      }

//-------------------------------------------------------------------

function validp()
 {
   var nameCode = bName();
  if (nameCode == 2)
     {i = document.commande.listfrais.selectedIndex;
      zone =( document.commande.listfrais[i].value);
     }
else {zone = document.commande.listfrais.value;}
    if ( zone > 0 ) { return true;}
  else alert('Choisir la zone de livraison !');
           return false;}

//-------------------------------------------------------------------

function GoBack(){ window.history.back(); }

//-------------------------------------------------------------------
function CatWindow(theURL,winName,features) {
  var catWin;
  catWin = window.open(theURL,winName,features);
  catWin.focus();
 }

//------------------------------------------------------------------- 
 
function noclick()   {
	if (event.button==2){alert('Copyright Squelette-os.com');}
}

var message = "Copyright Squelette-os.com - Reproduction interdite";

function rtclickcheck(keyp){	
	if (navigator.appName == "Netscape" && keyp.which == 3)
	    { alert(message); return false; }
    if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2) 
        { 	alert(message); return false; } }

 
