

function OpenPopUp(url, title, w, h, str_option) {

  var option = " scrollbars=no, toolbar=no, menubar=no, resizable=no, location=no, directories=no, status=no, width=" + w + ", height=" + h;

  myWindow = window.open('http://www.fulei.org/'+"/"+url, title, option);
  myWindow.moveTo(100,100); //set position
  myWindow.focus(); //get focus
}

function OpenPopUpCCF(url, title, w, h, str_option) {

  var option = " scrollbars=no, toolbar=no, menubar=no, resizable=no, location=no, directories=no, status=no, width=" + w + ", height=" + h;

  myWindow = window.open('http://www.ccfpekin.org/'+"/"+url, title, option);
  myWindow.moveTo(100,100); //set position
  myWindow.focus(); //get focus
}


function OpenPopUpScroll(url, title, w, h) {
  var option = " scrollbars=yes, toolbar=no, menubar=no, resizable=no, location=no, directories=no, status=no, width=" + w + ", height=" + h;

  myWindow = window.open('http://www.fulei.org/'+"/"+url, title, option);
  myWindow.moveTo(65,50); //set position
  myWindow.focus(); //get focus
}

function openPopUpScroll(url, title, w, h) { OpenPopUpScroll(url, title, w, h) }
function openPopUp(url, title, w, h, str_option) { OpenPopUp(url, title, w, h, str_option) ; }

function OpenPopUpImage(url, w, h) {
  var option = " scrollbars=1, toolbar=no, menubar=no, resizable=yes, location=no, directories=no, status=no, width=" + w + ", height=" + h;

  myWindow = window.open(url,'', option);
  myWindow.moveTo(100,100); //set position
  myWindow.focus(); //get focus
}

function horizontal_scroll() {
  var item  = document.getElementById("scroll_area");
  var item1 = document.getElementById("scroll_area1");
  if (!item || !item1) return;
  if(item1.offsetWidth<=item.scrollLeft) item.scrollLeft-=item1.offsetWidth;
  else item.scrollLeft+=5;
  //set speed
  setTimeout("horizontal_scroll()", 100);
}


function isInteger(s){
  var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   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);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function

function quick_search (){
  var param = document.getElementById('quick_search').value;
  
  if (param){
    if (param == 'Recherche...') {
    window.alert('Veuillez séléctionner un critère de recherche');
    }else if (param == '快速搜索...'){
    window.alert('请选择搜索方式');
    }else{
    document.location='http://www.fulei.org/livres.ip?locale=fr&a=quick_search&search_pagination=1&mot_clef='+param;
    }
  }else{
  return;
  }
}


// function disabled by GBO 20080904 for debug purpose (but Cleint didn't ask for that)
function showStatus(msg) {
  //window.status = msg ;
  //  return true ;
}

function crypt_mail(nom,domaine){
  document.write('<a href="mailto:');
  document.write(nom);
  document.write('@');
  document.write(domaine);
  document.write('">'+nom+'@'+domaine+'</a>');
  
}
