function escamotableListener(div) {
    div.style.display = (div.style.display == 'none') ? 'block' : 'none';    
};

function checkEmail(sEmail) {
    if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(sEmail)){return true;}
    return false;
}

function stripHTML( strSrc ) {
    return strSrc.replace( /<[^<|>]+?>/gi,'' );
}


function checkMail2FriendForm(oForm) {

    //alert('checkMail2FriendForm:' + location.href);
	if((oForm.senders_name.value.length == 0) || (oForm.friends_name.value.length == 0) || (!checkEmail(oForm.senders_email.value)) || (!checkEmail(oForm.friends_email.value))) {
      alert('Veuillez remplir tous les champs correctement.');
      return false;
    } else {
	  //alert('article_url.value:'+ location.href);
	  oForm.article_url.value = location.href;
	  //alert('article_url.value:'+ oForm.article_url.value);
	  return true;
	}

};


function url_link(oForm, thisName){
    if (thisName == 'delicious'){
      oForm.url.value = location.href;
      oForm.submit();
    } else{
      if (thisName == 'myspace'){
       oForm.u.value = location.href;
       oForm.submit();
      } else{
        if (thisName == 'msn'){
         oForm.URL.value = location.href;
         oForm.submit();
        } else{
          if (thisName == 'facebook'){
           oForm.u.value = location.href;
           oForm.submit();
          } else{
            if (thisName == 'bookmarks_fr'){
             oForm.address.value = location.href;
             oForm.submit();
            }
          }
        }
      }
    }
};

function checkTextareaLength(obj,i) {
    if(obj.value.length > i) {
        obj.value = obj.value.substr(0,i);
        alert('<%=txt_characterlimit%>');
    }
}; 

function checkTMCommentForm(oForm) {
        oForm.comment.value = stripCommentHTML(oForm.comment.value);
        oForm.comment.value = oForm.comment.value.replace(/\r\n/g,'<br/>');
        if(oForm.comment.value.indexOf('[url') > -1) {
            oForm.comment.value = '';
            return false
        } else {
            if(oForm.comment.value.length > 0) {
                oForm.article_url.value = location.href;
                return true;
            }
            else {
                return false;
            }
        }
};

function stripCommentHTML( strSrc ) {
    return strSrc.replace( /<[^<|>]+?>/gi,'' );
};

function popUpPage(URL, width, height, screenX, screenY) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + width + ",height=" + height + ",screenX="+ screenX + ",screenY=" + screenY + "');");
};



