﻿
function toggle(element) {
 if( document.getElementById("hidethis" + element).style.display=='none' ){
   document.getElementById("hidethis" + element).style.display = '';
   document.getElementById("moreless" + element).innerText = 'less...';
 }else{
   document.getElementById("hidethis" + element).style.display = 'none';
   document.getElementById("moreless" + element).innerText = 'more...';
 }
}

function toggleall(total) {
var i=1;
for (i=1;i<=total;i++)
{

 if( document.getElementById("morelessall").innerText == 'Expand All' ){
   document.getElementById("hidethis" + i).style.display = '';
   document.getElementById("moreless" + i).innerText = 'less...';
 }else{
   document.getElementById("hidethis" + i).style.display = 'none';
   document.getElementById("moreless" + i).innerText = 'more...';
 }
 }
 
  if( document.getElementById("morelessall").innerText == 'Expand All' ){
   document.getElementById("morelessall").innerText = 'Contract All';
 }else{
   document.getElementById("morelessall").innerText = 'Expand All';
 }
}

//Function to save the contents of tiny mce before submitting
function fnSaveTinyMCE(strEditorID) { 
    
    alert("function ok");
    var content = "", body = tinyMCE.activeEditor.getDoc().body;

    if (body.textContent) {
        // Mozilla (Gecko)
        content = body.textContent;
    }

    if (body.innerText) {
        // Internet Explorer
        content = body.innerText;
    }

    if (content == "") {
        // other browsers
        content = tinyMCE.activeEditor.getContent();
    }

    //content = content.replace(/<\/?[^>]+>/g, "");
    document.getElementById(strEditorID).value=content;
    alert(document.getElementById(strEditorID).value);
    
    //Continue with submitting the form to the server   
    aspnetForm.submit();
}

function doMailto(mailname)
{
    var domain = "u3acostabrava.org";
    window.location = "mailto:" + mailname + "@" + domain;
}