function MM_findObj(n, d) { //v4.01
  var p,i,x;if(!d) d=document;if((p=n.indexOf("?"))>0&&parent.frames.length) {
  d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n];for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n);return x;
}

function setsearchdisplay(disp) {
	//alert("setsearchdisplay");
  o = MM_findObj('searchlayer');
  o2 = MM_findObj('searchframe');
  if (document.all || document.getElementById) {
    step = 2;
    maxheight = 100;
    if (disp == 'block')
    {
      o.style.height = '0px';
      o2.height = 0;
      o.style.display = disp;

      for (i=0;i<maxheight+step;i+=step)
      {
        o.style.height = '' + i + 'px';
        o2.height = i;
        pausecomp(5);
      }

    }
    else
    {
      o.style.height = maxheight + 'px';
      o2.height = maxheight;
      for (i=maxheight;i>step*(-1);i-=step)
      {
        o.style.height = '' + i + 'px';
        o2.height = i;
        pausecomp(5);
      }
      o.style.display = disp;
    }
  } else if (document.layers) {
    o.display = disp;
  }
}

function pausecomp(millis)
{
  var date = new Date();
  var curDate = null;

  do {curDate = new Date();}
  while(curDate-date < millis);
}

function searchMouseClick(id, v)
{
  var divindex = id.substr(1);
	/*window.parent.document.searchasd.cntwindex.value = divindex;
  window.parent.document.searchasd.search.value = v;
  window.parent.document.searchasd.submit();*/
	document.searchasd.cntwindex.value = divindex;
  document.searchasd.search.value = v;
  document.searchasd.submit();
}

function searchBeforeSubmit()
{
	//alert("searchBeforeSubmit");
  var divindex = document.searchasd.cntwindex.value;

  if(divindex != -1)
  {
    var div = window.searchframe.document.getElementById('W'+ divindex);
    if(div != null)
    document.searchasd.search.value = div.title;
  }
  else
  {
    document.searchasd.search.value = document.searchasd.searchinput.value;
  }

  return true;
}

function searchOnLoad(sText)
{
  if(sText != '') document.searchasd.searchinput.focus();

	//commentezve volt
  /*window.searchframe.document.wordform.word.value=sText;
  window.searchframe.document.wordform.submit();*/
	//wordform.word.value=sText;
	
	//document.getElementById('wform_word').value=sText;
  
  //document.wordform.submit();
}

function searchframeOnLoad()
{

  if(window.parent.document.searchasd.reloadsearchframe.value != 1)
  {
    window.parent.document.searchasd.cntwindex.value = -1;
    window.parent.document.searchasd.reloadsearchframe.value = 0;
  }

  var divindex = window.parent.document.searchasd.cntwindex.value;
  var div      = document.getElementById('W'+(divindex));

  if(div != null)
  {
    div.className = "searchwordactive";
  }
}


function searchKeyUp(evt,sText) {
	//alert("searchKeyUp");
  /* if (document.layers) {
  var oLayer;
  if(parentID){
  oLayer = eval('document.' + parentID + '.document.' + ID + '.document');
  }else{
  oLayer = document.layers[ID].document;
  }
  oLayer.open();
  oLayer.write(sText);
  oLayer.close();
  }
  else if (parseInt(navigator.appVersion)>=5&&navigator.appName=="Netscape") {
  document.getElementById(ID).innerHTML = sText;
  }
  else if (document.all) document.all[ID].innerHTML = sText;
  */

  evt = evt ? evt : window.event;

  switch(evt.keyCode)
  {
    case 13: // enter
    case 37: // jobbra
    case 39: // balra
    break;

    case 38: // fel

    var olddivindex = document.searchasd.cntwindex.value;
    var divindex    = document.searchasd.cntwindex.value;
    
		divindex--;

    /*var olddiv = window.searchframe.document.getElementById('W'+(olddivindex));
    var div    = window.searchframe.document.getElementById('W'+(divindex));*/
		
		var olddiv = document.getElementById('W'+(olddivindex));
    var div    = document.getElementById('W'+(divindex));
		
		if(div != null && olddiv != null)
    olddiv.className = "searchwordinactive";

    if(div != null)
    {
      div.className = "searchwordactive";
      document.searchasd.cntwindex.value--;
    }
    break;

    case 40: // le
		
    var olddivindex = document.searchasd.cntwindex.value;
    var divindex    = document.searchasd.cntwindex.value;
    divindex++;
		
		if (olddivindex=="") {
			olddivindex=0;
		}
		/*var olddiv = window.searchframe.document.getElementById('W'+(olddivindex));
    var div    = window.searchframe.document.getElementById('W'+(divindex));*/
		
		var olddiv = document.getElementById('W'+(olddivindex));
    var div    = document.getElementById('W'+(divindex));
		
		
		
    if(div != null && olddiv != null)
    olddiv.className = "searchwordinactive";

    if(div != null)
    {
      div.className = "searchwordactive";
      document.searchasd.cntwindex.value++;
    }
    break;

    default:
    sText = trimAll(sText);
    document.searchasd.reloadsearchframe.value = 0;
    /*window.searchframe.document.wordform.word.value=sText;*/
    // document.getElementById('wform_word').value=sText;
    //if (sText.length>3)
    //{
      /*document.wordform.submit();*/
			/*window.searchframe.document.wordform.submit();*/
    //}
    break;
  }

}

function leftTrim(sString)
{
  while (sString.substring(0,1) == ' ')
  {
    sString = sString.substring(1, sString.length);
  }
  return sString;
}

function rightTrim(sString)
{
  while (sString.substring(sString.length-1, sString.length) == ' ')
  {
    sString = sString.substring(0,sString.length-1);
  }
  return sString;
}

function trimAll(sString)
{
  while (sString.substring(0,1) == ' ')
  {
    sString = sString.substring(1, sString.length);
  }
  while (sString.substring(sString.length-1, sString.length) == ' ')
  {
    sString = sString.substring(0,sString.length-1);
  }
  return sString;
}



// randomize html tags by class
function randomorder_engine(tagname) {
  this.tagName = tagname;
}
randomorder_engine.prototype={
  tagholders:new Object(),
  masterclass: "randomordercontent",

  init:function(){
    if (!document.getElementById)
    return
    var alltags=document.getElementsByTagName(this.tagName)
    var randomcontentsearch=new RegExp(this.masterclass+"\\s+(group\\d+)", "i") //check for CSS class="randomcontent groupX" (x=integer)
    for (var i=0; i < alltags.length; i++){
      if (randomcontentsearch.test(alltags[i].className)){
        if (typeof this.tagholders[RegExp.$1]=="undefined"){ //if object to hold this group of tags doesn't exist yet
          this.tagholders[RegExp.$1]=new Object() //create object
          this.tagholders[RegExp.$1].ref=[] //create array to hold each tag within group
          this.tagholders[RegExp.$1].contents=[] //create array to hold each tag's content within group
        }
        this.tagholders[RegExp.$1].ref.push(alltags[i]) //add this tag to the array
        temp = []
        temp.push(alltags[i].innerHTML)
        // tag's attributes
        temp.push(alltags[i].selected)
        temp.push(alltags[i].value)
        this.tagholders[RegExp.$1].contents.push(temp) //add this tag's content to the array
      }
    }
    this.scrambleorder()
  },
  scrambleorder:function(){
    for (group in this.tagholders){ //loop thru each array within object
      this.tagholders[group].contents.sort(function() {return 0.5 - Math.random()}) //scramble contents array
      for (var i=0; i < this.tagholders[group].ref.length; i++){
        this.tagholders[group].ref[i].innerHTML=this.tagholders[group].contents[i][0]
        this.tagholders[group].ref[i].selected=this.tagholders[group].contents[i][1]
        this.tagholders[group].ref[i].value=this.tagholders[group].contents[i][2]
      }
    }
  }
}
// call randomize
// randomorder = new randomorder_engine("option")
// randomorder.init()

// oldalso scroll
function tzscroll() {
  var dragging = false;
  $('.tzscrollpane').bind('mousedown', startDragScroll);
  $('.tzscrollpane').bind('mouseout', stopDragScroll);
  $('.tzscrollpane').bind('mousemove', dragScroll);
  $(document).bind('mouseup', stopDragScroll);

  function startDragScroll(e) {
    if (e.which == 1 && e.target == $('div.tzscrollpane')[0]) {
      dragging=e;
    }
  }

  function stopDragScroll(e) {
    dragging = false;
  }

  function dragScroll(e) {
    if (dragging) {
      window.scrollBy((dragging.clientX-e.clientX),(dragging.clientY-e.clientY));
      dragging = e;
      e.preventDefault();
      e.stopPropagation();
      return false;
    }
  }
}

/*
 * ha entert nyomott, akkor...
 */
function ifEnter(field, event, actionstring) {
  var theCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
  if (theCode == 13){
    eval(actionstring);
    return false;
  } else return true;
}


/* **************************/
/* feladatsorok lapozasahoz */
/* **************************/
function problemsresults(command)
{
  /*TODO: filled tömb!, function név?*/
  var isempty = false;
  for (i=0;i<filled.length;i++)
  {
    if (filled[i] == 0)
    isempty = true;
  }
  if (isempty)
  if (!confirm("#L:NOTFILLEDPROBLEMS#"))
  return;
  document.problem.cmd.value = command;
  document.problem.submit();
}

function hide(pageid)
{
//  alert('nemkell');
  var e;
  e = document.getElementById(pageid);
  e.style.display = 'none';
//  $('#'+pageid).css({display:'block',height:'1px',overflow:'hidden'});
//   $('#'+pageid).css({left:'-5000px'});
}

function show(pageid)
{
//  alert('nemkell2');
  var e;
  e = document.getElementById(pageid);
  e.style.display = 'block';
}

function show_all_hidden_parent(id) {
  var rejtett=new Array();
  var muta=$(id);
  while (muta.parent().length) {
//    if (!muta.is(':visible')) {
    if (muta.css('display') == 'none') {
      rejtett.push(muta);
    }
    muta = muta.parent();//rekurzivan
  }
  for (var i = 0; i < rejtett.length; i++) rejtett[i].show();
  return rejtett;
}

function hide_all_hidden_parent(rejtett) {
  for (var i = 0; i < rejtett.length; i++) {
    if (rejtett[i].is(':visible')) rejtett[i].hide();//a feltétel azért kell, mert lehet, hogy közben eltűnt amúgy is, pl css classal
  }
}


/* vege */

function solution_toggle(id){
  eval("$('#"+id+"').toggle();");
}

var ajaxstopbind=false;
function ajax_wait() {
  if (!ajaxstopbind) {
    $().ajaxStop($.unblockUI);//csak egyszer
    ajaxstopbind = true;
  }
  $.blockUI({
    message: "<h1><center><img src=\"images/zoom/spinner.gif\" alt=\"\"></center>Kérlek várj!</center></h1>",
    applyPlatformOpacityRules: false
  });
}

function ws_pos(spos, page)
{
  if (typeof ws_pager == 'undefined') return;//hiba
  problem_per_page = ws_pager[spos].problem_per_page;
  var filled = ws_filled[spos];
  var wsid = "ws_"+spos;
  var oldpage = null;
  if ( (typeof page == 'undefined') && (typeof ws_pager[spos].page != 'undefined') ) page = ws_pager[spos].page;else {
    if (typeof page == 'undefined') page = 1;
    //alert(page);
    if (typeof ws_pager[spos] != 'undefined') oldpage = ws_pager[spos].page;
    ws_pager[spos].page = page;
  }
  if (oldpage != page) {
    $('#'+wsid+'_'+oldpage).hide();
    $('#'+wsid+'_'+page).show();//ajax után jól jön
  }
  var pageid = wsid+'_'+page;
  var posid = pageid+'_pos';
  var p = $('#'+posid);
  var html = "<table cellspacing=\"0\" cellpadding=\"0\"><tr>";

  var problempage;
  var problempageid;
  var oc;
  var j;
  var backcolor;
  //alert(ws_filled[1]);
  for (var i = 0; i < filled.length; i++)
  {
    problempage = Math.ceil((i+1)/problem_per_page);
    var visiblepages=(problempage==page)?" pager_visible_pages":"";
    problempageid = wsid+"_"+problempage;
    j=i+1;
    oc = "ws_pos('"+spos+"','"+problempage+"');window.location='#ws_rel_"+spos+"_"+j+"';return false;";
    if (filled[i] == 3) {
      stateclass = " ws_state_good";
      backcolor = "#00e00a";
    } else if (filled[i] == 2) {
      backcolor = "#f83e2f";
      stateclass = " ws_state_bad";
    } else if (filled[i] == 1) {
      backcolor = "#ffd100";
      stateclass = " ws_state_set";
    } else {
      backcolor = "#35B8FF";
      stateclass = "";
    }
    html += "<td align=\"center\" height=\"15\" width=\"19\" class=\"pager"+visiblepages+stateclass+"\"><a href=\"#\" onclick=\""+oc+"\">"+j+"</a></td>";
  }
  html += "</tr></table>";
  if (filled.length > 1) p.html(html);//csak ha 1nél nagyobb
}

function ws_set_filled(pid, state) {
/*
  Beállítja a feladat gombján a színezést (alap, kész, jó, rossz)
  hogy melyik a gombja azt a globális tömbből tudja, amit a problem.xsl-ben állítunk be a feladatok generálásánál.
*/
  if (typeof ws_pagermap == 'undefined') return;
  if (typeof ws_pagermap["p_"+pid] == 'undefined') return;
  var map = ws_pagermap["p_"+pid];
  ws_filled[map.spos][map.index] = state;
  ws_pos(map.spos);
}

function fakeradio_select(id,value) {
/*
  egy fake radiot beállít a megadott értékre
  input: egy jquery object. (egy input)
  
  a fakeradio_+id+_+value class al rendelkezo elemet kiveve minden classbelit kikapcsol, azt meg be.
  
  a value egyszavas, classname nek valid karaktereket tartalmazó string!
  
*/
  var oldval=$('#fakeradio_'+id).val();
  if (oldval==value) return;

  $('#fakeradio_'+id).val(value);
  //spanokon vegigmegyunk. ha tartalmazza a classname et, akkor bejelolo fuggveny, kulonben kijelolo fuggveny.
  $('.fakeradio_'+id).each(function(i) {
    var img=$(this).find('img.fakeradio_img');
    if ($(this).hasClass('fakeradio_'+id+'_'+value)) {
      var src="_on";
    } else var src="_off";

    var newsrc=img.attr('src').replace(/(^.*)_(on|off)(\..*)/,"$1"+src+"$3");
    img.attr('src',newsrc);
  });
  
  if (eval('typeof fakeradio_'+id+'_change') == 'function') eval('fakeradio_'+id+'_change(value)');
  
}

/**
 * main.html-ben felhasznált fakeradio függvények
 *
 */
function search_submit() {
  $('form[name=searchform] input[name=cmd]').val($('#fakeradio_search').val());
  $('#searchform')[0].submit();//az eredeti submit (super)
  return true;
}

/**
 * egyedi callback a search nevű fakeradiohoz, szintén main.html
 * 
 */
function fakeradio_search_change(value) {
  var acmd;
  if (value=='tananyag')
    acmd = 'search.php?acmd=getwords';
  if (value=='lexikon')
    acmd = 'search.php?acmd=getwords_lexikon';
  if (acmd) {
//                              alert('bind '+value);
//                              
    $('#searchword').autocomplete({
      'source': acmd,
      'minLength': 3,
      'select': function(event, ui) {
        if (ui.item) {
          $(this).val(ui.item.value);
        }
        search_submit();
      }
    }).autocomplete('enable');//disable után újra kell.
  } else {//wikinél nincs autocomplete
    $('#searchword').autocomplete('disable');
  }
}

function stripamp(s) {
  return s.replace(/&amp;/g,"&");
  
}
function pict_tip_over(obj){
  $(obj).prev().show().css({left:$(obj).position().left+'px',top:$(obj).position().top+15+'px'});
}
function pict_tip_out(obj){
  $(obj).prev().hide();
}


function trim(str, chars) {
  return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
  chars = chars || "\\s";
  return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
  chars = chars || "\\s";
  return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

function prepareTextBoxes() {
 if (!document.getElementsByTagName) return;
 var oi=0;
 var thisObj;
 var objs = document.getElementsByTagName("input");

 for (oi=0;oi < objs.length;oi++) {
  thisObj = objs[oi];
  if (thisObj.getAttribute('type') == 'text') {
   thisObj.className = 'input_text ' + thisObj.className;
  }
 }
}

function m3d_onload_resize() {
  var e = $('#mb_3d iframe');
  if (e.length) {
    if (e[0].contentWindow && e[0].contentWindow.onresize) {
      e[0].contentWindow.onresize();
      return false;
    }
  }
  setTimeout('m3d_onload_resize()', 200);
}

function m3d_onload(id) {
  mb_center("#"+id);
  m3d_onload_resize();
}

function showM3Ddiv(path, pref) {
  if (!pref) pref = {};
  var width = pref.width;
  var height = pref.height;
//  if (!width) width = 1005;
//  if (!height) height = 650;
  if (!width) width = 980;
  if (!height) height = 610;
  mb_add('3d', "<iframe width=\""+width+"\" height=\""+height+"\" src=\""+path+"\" border=\"0\" frameborder=\"0\"></iframe>", m3d_onload, pref);//, width, height
  mb_close_local = function() {return {siker: true, remove: true}};
}

/*3d megnyitása új ablakban*/
function showM3D(path, pref) {
  if ( ! pref ) {
    pref = {};
  }
  var width = ( pref.width ) ? pref.width : 980;
  var height = ( pref.height ) ? pref.height : 610;
  var a = new mbObj($.extend(pref, {
    id              : '3d',
    html            : "<iframe width=\""+width+"\" height=\""+height+"\" src=\""+path+"\" border=\"0\" frameborder=\"0\"></iframe>",
    style           : 'display: block; position: absolute;',
    left            : 20,
    top             : 20
  }));
  //a.setOption('wrapoptions', pref);
  a.drawWrap();
  mb_set_to_top($('#'+'3d'));
  m3d_onload('3d');
  //if (typeof callback == 'function') callback(id);
  
  //showM3Ddiv(path, pref);
//  var width = 1005;
//  var height = 630;
//
//  var xpos = Math.round((window.screen.width / 2) - (width / 2));
//  var ypos = Math.round((window.screen.height / 2) - (height / 2));
//
//  if ( xpos < 0 ) {xpos = 0;}
//  if ( ypos < 0 ) {ypos = 0;}
//
//  var win_dimensions = "height=" + height + ",width=" + width;
//
//  m3dWindow = window.open(path, "m3dWindow", win_dimensions + ",resizable=1,scrollbars=no,location=no");
//
//  if (m3dWindow.moveTo) m3dWindow.moveTo(xpos, ypos);
//
//  if (window.focus) m3dWindow.focus();
}

/*3d megnyitása, de id alapján.
 *az id így néz ki: TOR/kozepkor/szabolcsi_foldvar
 */
function showM3Dbyid(id, pref) {
  showM3D("mozaik3D/"+id+"/index.html", pref);
}

function showFlash(path, width, height) {
  showM3Ddiv(path, {width: width, height: height});
}

function pr_object(m) {
  var s = '';
  if (typeof m != 'object') s += m;else {
    for (i in m) {
      s += i + ': ' + m[i] + "\n";
    }
    
  }
  return s;
}


if( btoa == undefined ) {
  var b64ec = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  var btoa = function( str ) {
    var out = "", i = 0, len = str.length;
    while( i < len ) {
    var c1 = str.charCodeAt( i++ ) & 0xff;
    if( i == len ) {
      out += b64ec.charAt( c1 >> 2 )
        + b64ec.charAt( ( c1 & 0x3 ) << 4 )
        + "==";
      break;
    }
    var c2 = str.charCodeAt( i++ );
    if( i == len ) {
      out += b64ec.charAt( c1 >> 2 )
        + b64ec.charAt( ( ( c1 & 0x3 ) << 4 ) | ( ( c2 & 0xF0 ) >> 4 ) )
        + b64ec.charAt( ( c2 & 0xF ) << 2 )
        + "=";
      break;
    }
    var c3 = str.charCodeAt( i++ );
    out += b64ec.charAt( c1 >> 2 )
      + b64ec.charAt( ( ( c1 & 0x3 ) << 4 ) | ( ( c2 & 0xF0 ) >> 4 ) )
      + b64ec.charAt( ( ( c2 & 0xF ) << 2 ) | ( ( c3 & 0xC0 ) >> 6 ) )
      + b64ec.charAt( c3 & 0x3F );
    }
    return out;
  }
}

/*
  img méretét állítja maximális méretűre, ami azt jelenti, hogy betöltéskor a méretet átállítja amegadottra, ha túl nagy.
  (csak a szélességgel foglalkozik!)
  függőség: jquery.onImagesLoad.js
*/
function img_size_limit(img, maxwidth) {
  img.onImagesLoad({
    itemCallback: function(e) {
      if (!maxwidth) {
        $(e).hide();//ha cache miatt már ott van, akkor ez széttolná...
        maxwidth = $(e).parent().width();
        $(e).show();
      }
      if ($(e).width() > maxwidth) $(e).css('width', maxwidth+'px');
    }
  }); 
}

function bind_tooltips() {
  $('img:[title], a, span.tooltip, input[type=image]').tooltip({
    delay: 0,
    track: true,
    showURL: false
  });
  $('img').attr('alt', '');//ie miatt
}

/*----------lexikon elem megnyitások -----------*/

//egykét lib flashhez
function sendEvent(swf, typ, prm, retry) {
  var e = thisMovie(swf);
  if (e && (typeof e.sendEvent == 'function')) {
    e.sendEvent(typ, prm);
  } else {
    //ujraprobaljuk
    if (retry > 0) {
      setTimeout("sendEvent('"+swf+"', '"+typ+"', null, "+(retry-1)+")", 500);
    }
  }
}
function thisMovie(swf) {
  if (navigator.appName.indexOf("Microsoft") != -1) {
    return window[swf];
  } else {
    return document[swf];
  }
}

/*
 * id: melyik elemhez bindeljük
 * file: flv, vagy amit le kell játszani (megfelelő útvonallal)
 * pre: pre kép, megnyitás előtti kép
 * width: szélesség (videóé)
 * height: magasság (videóé, tehát ehhez jön még status!)
 * 
 */
function bindvideo(id, file, pre, height, width) {
  var hei2 = height + 20;//statusbar miatt
  $(document).ready(function() {
    $('.fb_video'+id).fancybox({
      onStart:function() {
        swfobject.embedSWF("./book_object/object_media/mediaplayer2.swf", "mediaplayer", "100%", hei2, "9.0.0", "expressInstall.swf", {
          file: file,
          image: pre,
          lightcolor: "0x738fc4",
          backcolor: "0x738fc4",
          frontcolor: "0x8ca6d2",
          listovercolor: "0xffffff",
          listbackcolor: "0xbcc6e2",
          listfrontcolor: "0x738fc4",
          listbacktextcolor: "0x2b4678",
          listfronttextcolor: "0xffffff",
          showfsbutton: 'false',
          shownavigation: 'true',
          overstretch: 'none',
          displayheight: height,
          enablejs: 'true'
        }, {bgcolor: "#ffffff", wmode: "opaque"}, null, null);
      },
      onComplete:function() {
        sendEvent('mediaplayer', 'playpause', null, 10);
      },
      width:width,
      height:hei2,
      autoDimensions:false
//      padding: 1,
//      type:'swf'
    });
  });
}

function bindaudio(id, file) {
  $(document).ready(function() {
    $('.fb_video'+id).fancybox({
      onStart:function() {
        swfobject.embedSWF("book_object/object_media/mediaplayer2.swf", "mediaplayer", "100%", 20, "9.0.0", "expressInstall.swf", {
          file: file,
          lightcolor: "0x738fc4",
          backcolor: "0x738fc4",
          frontcolor: "0x8ca6d2",
          listovercolor: "0xffffff",
          listbackcolor: "0xbcc6e2",
          listfrontcolor: "0x738fc4",
          listbacktextcolor: "0x2b4678",
          listfronttextcolor: "0xffffff",
          showfsbutton: 'false',
          shownavigation: 'true',
          overstretch: 'none',
          displayheight: 0,
          enablejs: 'true'
        }, {bgcolor: "#ffffff", wmode: "opaque"}, null, null);
      },
      onComplete:function() {
        sendEvent('mediaplayer', 'playpause', null, 10);
      },
      width:500,
      height:20,
      autoDimensions:false
    });
  });
}


function mozalert( msg ) {
	/*
	 * Általános üzenetküldő függvény, egyelőre csak sima alert, később lehet modalbox, vagy bármi!
	 * A HTML formázást kiszedi a függvény (nem szép, ha ilyenek vannak benne)
	 */
	
	alert(msg.replace(/(<([^>]+)>)/ig,""));
	return true;
}


/**
  * Az ajaxos válaszokat előfeldolgozó függvény. 
  * @input data : a visszaérkező válasz 
  * A visszaérkező válaszban HTML formázás esetén <!--#ERROR--> , JSON esetén pedig error tömbelem van
  */
function ajaxPreCheck( data ) {
  if ( data.substring(4,10) == "#ERROR" ) {
  	mozalert(data);
  	//throw data;
  	return false;
  }
  if ( data.error ) {
  	mozalert(data.error);
  	//throw data;
  	return false;
  } else {
    return true;
  }
}

/**
 * 
 * fő div átméretezése
 * 
 */
function main_resize() {
  var docheight = $(document).height();
  var tzheight = $('div.tzscrollpane').height();
  if (tzheight < docheight) $('div.tzscrollpane').css('height', docheight+'px');
  
}
