
var swf="";
var fixpng=false;
var swfloaded=false;
var sp=false;
var li=false;

function setfixpng() {
   fixpng=true;
}
function insertSWF() {
   var m=document.getElementById('menu');
   if(swf)
     m.innerHTML=swf;
}

function getFullPage(jumpto) {	
   if(window.top.location.pathname.indexOf('c.php')!=-1) {
		var tarGet='index.php';
		if(jumpto!='') {
			tarGet+='?jto='+jumpto;
		}		
      window.top.location.href=tarGet;
   }
}
/* function insertSWF() {
   window.setTimeout('insertSWFCode();',25);
}
function insertSWFCode() {
   var m=document.getElementById('menu');
   if(swf)
     m.innerHTML=swf;
}
 */
function setPage(tm) {
  if(!swfloaded) {
    if(!sp)
       sp=window.setInterval("setPage('"+tm+"')",300);
  } else {
    if(sp) {
       window.clearInterval(sp);
    }
    if (window.document.MEN) {
      window.document.MEN.SetVariable("_root.SET_TM", tm);
      window.document.MEN.SetVariable("_root.PAGE_WAIT", 0);
    }
  }
}

function loadIMG(img) {
  if(!swfloaded) {
    if(!li)
      li=window.setInterval("loadIMG('"+img+"')",1000);
  } else {
    if(li)
       window.clearInterval(li);
    if (window.document.MEN) {
       window.document.MEN.SetVariable("_root.SET_IMG", img);
    }
  }
}
function waitforswf(foo) {
   parent.swfloaded=foo;
}
function insertIt(tm) {
 var a = document.getElementById('framediv');
 var b = window.frames[0].document.body;
 var c = document.getElementById('footer_case');
 var d = window.frames[0].document.getElementById('rep_footer');
 c.innerHTML=d.innerHTML;
 d.innerHTML="";
 d.style.display="none";
 a.innerHTML = b.innerHTML;
 setPage(tm);
 blur_it();
 if(fixpng) {
    pngfix();
 }
}

function blur_it() {
  var alla=document.getElementsByTagName('a');
  if(alla) {
    for(var i=0;i<alla.length;i++) {
      if(alla[i])
        alla[i].onfocus=new Function("if(this.blur)this.blur();");
    }
  }
}
function insertTagm(frame) {
 var a = document.getElementById('navi');
 var b = window.frames[frame].document.body;
 a.innerHTML = b.innerHTML;
}

function refreshNavi() {
 window.frames[1].location.href='c.php?c=tmnavi';
}
function goank() {
 var ank = window.frames[0].location.hash;
 var loc = location.href;
 if(ank!="") {
    var end=loc.indexOf('#');
    loc=loc.substring(0,end);
    location.href = loc+ank;
 }
}

function findPos(obj) {
  var curleft = curtop = 0;
  if (obj.offsetParent) {
    curleft = obj.offsetLeft;
    curtop = obj.offsetTop;
    while (obj = obj.offsetParent) {
      curleft += obj.offsetLeft;
      curtop += obj.offsetTop;
    }
  }
  return [curtop,curleft];
}
function hover(lid,hid) {
   l=document.getElementById(lid);
   if(l) {
      pos=findPos(l);
   }
   a=document.getElementById(hid);
   if(a) {
      a.style.display='block';
      a.style.top=pos[0]+16+'px';
      if((pos[1]+24)<570) {
        a.style.left=pos[1]+24+'px';
      } else {
        a.style.left=570+'px';
      }
   }
}
function hide(lid,hid) {
   a=document.getElementById(hid);
   if(a) {
      a.style.display='none';
   }
}

var imgwindow;
function showimage(title,w,h) {
  if(imgwindow) {
    if(imgwindow.closed==false) {
      imgwindow.close();
    }
  }
  h+=32;
  features ='toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0'
  window_top = 10
  window_left = 10
  imgwindow=window.open('c.php?c=iv&ti='+title,'img_window','width='+w+',height='+h+',top='+window_top+',left='+window_left+',features='+features+'');
  imgwindow.focus();
}

var prev_pinfo=0;
function pinfo(id) {
   var d=document.getElementById('p'+id);
   var e=document.getElementById('p'+prev_pinfo);
   if(d)
      if(d.style.display=='block') {
          d.style.display='none';
      } else {
         if(e)
            e.style.display='none';
         d.style.display='block';
      }
   prev_pinfo=id;
}
var imgwindow;
function opengal(url) {
  if(imgwindow) {
    if(imgwindow.closed==false) {
      imgwindow.close();
    }
  }
  features ='toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0'
  window_top = 10
  window_left = 10
  imgwindow=window.open(url,'img_window','width=800,height=690,top='+window_top+',left='+window_left+',features='+features+'');
  imgwindow.focus();
}