
function setpic(picid,picurl) {
  document.getElementById(picid).src = picurl;
}


function toggleMiniframe(boxid,folded,expanded) {

  var pos = document.getElementById('box-'+boxid);
  if (pos.className == 'unfolded') {

    document.getElementById('box-'+boxid).className = 'folded';
    document.getElementById('icon-'+boxid).src = folded;
    document.cookie = "box-"+boxid+"=folded; expires=Wed, 11 Mar 2020 18:00:00 GMT; path=/";

  } else {

    document.getElementById('box-'+boxid).className = 'unfolded';
    document.getElementById('icon-'+boxid).src = expanded;

    document.cookie = "box-"+boxid+"=unfolded; expires=Wed, 11 Mar 2020 18:00:00 GMT; path=/";

  }

}

function microblogchars(element)
{
    var maxchars=245;
    laenge=document.getElementById(element).value.length;
    if(laenge>maxchars)
    {
        document.getElementById(element).value=document.getElementById(element).value.substring(0,maxchars);
    }
}


/* DHTML-Bibliothek */

var DHTML = 0, DOM = 0, MS = 0, NS = 0, OP = 0;

function DHTML_init() {

 if (window.opera) {
     OP = 1;
 }
 if(document.getElementById) {
   DHTML = 1;
   DOM = 1;
 }
 if(document.all && !OP) {
   DHTML = 1;
   MS = 1;
 }
if(window.netscape && window.screen && !DOM && !OP) {
   DHTML = 1;
   NS = 1;
 }
}

function getElem(p1,p2,p3) {
 var Elem;
 if(DOM) {
   if(p1.toLowerCase()=="id") {
     if (typeof document.getElementById(p2) == "object")
     Elem = document.getElementById(p2);
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="name") {
     if (typeof document.getElementsByName(p2) == "object")
     Elem = document.getElementsByName(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="tagname") {
     if (typeof document.getElementsByTagName(p2) == "object" || (OP && typeof document.getElementsByTagName(p2) == "function"))
     Elem = document.getElementsByTagName(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
 else if(MS) {
   if(p1.toLowerCase()=="id") {
     if (typeof document.all[p2] == "object")
     Elem = document.all[p2];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="tagname") {
     if (typeof document.all.tags(p2) == "object")
     Elem = document.all.tags(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="name") {
     if (typeof document[p2] == "object")
     Elem = document[p2];
     else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
 else if(NS) {
   if(p1.toLowerCase()=="id" || p1.toLowerCase()=="name") {
   if (typeof document[p2] == "object")
     Elem = document[p2];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="index") {
    if (typeof document.layers[p2] == "object")
     Elem = document.layers[p2];
    else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
}

function getCont(p1,p2,p3) {
   var Cont;
   if(DOM && getElem(p1,p2,p3) && getElem(p1,p2,p3).firstChild) {
     if(getElem(p1,p2,p3).firstChild.nodeType == 3)
       Cont = getElem(p1,p2,p3).firstChild.nodeValue;
     else
       Cont = "";
     return(Cont);
   }
   else if(MS && getElem(p1,p2,p3)) {
     Cont = getElem(p1,p2,p3).innerText;
     return(Cont);
   }
   else return void(0);
}

function getAttr(p1,p2,p3,p4) {
   var Attr;
   if((DOM || MS) && getElem(p1,p2,p3)) {
     Attr = getElem(p1,p2,p3).getAttribute(p4);
     return(Attr);
   }
   else if (NS && getElem(p1,p2)) {
       if (typeof getElem(p1,p2)[p3] == "object")
        Attr=getElem(p1,p2)[p3][p4]
       else
        Attr=getElem(p1,p2)[p4]
         return Attr;
       }
   else return void(0);
}

function setCont(p1,p2,p3,p4) {
   if(DOM && getElem(p1,p2,p3) && getElem(p1,p2,p3).firstChild)
     getElem(p1,p2,p3).firstChild.nodeValue = p4;
   else if(MS && getElem(p1,p2,p3))
     getElem(p1,p2,p3).innerText = p4;
   else if(NS && getElem(p1,p2,p3)) {
     getElem(p1,p2,p3).document.open();
     getElem(p1,p2,p3).document.write(p4);
     getElem(p1,p2,p3).document.close();
   }
}

DHTML_init();


var tn1a = 0;
var tn1b = 0;
var tn2a = 0;
var tn2b = 0;
var avatarpopup = 0;

function HideAll() {
  getElem('id','tn1',null).style.visibility='hidden';
  getElem('id','tn2',null).style.visibility='hidden';
  getElem('id','tn3',null).style.visibility='hidden';
  getElem('id','tn4',null).style.visibility='hidden';
}

function OverArea(MouseArea) {

  if(MouseArea == "tn1a") { var tn1a = 1; }
  if(MouseArea == "tn1b") { var tn1b = 1; }
  if(MouseArea == "tn2a") { var tn2a = 1; }
  if(MouseArea == "tn2b") { var tn2b = 1; }
  if(MouseArea == "tn3a") { var tn3a = 1; }
  if(MouseArea == "tn3b") { var tn3b = 1; }
  if(MouseArea == "tn4a") { var tn4a = 1; }
  if(MouseArea == "tn4b") { var tn4b = 1; }
  if(MouseArea == "tn5a") { var tn5a = 1; }
  if(MouseArea == "tn5b") { var tn5b = 1; }

  if(tn1a == 1 || tn1b == 1) {
    getElem('id','tn1',null).style.visibility='visible';
  }
  if(tn2a == 1 || tn2b == 1) {
    getElem('id','tn2',null).style.visibility='visible';
  }
  if(tn3a == 1 || tn3b == 1) {
    getElem('id','tn3',null).style.visibility='visible';
  }
  if(tn4a == 1 || tn4b == 1) {
    getElem('id','tn4',null).style.visibility='visible';
  }
  if(tn5a == 1 || tn5b == 1) {
    getElem('id','tn5',null).style.visibility='visible';
  }
}

function OutArea(MouseArea) {
  if(MouseArea == "tn1a") { var tn1a = 0; }
  if(MouseArea == "tn1b") { var tn1b = 0; }
  if(MouseArea == "tn2a") { var tn2a = 0; }
  if(MouseArea == "tn2b") { var tn2b = 0; }
  if(MouseArea == "tn3a") { var tn3a = 0; }
  if(MouseArea == "tn3b") { var tn3b = 0; }
  if(MouseArea == "tn4a") { var tn4a = 0; }
  if(MouseArea == "tn4b") { var tn4b = 0; }
  if(MouseArea == "tn5a") { var tn5a = 0; }
  if(MouseArea == "tn5b") { var tn5b = 0; }

  if(tn1a == 0 && tn1b == 0) {
    getElem('id','tn1',null).style.visibility='hidden';
  }
  if(tn2a == 0 && tn2b == 0) {
    getElem('id','tn2',null).style.visibility='hidden';
  }
  if(tn3a == 0 && tn3b == 0) {
    getElem('id','tn3',null).style.visibility='hidden';
  }
  if(tn4a == 0 && tn4b == 0) {
    getElem('id','tn4',null).style.visibility='hidden';
  }
  if(tn5a == 0 && tn5b == 0) {
    getElem('id','tn5',null).style.visibility='hidden';
  }

  getElem('id','tn1',null).style.visibility='hidden';
  getElem('id','tn2',null).style.visibility='hidden';
  getElem('id','tn3',null).style.visibility='hidden';
  getElem('id','tn4',null).style.visibility='hidden';
  getElem('id','tn5',null).style.visibility='hidden';

}

function AvatarOverArea(MouseArea) {
  MouseArea.className='avatarpopup';
}

function AvatarOutArea(MouseArea) {
  MouseArea.className='avatar';
}

function VoterOverArea(MouseArea) {
  MouseArea.className='voterboxon';
}

function VoterOutArea(MouseArea) {
  MouseArea.className='voterboxoff';
}

function FormOptional(OptionalArea,OptionalArea2,Text1,Text2) {
  if(document.getElementById(OptionalArea).style.display == 'none') {
    document.getElementById(OptionalArea).style.display='inline';
    document.getElementById(OptionalArea2).innerHTML='<img src="/img/minus.png" hspace="5">'+Text2;
  } else {
    document.getElementById(OptionalArea).style.display='none';
    document.getElementById(OptionalArea2).innerHTML='<img src="/img/plus.png" hspace="5">'+Text1;
  }
} 

// main tab navigation
  var narea1a = 0;
  var narea1b = 0;
  var narea2a = 0;
  var narea2b = 0;
  var narea3a = 0;
  var narea3b = 0;
  var narea4a = 0;
  var narea4b = 0;
  var narea5a = 0;
  var narea5b = 0;
  var narea101a = 0;
  var narea101b = 0;
  var narea102a = 0;
  var narea102b = 0;
  var narea103a = 0;
  var narea103b = 0;
  var narea104a = 0;
  var narea104b = 0;
  var narea105a = 0;
  var narea105b = 0;

  function NaviOverArea(MouseArea,ab,defaultelemid,theme) {
    if(MouseArea == "1" && ab == "a") { var narea1a = 1; }
    if(MouseArea == "1" && ab == "b") { var narea1b = 1; }
    if(MouseArea == "2" && ab == "a") { var narea2a = 1; }
    if(MouseArea == "2" && ab == "b") { var narea2b = 1; }
    if(MouseArea == "3" && ab == "a") { var narea3a = 1; }
    if(MouseArea == "3" && ab == "b") { var narea3b = 1; }
    if(MouseArea == "4" && ab == "a") { var narea4a = 1; }
    if(MouseArea == "4" && ab == "b") { var narea4b = 1; }
    if(MouseArea == "5" && ab == "a") { var narea5a = 1; }
    if(MouseArea == "5" && ab == "b") { var narea5b = 1; }
    if(MouseArea == "101" && ab == "a") { var narea101a = 1; }
    if(MouseArea == "101" && ab == "b") { var narea101b = 1; }
    if(MouseArea == "102" && ab == "a") { var narea102a = 1; }
    if(MouseArea == "102" && ab == "b") { var narea102b = 1; }
    if(MouseArea == "103" && ab == "a") { var narea103a = 1; }
    if(MouseArea == "103" && ab == "b") { var narea103b = 1; }
    if(MouseArea == "104" && ab == "a") { var narea104a = 1; }
    if(MouseArea == "104" && ab == "b") { var narea104b = 1; }
    if(MouseArea == "105" && ab == "a") { var narea105a = 1; }
    if(MouseArea == "105" && ab == "b") { var narea105b = 1; }

    document.getElementById('subnavi'+MouseArea).className= 'subnavivisible';
    document.getElementById('subnavi'+defaultelemid).className= 'subnavihidden';
    document.getElementById('topnavi1-'+MouseArea).src= '/img/toptabs/high_begin_'+theme+'';
    document.getElementById('topnavi2-'+MouseArea).className= "toptabstexthigh";
    document.getElementById('topnavi3-'+MouseArea).src= '/img/toptabs/high_end_'+theme+'';

  }

  function NaviOutArea(MouseArea,ab,defaultelemid,theme) {
    if(MouseArea == "narea1a") { var narea1a = 0; }
    if(MouseArea == "narea1b") { var narea1b = 0; }
    if(MouseArea == "narea2a") { var narea2a = 0; }
    if(MouseArea == "narea2b") { var narea2b = 0; }
    if(MouseArea == "narea3a") { var narea3a = 0; }
    if(MouseArea == "narea3b") { var narea3b = 0; }
    if(MouseArea == "narea4a") { var narea4a = 0; }
    if(MouseArea == "narea4b") { var narea4b = 0; }
    if(MouseArea == "narea5a") { var narea5a = 0; }
    if(MouseArea == "narea5b") { var narea5b = 0; }
    if(MouseArea == "narea101a") { var narea101a = 0; }
    if(MouseArea == "narea101b") { var narea101b = 0; }
    if(MouseArea == "narea102a") { var narea102a = 0; }
    if(MouseArea == "narea102b") { var narea102b = 0; }
    if(MouseArea == "narea103a") { var narea103a = 0; }
    if(MouseArea == "narea103b") { var narea103b = 0; }
    if(MouseArea == "narea104a") { var narea104a = 0; }
    if(MouseArea == "narea104b") { var narea104b = 0; }
    if(MouseArea == "narea105a") { var narea105a = 0; }
    if(MouseArea == "narea105b") { var narea105b = 0; }

    document.getElementById('subnavi'+MouseArea).className= 'subnavihidden';
    document.getElementById('subnavi'+defaultelemid).className= 'subnavivisible';
    document.getElementById('topnavi1-'+MouseArea).src= '/img/toptabs/low_begin_'+theme+'';
    document.getElementById('topnavi2-'+MouseArea).className= "toptabstextlow";
    document.getElementById('topnavi3-'+MouseArea).src= '/img/toptabs/low_end_'+theme+'';

  }



/**
 * Function is used to hide or unhide payment information on
 * a downloadlink in content add/edit controller.
 *
 * @author thallek <thallek@soft-science.de>
 * @param  HTML Object clicked Checkbox
 * @param  intger rowNumber
 * @return void
 */
function switchPaymentInfo(checkbox, rowNumber) {

  if (checkbox.checked == true) {
    document.getElementById('downloadRow' + rowNumber + '_a').style.display = '';
    document.getElementById('downloadRow' + rowNumber + '_b').style.display = '';
  } else {
    document.getElementById('downloadRow' + rowNumber + '_a').style.display = 'none';
    document.getElementById('downloadRow' + rowNumber + '_b').style.display = 'none';
  }
}

/**
 * Function is used to hide or unhide donation information in
 * in content add/edit controller.
 *
 * @author thallek <thallek@soft-science.de>
 * @param  HTML Object clicked Checkbox
 * @return void
 */
function switchDonationInfo(checkbox) {
  if (checkbox.checked == true) {
    document.getElementById('donationRow').style.display = '';
  } else {
    document.getElementById('donationRow').style.display = 'none';
  }
}



