function $(id) {return document.getElementById(id);}

var last_poster;
function set_active_layer(layer){
  if (layer==1){
    $('layertab_2').className="div-layer-inactive";
    $('layertab_1').className="div-layer-active";
    disappear('layer_2',0,1,100);
    appear('layer_1',1,0,10);
  } else {
    $('layertab_1').className="div-layer-inactive";
    $('layertab_2').className="div-layer-active";
    disappear('layer_1',0,1,100);
    appear('layer_2',1,0,10);
  }
}


function appear(ob,x,y,timer)
{
  if (timer==undefined) timer=5;
  var t;
  var op=y;
  var obj=$(ob);
  obj.style.display="block";
  if(op < x) {
    clearTimeout(t);
    op += timer/100;
    obj.style.opacity = op;
    obj.style.filter='alpha(opacity='+op*100+')';
    t=setTimeout('appear("'+ob+'",'+x+','+op+','+timer+')',5);
  }
}
function disappear(ob,x,y,timer)
{
  if (timer==undefined) timer=5;
  var t;
  var op=y;
  var obj=$(ob);
  if(op > x) {
    clearTimeout(t);
    op -= timer/100;
    obj.style.opacity = op;
    obj.style.filter='alpha(opacity='+op*100+')';
    t=setTimeout('disappear("'+ob+'",'+x+','+op+','+timer+')',5);
  } else {
    obj.style.display="none";
  }
}

function showposter(film_id){
  if (last_poster==null) last_poster=film_id;
  $("poster"+last_poster).style.display="none";
  last_poster=film_id;
  $("poster"+last_poster).style.display="block";

}


function fconfirm(str){
  if (confirm(str)) {
	return true;
	}
  else {
	return false;
  }
}



function getLatin(str){
	  str = str.replace(/\?/g,'');
	  str = str.replace(/\:/g,'');
	  str = str.replace(/\;/g,'');
	  str = str.replace(/\|/g,'');
	  str = str.replace(/\</g,'');
	  str = str.replace(/\>/g,'');
	  str = str.replace(/\}/g,'');
	  str = str.replace(/\{/g,'');
	  str = str.replace(/\[/g,'');
	  str = str.replace(/\]/g,'');
	  str = str.replace(/\//g,'');
	  str = str.replace(/\\/g,'');
	  str = str.replace(/\+/g,'');
	  str = str.replace(/\-/g,'');
	  str = str.replace(/\=/g,'');
	  str = str.replace(/\~/g,'');
	  str = str.replace(/\#/g,'');
	  str = str.replace(/\@/g,'');
	  str = str.replace(/\$/g,'');
	  str = str.replace(/\^/g,'');
	  str = str.replace(/\&/g,'');
	  str = str.replace(/\*/g,'');
	  str = str.replace(/\(/g,'');
	  str = str.replace(/\)/g,'');
	  str = str.replace(/%/g,'');
	  str = str.replace(/\"/g,'');
	  str = str.replace(/\'/g,'');
	  str = str.replace(/,/g,'');
	  str = str.replace(/\./g,'');
	  str = str.replace(/!/g,'');
	  str = str.replace(/ /g,'_');
	  str = str.replace(/à/g,'a');
	  str = str.replace(/á/g,'b');
	  str = str.replace(/â/g,'v');
	  str = str.replace(/ã/g,'g');
	  str = str.replace(/ä/g,'d');
	  str = str.replace(/å/g,'e');
	  str = str.replace(/¸/g,'e');
	  str = str.replace(/æ/g,'zh');
	  str = str.replace(/ç/g,'z');
	  str = str.replace(/è/g,'i');
	  str = str.replace(/é/g,'j');
	  str = str.replace(/ê/g,'k');
	  str = str.replace(/ë/g,'l');
	  str = str.replace(/ì/g,'m');
	  str = str.replace(/í/g,'n');
	  str = str.replace(/î/g,'o');
	  str = str.replace(/ï/g,'p');
	  str = str.replace(/ð/g,'r');
	  str = str.replace(/ñ/g,'s');
	  str = str.replace(/ò/g,'t');
	  str = str.replace(/ó/g,'u');
	  str = str.replace(/ô/g,'f');
	  str = str.replace(/õ/g,'h');
	  str = str.replace(/ö/g,'c');
	  str = str.replace(/÷/g,'ch');
	  str = str.replace(/ø/g,'sh');
	  str = str.replace(/ù/g,'sh');
	  str = str.replace(/ú/g,'');
	  str = str.replace(/û/g,'y');
	  str = str.replace(/ü/g,'');
	  str = str.replace(/ý/g,'e');
	  str = str.replace(/þ/g,'yu');
	  str = str.replace(/ÿ/g,'ya');

	  str = str.replace(/À/g,'a');
	  str = str.replace(/Á/g,'b');
	  str = str.replace(/Â/g,'v');
	  str = str.replace(/Ã/g,'g');
	  str = str.replace(/Ä/g,'d');
	  str = str.replace(/Å/g,'e');
	  str = str.replace(/¨/g,'e');
	  str = str.replace(/Æ/g,'zh');
	  str = str.replace(/Ç/g,'z');
	  str = str.replace(/È/g,'i');
	  str = str.replace(/É/g,'j');
	  str = str.replace(/Ê/g,'k');
	  str = str.replace(/Ë/g,'l');
	  str = str.replace(/Ì/g,'m');
	  str = str.replace(/Í/g,'n');
	  str = str.replace(/Î/g,'o');
	  str = str.replace(/Ï/g,'p');
	  str = str.replace(/Ð/g,'r');
	  str = str.replace(/Ñ/g,'s');
	  str = str.replace(/Ò/g,'t');
	  str = str.replace(/Ó/g,'u');
	  str = str.replace(/Ô/g,'f');
	  str = str.replace(/Õ/g,'h');
	  str = str.replace(/Ö/g,'c');
	  str = str.replace(/×/g,'ch');
	  str = str.replace(/Ø/g,'sh');
	  str = str.replace(/Ù/g,'sh');
	  str = str.replace(/Ú/g,'');
	  str = str.replace(/Û/g,'y');
	  str = str.replace(/Ü/g,'');
	  str = str.replace(/Ý/g,'e');
	  str = str.replace(/Þ/g,'yu');
	  str = str.replace(/ß/g,'ya');
      var reg=/^[0-9]+$/i;
      if (reg.test(str)) str='cat'+str;
      return ( str);

}


