/* <![CDATA[ */
  function createCookie(name,value,days) {
    if (days) {
      var date = new Date();
      date.setTime(date.getTime()+(days*24*60*60*1000));
      var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
  }

  function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');

    for(var i=0;i < ca.length;i++) {
      var c = ca[i];
      while (c.charAt(0)==' ') c = c.substring(1,c.length);
      if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
  }

  function loud(direction) {
    if (typeof vol == "undefined" || vol == "NaN") vol = 70;
    vol = parseInt(vol);
    vol = Math.floor(vol / 10) * 10;

    // if (vol < 1 ) vol = 0;
    // if (vol > 100) vol = Math.round(vol / 100);
    // if (vol > 99) vol = 100;

    if (direction == 'plus' && vol <= 90) vol = vol + 10;
    if (direction == 'minus' && vol >= 10) vol = vol - 10;

    createCookie('video_volume',vol,360);
    document.getElementById('mpl').sendEvent('VOLUME',vol);
    // alert('Lautstärke: '+vol+' %');
  }
/* ]]> */
