/* filme_note.js */
 function sayNoUpdate()
{
  ld_open();
  //window.open('http://www.cinemarx.ro/utile/login_window.php?dir=','','toolbar=no, location=no, status=no, menubar=no, resizable=no, scrollbar=auto, width=420, height=380');
}

function updateNote(_film_id, _nota)
{
  document.getElementById('film_nota_div_id').innerHTML = '';
  document.getElementById('film_nota_div_id').style.backgroundImage = 'url(http://www.cinemarx.ro/grafica/pag_filme/tema_01/filmul/loading.gif)';
  new Ajax.Updater('film_nota_div_id', BASE_URL + '/filme/nota_film.php', {
    method: 'post',
    postBody: 'film_id=' + _film_id + '&nota=' + _nota,
    evalScripts: true,
    onSuccess: function(t) {
      document.getElementById('film_nota_div_id').style.backgroundImage = 'none';
    }
  });
}

function on_st_over(_i)
{
  var _step = 17;
  var _diff = 10 - _i;
  var _div = document.getElementById('nf_st2');
  if (_div)
  {
    _div.style.backgroundPosition = '-' + (_diff * _step) + 'px top';
  }
}

function on_st_out(_i)
{
  var _step = 17;
  var _diff = 10 - _i;
  var _div = document.getElementById('nf_st2');
  if (_div)
  {
    _div.style.backgroundPosition = '-1000px top';
  }
}

/* global.js */
 var BASE_URL = 'http://www.cinemarx.ro/';
var color_cookie = "scheme";
var color_open = "true";

function openclosecolors()
{
	if(color_open=="false")	
	{
		appear('st_icon-1');				
		window.setTimeout('appear(\'st_icon-2\')',400);
		window.setTimeout('appear(\'st_icon-3\')',800);
		color_open="true";
	}
	else
	{
		disappear('st_icon-3');				
		window.setTimeout('disappear(\'st_icon-2\')',400);
		window.setTimeout('disappear(\'st_icon-1\')',800);
		color_open="false";	
	}
}
function appear(id)
{
	Effect.Appear(id);
}
function disappear(id)
{
	new Effect.Fade(id);	
}

function changecolor(_type, obj)
{
	var theme = document.getElementById('theme_css');
 	
  var themes = new Array(
    'theme_B',
    'theme_R',
    'theme_G'
  );

	var cookievlaue = "B";
 	
	switch(obj.id)
	{
		case "st_icon-2":
      cookievlaue = "R";
      theme_href = BASE_URL + 'templates/v2.1/css/themes/' + _type + '/' + themes[1] + '.css';
      break;
		case "st_icon-3":
      cookievlaue = "G";
      theme_href = BASE_URL + 'templates/v2.1/css/themes/' + _type + '/' + themes[2] + '.css';
      break;
		case "st_icon-1":
    default:
      cookievlaue = "B";
      theme_href = BASE_URL + 'templates/v2.1/css/themes/' + _type + '/' + themes[0] + '.css';
      break;
	}

  theme.href = theme_href;

  var today = new Date();
  today.setTime(today.getTime());
  var expires_date = new Date( today.getTime() + 100/*100 days*/ * 1000 * 60 * 60 * 24 );
	document.cookie = color_cookie + "=" + cookievlaue + "; expires= " + expires_date.toGMTString() + "; path=/";
}

function doClick(_id)
{
  var o = document.getElementById(_id);
  if (o)
  {
    o.style.display = '';
    o.click();
    o.style.display = 'none';
  }
}
function doClickFooter(_id)
{
  var o = document.getElementById(_id);
  if (o)
  {
    o.style.display = '';
    o.click();
    o.style.display = 'none';
  }
}

function insertBefore(_reid, _ne)
{
  $(_reid).parentNode.insertBefore(_ne, $(_reid));
}
function insertAfter(_reid, _ne)
{
  $(_reid).parentNode.insertBefore(_ne, $(_reid).nextSibling);
}

function setSelectedSearchDomain()
{
  var sb = document.getElementsByName('domain');
  if (sb)
  {
    for(i=0;i<sb.length;i++)
    {
      var sbl = document.getElementById(sb[i].id + '_l');
      if (sbl)
      {
        if (true == sb[i].checked)
        {
          sbl.className = "selected";
        }
        else
        {
          sbl.className = "";
        }
      }
    }
  }
}
function setSelectedSearchDomainFooter()
{
  var sb = document.getElementsByName('domainf');
  if (sb)
  {
    for(i=0;i<sb.length;i++)
    {
      var sbl = document.getElementById(sb[i].id + '_l');
      if (sbl)
      {
        if (true == sb[i].checked)
        {
          sbl.className = "selected";
        }
        else
        {
          sbl.className = "";
        }
      }
    }
  }
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
  {
		while (obj.offsetParent)
    {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
	{
		curleft += obj.x;
  }

	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
  {
		while (obj.offsetParent)
    {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
  {
    curtop += obj.y;
  }
	return curtop;
}

_dbclick = false;
_onDoubleClick = new Array();
function dbclickhandler(e)
{
  if (false == _dbclick)
  {
    _dbclick = true;
    window.setTimeout('_dbclick = false;', 200);
  }
  else
  {
    _dbclick = false;
    _onDoubleClick[Event.element(e).id](Event.element(e));
  }
}

function addDoubleClickHandler(_element_id, _function)
{
  _onDoubleClick[_element_id] = _function;
}

function showLoading(_holder_id)
{
  var to_change = document.getElementById(_holder_id);
  var sx = findPosX(to_change);
  var sy = findPosY(to_change);
  var loading_obj = document.getElementById('loading');
  loading_obj.style.top = Math.round(sy + (to_change.offsetHeight-60)/2) + 'px';
  loading_obj.style.left = Math.round(sx + (to_change.offsetWidth-164)/2) + 'px';
  loading_obj.style.display = '';
}
function hideLoading()
{
  document.getElementById('loading').style.display = 'none';
}
function getData(_url, _holder_id, _params, _onComplete)
{
  if (!_params || 'undefined' == _params)
  {
    _params = '';
  }
  if (!_onComplete || 'undefined' == _onComplete)
  {
    __onComplete = function() {
      // default handler
      hideLoading();
    };
  }
  else
  {
    __onComplete = function(transport) {
      _onComplete(transport);
      hideLoading();
    }
  }
  showLoading(_holder_id);
  new Ajax.Updater(_holder_id, _url, {method:'post', evalScripts:true, parameters: _params, onComplete: __onComplete});
}

function showPopup(_url, _params, _title, _width)
{
  if ((undefined == _width) || (false == _width) || (null == _width))
  {
    _width = 600;
  }
  Modalbox.show(_url, {overlayClose:false, method:"post", params:_params, title:_title, loadingString: 'Se incarca...', width:_width});
}



function displayLogin(_redirect, _type)
{
  if ((undefined == _redirect) || ('undefined' == _redirect))
  {
    _redirect = window.location;
  }
  if ('' == _redirect)
  {
    _redirect = window.location;
  }
  showPopup(BASE_URL + 'ws/login.php', {d:_dirfb, type:_type, r:_redirect}, 'Autentifica-te!', false);
}

function reportAbuse(_page, _param, _param2)
{
  showPopup(BASE_URL + 'ws/reportabuse.php', {d:_dirfb, page:_page, param:_param, param2:_param2}, 'Raporteaza abuz...', false);
}
function submitReportAbuse(_form)
{
  showPopup(BASE_URL + 'ws/reportabuse.php?reported', _form.serialize(true), 'Raporteaza abuz...', false);
}

function contactForm()
{
  showPopup(BASE_URL + 'ws/contact.php', {d:_dirfb, page:'contact'}, 'Formular de contact', false);
}
function submitContactForm(_form)
{
  showPopup(BASE_URL + 'ws/contact.php?sent', _form.serialize(true), 'Formular de contact', false);
}

// tooltip
function attachTooltip(_id, _tooltip)
{
  if (('' == _id) || ('' == _tooltip))
  {
    return;
  }
  $(_id).observe('mouseover', function (event) {
    $('rx_tooltip').innerHTML = _tooltip;
    $('rx_tooltip').style.top = (2 + Event.pointerY(event)) + 'px';
    $('rx_tooltip').style.left = (2 + Event.pointerX(event)) + 'px';
    Effect.Appear('rx_tooltip', {duration: 0.1});
    //$('rx_tooltip').style.display = '';
  });
  $(_id).observe('mouseout', function (event) {
    //Effect.Fade('rx_tooltip');
    $('rx_tooltip').style.display = 'none';
  });
}

function setHP()
{
  if(!document.all){alert('Browserul nu suporta setarea automata a paginii HOME. Pentru setare, trage acest link peste butonul de home din browserul tau.'); return false;}else{this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.cinemarx.ro/');}
}


// preload some images
function preloadImage(_src)
{
  var i = new Image();
  i.src = _src;
}
preloadImage(BASE_URL + 'templates/v2.1/g/common/rss.gif');
preloadImage(BASE_URL + 'templates/v2.1/g/common/rsso.gif');

function displayCommentRules(_type)
{
  var _rules = new Array();
  _rules['movie'] = '<h5>Regulament pareri</h5><ol><li style="color:red !important">Atentie: parerile copiate de la alti utilizatori, de pe alte site-uri sau din alte surse vor fi sterse, iar utilizatorul va fi depunctat, avertizat si banat in cazul repetarii!</li><li>exprima-ti parerea despre acest film doar daca l-ai vazut; daca nu l-ai vazut poti sa-ti exprimi parerea despre trailer in pagina lui, nu aici;</li><li>scrie corect gramatical si nu folosi prescurtari specifice Yahoo! messenger sau mIRC;</li><li>limbajul trivial (vulgar, ordinar, obscen, necuviincios, indecent, scarbos) este strict interzis;</li><li>nu scrie pareri scurte de doar cateva cuvinte;</li><li>nu folosi spoilere (prezentarea deznodamantului) in parerea ta;</li><li>nu isca polemici si respectati parerile si gusturile celorlalti;</li><li>raporteaza eventualele abuzuri folosind butonul din dreapta fiecarei pareri;</li><li>nerespectarea regulamentului poate duce la depunctare, avertisment sau chiar stergerea contului de utilizator.</li></ol>';
  _rules['dvd'] = '<h5>Regulament pareri</h5><ol><li>scrie corect gramatical si nu folosi prescurtari specifice Yahoo! messenger sau mIRC;</li><li>limbajul trivial (vulgar, ordinar, obscen, necuviincios, indecent, scarbos) este strict interzis;</li><li>nu scrie pareri scurte de doar cateva cuvinte;</li><li>nu folosi spoilere (prezentarea deznodamantului) in parerea ta;</li><li>nu isca polemici si respectati parerile si gusturile celorlalti;</li><li>raporteaza eventualele abuzuri folosind butonul din dreapta fiecarei pareri;</li><li>nerespectarea regulamentului poate duce la depunctare, avertisment sau chiar stergerea contului de utilizator.</li></ol>';
  _rules['blu-ray'] = '<h5>Regulament pareri</h5><ol><li>scrie corect gramatical si nu folosi prescurtari specifice Yahoo! messenger sau mIRC;</li><li>limbajul trivial (vulgar, ordinar, obscen, necuviincios, indecent, scarbos) este strict interzis;</li><li>nu scrie pareri scurte de doar cateva cuvinte;</li><li>nu folosi spoilere (prezentarea deznodamantului) in parerea ta;</li><li>nu isca polemici si respectati parerile si gusturile celorlalti;</li><li>raporteaza eventualele abuzuri folosind butonul din dreapta fiecarei pareri;</li><li>nerespectarea regulamentului poate duce la depunctare, avertisment sau chiar stergerea contului de utilizator.</li></ol>';
  _rules['trailer'] = '<h5>Regulament pareri</h5><ol><li>scrie corect gramatical si nu folosi prescurtari specifice Yahoo! messenger sau mIRC;</li><li>limbajul trivial (vulgar, ordinar, obscen, necuviincios, indecent, scarbos) este strict interzis;</li><li>nu scrie pareri scurte de doar cateva cuvinte;</li><li>nu folosi spoilere (prezentarea deznodamantului) in parerea ta;</li><li>nu isca polemici si respectati parerile si gusturile celorlalti;</li><li>raporteaza eventualele abuzuri folosind butonul din dreapta fiecarei pareri;</li><li>nerespectarea regulamentului poate duce la depunctare, avertisment sau chiar stergerea contului de utilizator.</li></ol>';
  _rules['cinefocus'] = '<h5>Regulament pareri</h5><ol><li>scrie corect gramatical si nu folosi prescurtari specifice Yahoo! messenger sau mIRC;</li><li>limbajul trivial (vulgar, ordinar, obscen, necuviincios, indecent, scarbos) este strict interzis;</li><li>nu scrie pareri scurte de doar cateva cuvinte;</li><li>nu isca polemici si respectati parerile si gusturile celorlalti;</li><li>raporteaza eventualele abuzuri folosind butonul din dreapta fiecarei pareri;</li><li>nerespectarea regulamentului poate duce la depunctare, avertisment sau chiar stergerea contului de utilizator.</li></ol>';
  _rules['person'] = '<h5>Regulament pareri</h5><ol><li style="color:red !important">Atentie: parerile copiate de la alti utilizatori, de pe alte site-uri sau din alte surse vor fi sterse, iar utilizatorul va fi depunctat, avertizat si banat in cazul repetarii!</li><li>scrie corect gramatical si nu folosi prescurtari specifice Yahoo! messenger sau mIRC;</li><li>limbajul trivial (vulgar, ordinar, obscen, necuviincios, indecent, scarbos) este strict interzis;</li><li>nu scrie pareri scurte de doar cateva cuvinte;</li><li>nu isca polemici si respectati parerile si gusturile celorlalti;</li><li>raporteaza eventualele abuzuri folosind butonul din dreapta fiecarei pareri;</li><li>nerespectarea regulamentului poate duce la depunctare, avertisment sau chiar stergerea contului de utilizator.</li></ol>';
  _rules['news'] = '<h5>Regulament pareri</h5><ol><li>exprima-ti parerea  despre stirea/articolul din aceasta pagina, fara a devia prea mult de la subiect;</li><li>scrie corect gramatical si nu folosi prescurtari specifice Yahoo! messenger sau mIRC;</li><li>limbajul trivial (vulgar, ordinar, obscen, necuviincios, indecent, scarbos) este strict interzis;</li><li>nu isca polemici si respectati parerile si gusturile celorlalti;</li><li>nu face reclama la site-uri, servicii sau produse in comentariul tau;</li><li>raporteaza eventualele abuzuri folosind butonul din dreapta fiecarei pareri;</li><li>nerespectarea regulamentului poate duce la depunctare, avertisment sau chiar stergerea contului de utilizator.</li></ol>';
  $('comment_rules').innerHTML = _rules[_type];
}

var __banned_words = new Array('%70%6C%6D', '%6B%6B%74', '%20%70%75%6C%61', '%20%70%69%7A%64%61', '%6D%75%69%65%0A', '%20%6B%61%6B%61%74%0A', '%20%63%61%63%61%74%0A');
var __stupid_words = new Array(' k ','kum','kam','shi ',' tre ',' d ','filmu ','serialu ','actoru ','genu ','regizoru ',' crek','kre','knd','kool','nush');
function createAlertErrorMessage()
{
  var sp = document.createElement("span");
  sp.setAttribute("id", "alert_error");
  return sp;
}
var checkTextForced = false;
function implode(_d, _a)
{
  var _ret = false;
  if (_a.constructor != Array)
  {
    return false;
  }
  for(var i=0;i<_a.length;i++)
  {
    if (false != _ret)
    {
      _ret = _ret + _d + _a[i];
    }
    else
    {
      _ret = _a[i];
    }
  }
  return _ret;
}

var checkText_insertAfter = 'c_comment';
function checkText(_id)
{
  var _text = $(_id).value;
  var _force_submit = '<a href="" onclick="checkTextForced=true;if ($(\'' + _id + '\').parentNode.onsubmit()){$(\'' + _id + '\').parentNode.submit();}return false;">Trimite oricum!</a>';
  var _the_words = new Array();
  var _the_words_found = false;
  for(i=0;i<__banned_words.length;i++)
  {
    if (-1 != _text.toLowerCase().indexOf(unescape(__banned_words[i]).toLowerCase()))
    {
      _the_words_found = true;
      _the_words[_the_words.length] = unescape(__banned_words[i]).toLowerCase();
    }
  }
  if (true == _the_words_found)
  {
    var aem = createAlertErrorMessage();
    aem.innerHTML = 'Parerea ta contine cuvinte interzise (<em>' + implode(', ', _the_words) + '</em>). Te rugam sa o reformulezi. Citeste regulamentul din dreapta!';
    insertAfter(checkText_insertAfter, aem);
    return false;
  }

  if (true != checkTextForced)
  {
    for(i=0;i<__stupid_words.length;i++)
    {
      if (-1 != _text.toLowerCase().indexOf(__stupid_words[i].toLowerCase()))
      {
        _the_words_found = true;
        _the_words[_the_words.length] = __stupid_words[i].toLowerCase();
      }
    }
    if (true == _the_words_found)
    {
      var aem = createAlertErrorMessage();
      aem.innerHTML = 'Parerea ta contine prescurtari specifice Yahoo! messenger sau mIRC (<em>' + implode(', ', _the_words) + '</em>). Te rugam sa o reformulezi. Daca totusi o postezi, s-ar putea sa fie raportata sau stearsa de catre un moderator al site-ului. ' + _force_submit;
      insertAfter(checkText_insertAfter, aem);
      return false;
    }
  }
  
  if ((_text.length < 100) && ((true != checkTextForced) || (0 == _text.length)))
  {
    var aem = createAlertErrorMessage();
    aem.innerHTML = 'Parerea ta este foarte scurta. Citeste regulamentul din dreapta! Daca totusi o postezi, s-ar putea sa fie raportata sau stearsa de catre un moderator al site-ului. ' + ((0 == _text.length)? '' : _force_submit);
    insertAfter(checkText_insertAfter, aem);
    return false;
  }
  
  return true;
}
function rx_track(_type) {
  var _location = window.location.toString().slice(0);
  pageTracker._trackPageview('/' + _type + _location.replace(/http:\/\/[^\/]*/, ''));
}

function checkCripText(_cid) {
    checkText_insertAfter = 'crip_comment';
    if (checkText('crip_comment')) {
      $('c_type').value = _cid;
      $('c_title').value = $('crip_title').value;
      $('c_comment').value = $('crip_comment').value;
      checkText_insertAfter = 'c_comment';
      $('c_comment_form').submit();
    }
    return false;
}

var _crips = false;
var _crips_p = false;
var _crips_op = false;
function crip(_el, _cid) {
    if (_crips && _crips_p) {
      _crips_p.removeChild(_crips);
      _crips = false;
    }
    if ((_crips_p != _el.parentNode) || (_crips_op != 'crip')) {
      var d = document.createElement('div');
      d.innerHTML = '<form class="crip" onsubmit="return checkCripText(' + _cid + ')"> \
        <input type="text" class="crip_title" id="crip_title" /> \
        <textarea class="crip_comment" id="crip_comment"></textarea> \
        <input type="submit" value="Trimite!" /> \
      </form>';
      insertAfter(_el.next('p'), d);
      $('crip_title').value = 'Re: ' + $('pareret' + _cid).innerHTML;
      $('crip_comment').select();
      $('crip_comment').focus();
      _crips = d;
      _crips_p = _el.parentNode;
      _crips_op = 'crip';
    }
    else {
      _crips_p = false;
      _crips_op = false;
      $('c_type').value = 'comment';
      checkText_insertAfter = 'c_comment';
    }
}

function checkCcipText(_cid) {
    checkText_insertAfter = 'ccip_comment';
    if (checkText('ccip_comment')) {
      $('c_type').value = $('ccip_type').value + _cid;
      $('c_title').value = $('ccip_title').value;
      $('c_comment').value = $('ccip_comment').value;
      checkText_insertAfter = 'c_comment';
      $('c_comment_form').submit();
    }
    return false;
}

function ccip(_el, _cid) {
    if (_crips && _crips_p) {
      _crips_p.removeChild(_crips);
      _crips = false;
    }
    if ((_crips_p != _el.parentNode) || (_crips_op != 'ccip')) {
      var d = document.createElement('div');
      d.innerHTML = '<form class="ccip" onsubmit="return checkCcipText(' + _cid + ')"> \
        <input type="text" class="ccip_title" id="ccip_title" /> \
        <textarea class="ccip_comment" id="ccip_comment"></textarea> \
        <input type="hidden" id="ccip_type" value="" /> \
        <input type="submit" value="Modifica!" /> \
      </form>';
      insertAfter(_el.next('p'), d);
      if ($('pareret' + _cid)) {
          $('ccip_title').value = $('pareret' + _cid).innerHTML;
          $('ccip_comment').value = $('pc' + _cid).innerHTML.replace(/(<br>|<br \\>)/ig, '').stripTags().strip();
          $('ccip_type').value = 'edit_';
      }
      else if ($('prt' + _cid)) {
          $('ccip_title').value = $('prt' + _cid).innerHTML;
          $('ccip_comment').value = $('prc' + _cid).innerHTML.replace(/(<br>|<br \\>)/ig, '').stripTags().strip();
          $('ccip_type').value = 'edit_response_';
      }
      //$('ccip_comment').select();
      $('ccip_comment').focus();
      _crips = d;
      _crips_p = _el.parentNode;
      _crips_op = 'ccip';
    }
    else {
      _crips_p = false;
      _crips_op = false;
      $('c_type').value = 'comment';
      checkText_insertAfter = 'c_comment';
    }
}

var NW_mo = false;
function xNW(manualHide) {
  if ((true === manualHide) || (false == NW_mo)) {
    new Effect.Morph('notification-window', {
      'style': 'height:0px',
      'duration': 0.5
    });
  }
  if (true === manualHide) {
    new Cookie.set('NW', 1, 86400);
  }
  else if (true == NW_mo) {
    window.setTimeout(function(){
      xNW();
    }, 3000);
  }
}
function oNW() {
  var targetHeight = $$('#notification-window div')[0].offsetHeight;
  new Effect.Morph('notification-window', {
    'style': 'height:' + (targetHeight + 19) + 'px',
    'duration': 0.5
  });
  window.setTimeout(function(){
    xNW();
  }, 10000);
}
function iNW(delay) {
  $$('#notification-window h5')[0].innerHTML = '<span>[x]</span> ' + $$('#notification-window h5')[0].innerHTML;
  $$('#notification-window h5')[0].observe('click', function(){xNW(true);});
  $('notification-window').observe('mouseover', function() {
    NW_mo = true;
  });
  $('notification-window').observe('mouseout', function() {
    NW_mo = false;
  });
  if (isNaN(delay)) {
    delay = 2000;
  }
  window.setTimeout(function(){
    oNW();
  }, delay);
}
/* swfobject.js */
 /**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
/* on_page_edit.js */
 var URL_EDITVALUES = 'http://www.cinemarx.ro/ope/get.php?id=';

function editValues(_id, _params)
{
  var ope_w = document.getElementById('on_page_edit_wrapper');
  var ope_c = document.getElementById('on_page_edit_container');
  var ope_b = document.getElementById('rx_body');
  if (ope_w && ope_c && ope_b)
  {
    ope_w.style.display = '';
    ope_c.src = URL_EDITVALUES + _id + '&' + _params;
    ope_c.style.height = ope_b.offsetHeight + 'px';
  }
}

function closeEditValues()
{
  var ope_w = document.getElementById('on_page_edit_wrapper');
  ope_w.style.display = 'none';
  var ope_c = document.getElementById('on_page_edit_container');
  ope_c.src = URL_EDITVALUES + 'none';
}

/* modalbox.js */
 /*
ModalBox - The pop-up window thingie with AJAX, based on prototype and script.aculo.us.

Copyright Andrey Okonetchnikov (andrej.okonetschnikow@gmail.com), 2006-2007
All rights reserved.

Last Modified By: szz

VERSION 1.5.5.2
Last Modified: 11/25/2008
*/

if (!window.Modalbox)
	var Modalbox = new Object();

Modalbox.Methods = {
	overrideAlert: false, // Override standard browser alert message with ModalBox
	focusableElements: new Array,
	options: {
		title: "ModalBox Window", // Title of the ModalBox window
		overlayClose: true, // Close modal box by clicking on overlay
		width: 500, // Default width in px
		height: 90, // Default height in px
		overlayOpacity: .75, // Default overlay opacity
		overlayDuration: .25, // Default overlay fade in/out duration in seconds
		slideDownDuration: .5, // Default Modalbox appear slide down effect in seconds
		slideUpDuration: .15, // Default Modalbox hiding slide up effect in seconds
		resizeDuration: .2, // Default resize duration seconds
		inactiveFade: true, // Fades MB window on inactive state
		transitions: true, // Toggles transition effects. Transitions are enabled by default
		loadingString: "Please wait. Loading...", // Default loading string message
		closeString: "Close window", // Default title attribute for close window link
		params: {},
    onShow: function() {
      var _location = window.location.toString().slice(0);
      pageTracker._trackPageview('/modalbox' + _location.replace(/http:\/\/[^\/]*/, ''));
    },
		method: 'get' // Default Ajax request method
	},
	_options: new Object,
	
	setOptions: function(options) {
		Object.extend(this.options, options || {});
	},
	
	_init: function(options) {
		// Setting up original options with default options
		Object.extend(this._options, this.options);
		this.setOptions(options);
		//Create the overlay
		this.MBoverlay = Builder.node("div", { id: "MB_overlay", opacity: "0" });
		//Create the window
		this.MBwindow = Builder.node("div", {id: "MB_window", style: "display: none"}, [
			this.MBframe = Builder.node("div", {id: "MB_frame"}, [
				this.MBheader = Builder.node("div", {id: "MB_header"}, [
					this.MBcaption = Builder.node("div", {id: "MB_caption"}),
					this.MBclose = Builder.node("a", {id: "MB_close", title: this.options.closeString, href: "#"}, [
						Builder.build("<span>&times;</span>"),
					]),
				]),
				this.MBcontent = Builder.node("div", {id: "MB_content"}, [
					this.MBloading = Builder.node("div", {id: "MB_loading"}, this.options.loadingString),
				]),
			]),
		]);
		
		// If title isn't given, the header will not displayed 
		if(!this.options.title) this.MBheader.hide();
		
		// Inserting into DOM
		document.body.insertBefore(this.MBwindow, document.body.childNodes[0]);
		document.body.insertBefore(this.MBoverlay, document.body.childNodes[0]);
		
		// Initial scrolling position of the window. To be used for remove scrolling effect during ModalBox appearing
		this.initScrollX = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft;
		this.initScrollY = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
		
		//Adding event observers
		this.hide = this.hide.bindAsEventListener(this);
		this.close = this._hide.bindAsEventListener(this);
		this.kbdHandler = this.kbdHandler.bindAsEventListener(this);
		this._initObservers();

		this.initialized = true; // Mark as initialized
		this.active = true; // Mark as active
		this.currFocused = 0;
	},
	
	show: function(content, options) {

    // hide troubled controls
    var els, v = 'hidden';
    var hide = ['select', 'object', 'embed']; // tags to show/hide
    for(var i = 0; i < hide.length; ++i){
        els = document.getElementsByTagName(hide[i]);
        for(var j = 0, len = els.length; j < len; ++j){
            els[j].style.visibility = v;
        }
    }

    if(!this.initialized) this._init(options); // Check for is already initialized
		
		this.content = content;
		this.setOptions(options);
		
		Element.update(this.MBcaption, this.options.title); // Updating title of the MB
		
		if(this.MBwindow.style.display == "none") { // First modal box appearing
			this._appear();
			this.event("onShow"); // Passing onShow callback
		}
		else { // If MB already on the screen, update it
			this._update();
			this.event("onUpdate"); // Passing onUpdate callback
		} 
	},
	
	hide: function(options) { // External hide method to use from external HTML and JS

    // hide troubled controls
    var els, v = 'visible';
    var hide = ['select', 'object', 'embed']; // tags to show/hide
    for(var i = 0; i < hide.length; ++i){
        els = document.getElementsByTagName(hide[i]);
        for(var j = 0, len = els.length; j < len; ++j){
            els[j].style.visibility = v;
        }
    }

		if(this.initialized) {
			if(options) Object.extend(this.options, options); // Passing callbacks
			if(this.options.transitions)
				Effect.SlideUp(this.MBwindow, { duration: this.options.slideUpDuration, afterFinish: this._deinit.bind(this) } );
			else {
				Element.hide(this.MBwindow);
				this._deinit();
			}
		} else throw("Modalbox isn't initialized");
	},
	
	alert: function(message){
		var html = '<div class="MB_alert"><p>' + message + '</p><input type="button" onclick="Modalbox.hide()" value="OK" /></div>';
		Modalbox.show(html, {title: 'Alert: ' + document.title, width: 300});
	},
		
	_hide: function(event) { // Internal hide method to use inside MB class
		if(event) Event.stop(event);
		this.hide();
	},
	
	_appear: function() { // First appearing of MB
		if(navigator.appVersion.match(/\bMSIE\b/))
			this._toggleSelects();
		this._setOverlay();
		this._setWidth();
		this._setPosition();
		if(this.options.transitions) {
			Element.setStyle(this.MBoverlay, {opacity: 0});
			new Effect.Fade(this.MBoverlay, {
					from: 0, 
					to: this.options.overlayOpacity, 
					duration: this.options.overlayDuration, 
					afterFinish: function() {
						new Effect.SlideDown(this.MBwindow, {
							duration: this.options.slideDownDuration, 
							afterFinish: function(){ 
								this._setPosition(); 
								this.loadContent();
							}.bind(this)
						});
					}.bind(this)
			});
		} else {
			Element.setStyle(this.MBoverlay, {opacity: this.options.overlayOpacity});
			Element.show(this.MBwindow);
			this._setPosition(); 
			this.loadContent();
		}
		this._setWidthAndPosition = this._setWidthAndPosition.bindAsEventListener(this);
		Event.observe(window, "resize", this._setWidthAndPosition);
	},
	
	resize: function(byWidth, byHeight, options) { // Change size of MB without loading content
		var wHeight = Element.getHeight(this.MBwindow);
		var wWidth = Element.getWidth(this.MBwindow);
		var hHeight = Element.getHeight(this.MBheader);
		var cHeight = Element.getHeight(this.MBcontent);
		var newHeight = ((wHeight - hHeight + byHeight) < cHeight) ? (cHeight + hHeight - wHeight) : byHeight;
		this.setOptions(options); // Passing callbacks
		if(this.options.transitions) {
			new Effect.ScaleBy(this.MBwindow, byWidth, newHeight, {
					duration: this.options.resizeDuration, 
				  	afterFinish: function() { 
						this.event("_afterResize"); // Passing internal callback
						this.event("afterResize"); // Passing callback
					}.bind(this)
				});
		} else {
			this.MBwindow.setStyle({width: wWidth + byWidth + "px", height: wHeight + newHeight + "px"});
			setTimeout(function() {
				this.event("_afterResize"); // Passing internal callback
				this.event("afterResize"); // Passing callback
			}.bind(this), 1);
			
		}
		
	},
	
	_update: function() { // Updating MB in case of wizards
		Element.update(this.MBcontent, "");
		this.MBcontent.appendChild(this.MBloading);
		Element.update(this.MBloading, this.options.loadingString);
		this.currentDims = [this.MBwindow.offsetWidth, this.MBwindow.offsetHeight];
		Modalbox.resize((this.options.width - this.currentDims[0]), (this.options.height - this.currentDims[1]), {_afterResize: this._loadAfterResize.bind(this) });
	},
	
	loadContent: function () {
		if(this.event("beforeLoad") != false) { // If callback passed false, skip loading of the content
			if(typeof this.content == 'string') {
				
				var htmlRegExp = new RegExp(/<\/?[^>]+>/gi);
				if(htmlRegExp.test(this.content)) { // Plain HTML given as a parameter
					this._insertContent(this.content);
					this._putContent();
				} else 
					new Ajax.Request( this.content, { method: this.options.method.toLowerCase(), parameters: this.options.params, 
						onComplete: function(transport) {
							var response = new String(transport.responseText);
							this._insertContent(transport.responseText.stripScripts());
							response.extractScripts().map(function(script) { 
								return eval(script.replace("<!--", "").replace("// -->", ""));
							}.bind(window));
							this._putContent();
						}.bind(this)
					});
					
			} else if (typeof this.content == 'object') {// HTML Object is given
				this._insertContent(this.content);
				this._putContent();
			} else {
				Modalbox.hide();
				throw('Please specify correct URL or HTML element (plain HTML or object)');
			}
		}
	},
	
	_insertContent: function(content){
		Element.extend(this.MBcontent);
		this.MBcontent.update("");
		if(typeof content == 'string')
			this.MBcontent.hide().update(content);
		else if (typeof this.content == 'object') { // HTML Object is given
			var _htmlObj = content.cloneNode(true); // If node already a part of DOM we'll clone it
			// If clonable element has ID attribute defined, modifying it to prevent duplicates
			if(this.content.id) this.content.id = "MB_" + this.content.id;
			/* Add prefix for IDs on all elements inside the DOM node */
			this.content.getElementsBySelector('*[id]').each(function(el){ el.id = "MB_" + el.id });
			this.MBcontent.hide().appendChild(_htmlObj);
			this.MBcontent.down().show(); // Toggle visibility for hidden nodes
			if(navigator.appVersion.match(/\bMSIE\b/)) // Toggling back visibility for hidden selects in IE
				$$("#MB_content select").invoke('setStyle', {'visibility': ''});
		}
	},
	
	_putContent: function(){
		// Prepare and resize modal box for content
		if(this.options.height == this._options.height)
			Modalbox.resize(0, this.MBcontent.getHeight() - Element.getHeight(this.MBwindow) + Element.getHeight(this.MBheader), {
				afterResize: function(){
					this.MBcontent.show();
					this.focusableElements = this._findFocusableElements();
					this._setFocus(); // Setting focus on first 'focusable' element in content (input, select, textarea, link or button)
					this.event("afterLoad"); // Passing callback
				}.bind(this)
			});
		else { // Height is defined. Creating a scrollable window
			this._setWidth();
			this.MBcontent.setStyle({overflow: 'auto', height: Element.getHeight(this.MBwindow) - Element.getHeight(this.MBheader) - 13 + 'px'});
			this.MBcontent.show();
			this.focusableElements = this._findFocusableElements();
			this._setFocus(); // Setting focus on first 'focusable' element in content (input, select, textarea, link or button)
			this.event("afterLoad"); // Passing callback
		}
	},
	
	activate: function(options){
		this.setOptions(options);
		this.active = true;
		Event.observe(this.MBclose, "click", this.close);
		if(this.options.overlayClose) Event.observe(this.MBoverlay, "click", this.hide);
		Element.show(this.MBclose);
		if(this.options.transitions && this.options.inactiveFade) new Effect.Appear(this.MBwindow, {duration: this.options.slideUpDuration});
	},
	
	deactivate: function(options) {
		this.setOptions(options);
		this.active = false;
		Event.stopObserving(this.MBclose, "click", this.close);
		if(this.options.overlayClose) Event.stopObserving(this.MBoverlay, "click", this.hide);
		Element.hide(this.MBclose);
		if(this.options.transitions && this.options.inactiveFade) new Effect.Fade(this.MBwindow, {duration: this.options.slideUpDuration, to: .75});
	},
	
	_initObservers: function(){
		Event.observe(this.MBclose, "click", this.close);
		if(this.options.overlayClose) Event.observe(this.MBoverlay, "click", this.hide);
		Event.observe(document, "keypress", Modalbox.kbdHandler );
	},
	
	_removeObservers: function(){
		Event.stopObserving(this.MBclose, "click", this.close);
		if(this.options.overlayClose) Event.stopObserving(this.MBoverlay, "click", this.hide);
		Event.stopObserving(document, "keypress", Modalbox.kbdHandler );
	},
	
	_loadAfterResize: function() {
		this._setWidth();
		this._setPosition();
		this.loadContent();
	},
	
	_setFocus: function() { // Setting focus to be looped inside current MB
		if(this.focusableElements.length > 0) {
			var i = 0;
			var firstEl = this.focusableElements.find(function (el){
				i++;
				return el.tabIndex == 1;
			}) || this.focusableElements.first();
			this.currFocused = (i == this.focusableElements.length - 1) ? (i-1) : 0;
			firstEl.focus(); // Focus on first focusable element except close button
		} else
			$("MB_close").focus(); // If no focusable elements exist focus on close button
	},
	
	_findFocusableElements: function(){ // Collect form elements or links from MB content
    // var els = this.MBcontent.getElementsBySelector('input:not([type~=hidden]), select, textarea, button, a[href]');
    var els = this.MBcontent.getElementsBySelector('input[type!=hidden]', 'select', 'textarea', 'button', 'a[href]');
		els.invoke('addClassName', 'MB_focusable');
		return this.MBcontent.getElementsByClassName('MB_focusable');
		return false;
	},
	
	kbdHandler: function(e) {
		var node = Event.element(e);
		switch(e.keyCode) {

      case Event.KEY_TAB:
				Event.stop(e);
				if(!e.shiftKey) { //Focusing in direct order
					if(this.currFocused == this.focusableElements.length - 1) {
						this.focusableElements.first().focus();
						this.currFocused = 0;
					} else {
						this.currFocused++;
						this.focusableElements[this.currFocused].focus();
					}
				} else { // Shift key is pressed. Focusing in reverse order
					if(this.currFocused == 0) {
						this.focusableElements.last().focus();
						this.currFocused = this.focusableElements.length - 1;
					} else {
						this.currFocused--;
						this.focusableElements[this.currFocused].focus();
					}
				}
				break;			

      case Event.KEY_ESC:
				if(this.active) this._hide(e);
				break;
			case 32:
				this._preventScroll(e);
				break;
			case 0: // For Gecko browsers compatibility
				if(e.which == 32) this._preventScroll(e);
				break;
			case Event.KEY_UP:
			case Event.KEY_DOWN:
			case Event.KEY_PAGEDOWN:
			case Event.KEY_PAGEUP:
			case Event.KEY_HOME:
			case Event.KEY_END:
				// Safari operates in slightly different way. This realization is still buggy in Safari.
				if(/Safari|KHTML/.test(navigator.userAgent) && !["textarea", "select"].include(node.tagName.toLowerCase()))
					Event.stop(e);
				else if( (node.tagName.toLowerCase() == "input" && ["submit", "button"].include(node.type)) || (node.tagName.toLowerCase() == "a") )
					Event.stop(e);
				break;
		}
	},
	
	_preventScroll: function(event) { // Disabling scrolling by "space" key
		if(!["input", "textarea", "select", "button"].include(Event.element(event).tagName.toLowerCase())) 
			Event.stop(event);
	},
	
	_deinit: function()
	{	
		this._removeObservers();
		Event.stopObserving(window, "resize", this._setWidthAndPosition );
		if(this.options.transitions) {
			Effect.toggle(this.MBoverlay, 'appear', {duration: this.options.overlayDuration, afterFinish: this._removeElements.bind(this) });
		} else {
			this.MBoverlay.hide();
			this._removeElements();
		}
		Element.setStyle(this.MBcontent, {overflow: '', height: ''});
	},
	
	_removeElements: function () {
		if(navigator.appVersion.match(/\bMSIE\b/)) {
			this._prepareIE("", ""); // If set to auto MSIE will show horizontal scrolling
			window.scrollTo(this.initScrollX, this.initScrollY);
		}
		Element.remove(this.MBoverlay);
		Element.remove(this.MBwindow);
		
		/* Replacing prefixes 'MB_' in IDs for the original content */
		if(typeof this.content == 'object' && this.content.id && this.content.id.match(/MB_/)) {
			this.content.getElementsBySelector('*[id]').each(function(el){ el.id = el.id.replace(/MB_/, ""); });
			this.content.id = this.content.id.replace(/MB_/, "");
		}
		/* Initialized will be set to false */
		this.initialized = false;
		
		if(navigator.appVersion.match(/\bMSIE\b/))
			this._toggleSelects(); // Toggle back 'select' elements in IE
		this.event("afterHide"); // Passing afterHide callback
		this.setOptions(this._options); //Settings options object into intial state
	},
	
	_setOverlay: function () {
		if(navigator.appVersion.match(/\bMSIE\b/)) {
			this._prepareIE("3000px", "hidden");
			if (!navigator.appVersion.match(/\b7.0\b/)) window.scrollTo(0,0); // Disable scrolling on top for IE7
		}
	},
	
	_setWidth: function () { //Set size
		Element.setStyle(this.MBwindow, {width: this.options.width + "px", height: this.options.height + "px"});
	},
	
	_setPosition: function () {
		Element.setStyle(this.MBwindow, {left: Math.round((Element.getWidth(document.body) - Element.getWidth(this.MBwindow)) / 2 ) + "px"});
	},
	
	_setWidthAndPosition: function () {
		Element.setStyle(this.MBwindow, {width: this.options.width + "px"});
		this._setPosition();
	},
	
	_getScrollTop: function () { //From: http://www.quirksmode.org/js/doctypes.html
		var theTop;
		if (document.documentElement && document.documentElement.scrollTop)
			theTop = document.documentElement.scrollTop;
		else if (document.body)
			theTop = document.body.scrollTop;
		return theTop;
	},
	// For IE browsers -- IE requires height to 100% and overflow hidden (taken from lightbox)
	_prepareIE: function(height, overflow){

    var body = document.getElementsByTagName('body')[0];
		body.style.height = height;
		body.style.overflow = overflow;
  
		var html = document.getElementsByTagName('html')[0];
		html.style.height = height;
		html.style.overflow = overflow; 

	},
	// For IE browsers -- hiding all SELECT elements
	_toggleSelects: function() {
		var selects = $$("select");
		if(this.initialized) {
			selects.invoke('setStyle', {'visibility': 'hidden'});
		} else {
			selects.invoke('setStyle', {'visibility': ''});
		}
			
	},
	event: function(eventName) {
		if(this.options[eventName]) {
			var returnValue = this.options[eventName](); // Executing callback
			this.options[eventName] = null; // Removing callback after execution
			if(returnValue != undefined) 
				return returnValue;
			else 
				return true;
		}
		return true;
	}
}

Object.extend(Modalbox, Modalbox.Methods);

if(Modalbox.overrideAlert) window.alert = Modalbox.alert;

Effect.ScaleBy = Class.create();
Object.extend(Object.extend(Effect.ScaleBy.prototype, Effect.Base.prototype), {
  initialize: function(element, byWidth, byHeight, options) {
    this.element = $(element)
    var options = Object.extend({
	  scaleFromTop: true,
      scaleMode: 'box',        // 'box' or 'contents' or {} with provided values
      scaleByWidth: byWidth,
	  scaleByHeight: byHeight
    }, arguments[3] || {});
    this.start(options);
  },
  setup: function() {
    this.elementPositioning = this.element.getStyle('position');
      
    this.originalTop  = this.element.offsetTop;
    this.originalLeft = this.element.offsetLeft;
	
    this.dims = null;
    if(this.options.scaleMode=='box')
      this.dims = [this.element.offsetHeight, this.element.offsetWidth];
	 if(/^content/.test(this.options.scaleMode))
      this.dims = [this.element.scrollHeight, this.element.scrollWidth];
    if(!this.dims)
      this.dims = [this.options.scaleMode.originalHeight,
                   this.options.scaleMode.originalWidth];
	  
	this.deltaY = this.options.scaleByHeight;
	this.deltaX = this.options.scaleByWidth;
  },
  update: function(position) {
    var currentHeight = this.dims[0] + (this.deltaY * position);
	var currentWidth = this.dims[1] + (this.deltaX * position);
	
	currentHeight = (currentHeight > 0) ? currentHeight : 0;
	currentWidth = (currentWidth > 0) ? currentWidth : 0;
	
    this.setDimensions(currentHeight, currentWidth);
  },

  setDimensions: function(height, width) {
    var d = {};
    d.width = width + 'px';
    d.height = height + 'px';
    
	var topd  = Math.round((height - this.dims[0])/2);
	var leftd = Math.round((width  - this.dims[1])/2);
	if(this.elementPositioning == 'absolute' || this.elementPositioning == 'fixed') {
		if(!this.options.scaleFromTop) d.top = this.originalTop-topd + 'px';
		d.left = this.originalLeft-leftd + 'px';
	} else {
		if(!this.options.scaleFromTop) d.top = -topd + 'px';
		d.left = -leftd + 'px';
	}
    this.element.setStyle(d);
  }
});

/* movies.js */
 var M_STORETHUMBS_URL = BASE_URL + 'filme/p.php?m_thumbs';
var M_GETPHOTOS_URL = BASE_URL + 'filme/p.php?m_gphotos';
var M_OPTIONS_URL = BASE_URL + 'filme/p.php?m_options';
var M_NEXTPHOTOS_URL = BASE_URL + 'filme/p.php?m_nextphotos';
var M_NEXTCOMMENTS_URL = BASE_URL + 'filme/p.php?othercomments';
var M_RELOADCOMMENTS_URL = BASE_URL + 'filme/p.php?reload-comments';

var __TRAILERS_JS_INCLUDED__;
if (!__TRAILERS_JS_INCLUDED__)
{
  function st(_cid, _direction)
  {
    getData(M_STORETHUMBS_URL, 'c_' + _cid, 'cid=' + _cid + '&t=' + _direction);
  }
}

function ggph(_id)
{
  getData(M_GETPHOTOS_URL, 'ggph_c', 'movie_id=' + _id);
}

function gopt(_id, _type)
{
  getData(M_OPTIONS_URL, 'opt_' + _type, 'type=' + _type + '&movie_id=' + _id);
}

_oc_edit_detailed_opened = false;
function oc_edit_detailed()
{
  if (false == _oc_edit_detailed_opened)
  {
    $('m_edit_detailed').style.display = 'block';
  }
  else
  {
    $('m_edit_detailed').style.display = 'none';
  }
  _oc_edit_detailed_opened = !_oc_edit_detailed_opened;
}

function cr(_cid)
{
  $('c_title').value = 'Re: ' + $('pareret' + _cid).innerHTML;
  $('c_type').value = _cid;
  //$('c_title').select();
  $('c_title').focus();
}

function fstt()
{
  Event.observe(window, 'load', function() {
    $('send_to_trailer').style.display = '';
    $('send_to_trailer').style.top = $('m_trailer').offsetTop + 'px';
    $('send_to_trailer').style.left = $('m_trailer').offsetLeft + 'px';
    $('send_to_trailer').style.width = $('m_trailer').offsetWidth + 'px';
    $('send_to_trailer').style.height = $('m_trailer').offsetHeight + 'px';
  });
}

var __more_photos_to_fetch__ = true;
var __more_photos_start__ = 10;
function np(_start)
{
  if (true == __more_photos_to_fetch__)
  {
    new Ajax.Request(M_NEXTPHOTOS_URL, {method:'post', evalScripts:true, parameters: 'mid=' + rx_movie_id + '&start=' + _start, onSuccess: function (transport) {
      $('m_photos_is').innerHTML+= transport.responseText;
      if (10 >= transport.responseText.length) // ~0 = no new photos
      {
        __more_photos_to_fetch__ = false;
      }
    }});
  }
}

var __oldPos = 0;
function pscroll(_x)
{
  var w = $('m_photos_sc').getWidth();
  var W = $('m_photos_is').getWidth();
  var nextPos = (__oldPos + _x);

  if (W < w - nextPos) {
    nextPos = w - W;
  }

  if (0 < nextPos) {
    nextPos = 0;
  }

  __oldPos = nextPos;
  
  new Effect.Move($('m_photos_s'), {x: nextPos, y: 0, mode: 'absolute'});
}

var __p_scroll_step__ = 600;
function pscr(_direction)
{
  if ('left' == _direction)
  {
    pscroll(__p_scroll_step__);
  }
  if ('right' == _direction)
  {
    __more_photos_start__ += 10;
    np(__more_photos_start__);
    pscroll(-__p_scroll_step__);
  }
}

__goc_page = 1;
function goc(_a)
{
  try {_a.className = 'loading';}
  catch (e) {}
  new Ajax.Request(M_NEXTCOMMENTS_URL, {method:'post', evalScripts:true, parameters: 'mid=' + rx_movie_id + '&page=' + (++__goc_page), onSuccess: function (transport) {
    $('m_comments').innerHTML = $('m_comments').innerHTML.replace(/<!-- b_more -->[\s\S]+<!-- e_more -->/m, transport.responseText);
  }});
}

function grc(_type)
{
  try {$('m_comments_h').firstChild.className = 'loading';}
  catch (e) {}
  Cookie.set('rx_comments_order', _type, 31536000/*1y*/);
  new Ajax.Request(M_RELOADCOMMENTS_URL, {method:'post', evalScripts:true, parameters: 'mid=' + rx_movie_id, onSuccess: function (transport) {
    $('m_comments').innerHTML = $('m_comments').innerHTML.replace(/<!-- b_comments -->[\s\S]+<!-- e_comments -->/m, transport.responseText);
    __goc_page = 1;
    try {
      $('m_comments_h').firstChild.className = '';
      $('cs_' + __rxco).className = '';
      __rxco = _type;
      $('cs_' + __rxco).className = 'cs_selected';
    }
    catch (e) {}
  }});
}

function createAlertErrorMessage2()
{
  var sp = document.createElement("div");
  sp.setAttribute("id", "alert_error2");
  return sp;
}
function opt_have_alert(_id, _type)
{
  var aem = createAlertErrorMessage2();
  aem.innerHTML = 'Trebuie sa detii filmul original ca sa-l poti adauga in aceasta lista. <a href="#" onclick="gopt(' + _id + ', \'' + _type + '\');return false">Da, &icirc;l am!</a>';
  insertAfter('opt_have_a', aem);
}
function goptc(_id, _type)
{
  var _optmh = Cookie.get('optmh');
  if (_optmh < 3)
  {
    opt_have_alert(_id, _type);
    Cookie.set('optmh', Number(_optmh) + 1, 31536000/*1y*/);
  }
  else
  {
    gopt(_id, _type);
  }
}

var __rxco = null;
function createCommentSortHeader()
{
  __rxco = Cookie.get('rx_comments_order');
  switch (__rxco)
  {
    case 'vote':
    case 'date':
      break;
    default:
      __rxco = 'advanced';
  }
  var csh = document.createElement("span");
  csh.innerHTML = 'Ordonare dupa: <a id="cs_advanced" href="#" onclick="grc(\'advanced\');return false">relevanta</a> / <a id="cs_vote" href="#" onclick="grc(\'vote\');return false">calificativ</a> / <a id="cs_date" href="#" onclick="grc(\'date\');return false">data</a>';
  try {
      $('m_comments_h').insertBefore(csh, $('m_comments_h').firstChild);
      $('cs_' + __rxco).className = 'cs_selected';
  }
  catch(e) {}
}

Event.observe(window, 'load', function() {
  createCommentSortHeader();
});

function psdd()
{
  new Effect.Morph('m_photos_sc', {
    style: 'height:' + $('m_photos_isc').offsetHeight + 'px',
    duration: 0.3
  });
}
function psdu()
{
  new Effect.Morph('m_photos_sc', {
    style: 'height:99px',
    duration: 0.3
  });
}
var __psdud_state = false;
function psdud() {
  if (false == __psdud_state) {
    psdd();
  }
  else {
    psdu();
  }
  __psdud_state = !__psdud_state;
}


/* cookie.min.js */
 /**
 * @author Ryan Johnson <http://syntacticx.com/>
 * @copyright 2008 PersonalGrid Corporation <http://personalgrid.com/>
 * @package LivePipe UI
 * @license MIT
 * @url http://livepipe.net/controls/hotkey/
 * @attribution http://www.quirksmode.org/js/cookies.html
 */

if(typeof(Prototype) == "undefined")
	throw "Cookie requires Prototype to be loaded."

var Cookie = {
	set: function(name,value,seconds){
		if(seconds){
			var d = new Date();
			d.setTime(d.getTime() + (seconds * 1000));
			var expiry = '; expires=' + d.toGMTString();
		}else
			var expiry = '';
		document.cookie = name + "=" + value + expiry + "; path=/";
	},
	get: function(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;
	},
	unset: function(name){
		Cookie.set(name,'',-1);
	}
};

