dv=4;
dt=4;
clipblast=120;
firefox=navigator.userAgent.indexOf("Firefox");
if(firefox==-1) {
firefox=0;}
else {
firefox=1;}

opclast=0;
dwt=null;
upt=null;
lmore1=new Image();
lmore1.src="btns/lmore1.png";
lmore2=new Image();
lmore2.src="btns/lmore2.png";
next1=new Image();
next1.src="btns/nextnew1.png";
next2=new Image();
next2.src="btns/nextnew2.png";
top1=new Image();
top1.src="btns/top1.png";
top2=new Image();
top2.src="btns/top2.png";

document.onmousemove=getcor;
 function getcor(event)
   {
 var e=event || window.event;
      ex=e.clientX+document.body.scrollLeft  ;
      ey=e.clientY+document.body.scrollTop  ;
  
   }
function loading()
{
loadPics(ntopics);

document.getElementById('links').style.visibility='visible';
document.getElementById('next').style.visibility='visible';
loaded=true;
}

function hidemenu(felm,evnt)
{

leave=false;
if(felm.contains && evnt.toElement) {
 leave=!document.getElementById('mmenu').contains(evnt.toElement) && !document.getElementById('menu').contains(evnt.toElement) && !document.getElementById('gap').contains(evnt.toElement);


   }
else {
if(evnt.relatedTarget) {
  leave=!contained(document.getElementById('mmenu'),evnt.relatedTarget)&& !contained(document.getElementById('menu'),evnt.relatedTarget) && !contained(document.getElementById('gap'),evnt.relatedTarget);
  }}

if(leave) {
if(markets) {
btnn='2';}
else {
btnn='1';}
repBtn('mark',btnn,'mmenu','blank');
overmenu=false;
if(home) {
document.getElementById('menu').style.display='none';}

else {
roll=false;
rollup(document.getElementById('menu'),toplim-120);}
}

}


function contained(felm,toelm)
{
cont=false;
var elm=toelm;
while((elm!=null) && (elm.tagName!='Body') && !cont)  {
cont=(felm==elm);

if(!cont) {
elm=elm.parentNode;}
}


return(cont);
}




function rollmenu()
{

if(!overmenu && !unroll && outside()) {
unroll=true;
roll=false;
rollup(document.getElementById('menu'),toplim-120);
}
}
function outside()
{
mndiv=document.getElementById('menu');
mnleft=parseInt(mndiv.style.left)+22;
mnright=mnleft+parseInt(mndiv.style.width)-16;
mntop=parseInt(mndiv.style.top)-32;
mnbottom=mntop+parseInt(mndiv.style.height)+22;
if( (ey<mnbottom)) {

return(false);}
else {
return(true);}
}

function getLocs(fnode,mwid)
{
 var curr=fnode;
   var mleft=0;
   var mtop=0;
   var mwidth=0;

   while(curr.tagName!="BODY"){

      mleft+=curr.offsetLeft;
      mtop+=curr.offsetTop;
      curr=curr.offsetParent; }

marginx=(fnode.offsetWidth-mwid)/2;
mtop+=38;
toplim=mtop;

mleft+=0;
eval('document.getElementById("menu").style.top="'+mtop+'"');
if(!home) {
eval('document.getElementById("menu").style.top="'+(mtop-120)+'"');}

eval('document.getElementById("menu").style.left="'+mleft+'"');
return(toplim);
}

function rolldown(sdiv,toplim)
{
if(loaded) {
if(upt) {
clearTimeout(upt);}
roll=true;
clipb=clipblast;
opc=opclast;
sdiv=document.getElementById(sdiv.id);

slidedown(sdiv,clipb,toplim,opc);
}
}
function slidedown(sdiv,clipb,toplim,opc)
{
sdivv=sdiv;
toplimv=toplim;
dy=Math.round((toplim-parseInt(sdiv.style.top))/dv);
if(dy<=0) {
dy=0;}
clipb-=dy;
if(clipb<=0) {
clipb=0;}
sdiv=document.getElementById(sdiv.id);
topdy=parseInt(sdiv.style.top)+dy;
eval('sdiv.style.top="'+topdy+'"');

if(parseInt(sdiv.style.top)>=(toplim-1)) {
   eval('sdiv.style.top="'+toplim+'"');;
    sdiv.style.filter='alpha(opacity=100)';

    sdiv.style.clip = 'rect(0px,170px,120px,0px)';

    clipb=0;
    opc=100;
    rolled=true;
    roll=false;
     }
clipbv=clipb;
da=Math.round((100-opc)/dv);

opc+=da;
if(opc>100) { 
      opc=100;}

opcv=opc;
clipblast=clipb;
opclast=opc;

sdiv.style.filter='alpha(opacity='+opc+')';

sdiv.style.clip = 'rect('+clipb+'px,'+170+'px,120px,0)';
if(parseInt(sdiv.style.top)<(toplim-1)) {

dwt=setTimeout("slidedown(sdivv,clipbv,toplimv,opcv)",dt); }
}

function rollup(sdiv,toplim)
{
if(loaded){
if(dwt) {
clearTimeout(dwt);}
unroll=true;
clipb=clipblast;
opc=opclast;
rolled=false;
sdiv=document.getElementById(sdiv.id);
slideup(sdiv,clipb,toplim,opc);
}
}

function slideup(sdiv,clipb,toplim,opc)
{
sdivv=sdiv;
sdiv=document.getElementById(sdiv.id);

toplimv=toplim;
dy=Math.round((toplim-parseInt(sdiv.style.top))/dv);
if(dy>0) {
dy=0;}
clipb-=dy;
if(clipb>120) {
clipb=120;}

topdy=parseInt(sdiv.style.top)+dy;
eval('sdiv.style.top="'+topdy+'"');


if(parseInt(sdiv.style.top)<=(toplim+2)) {
   eval('sdiv.style.top="'+toplim+'"');
    sdiv.style.filter='alpha(opacity=0)';

    sdiv.style.clip = 'rect(120px,170px,120px,0px)';

    clipb=120;
    opc=0;
    unroll=false;
   }
clipbv=clipb;
da=Math.round((0-opc)/(dv*2));

opc+=da;
if(opc<0) {
opc=0;}
opcv=opc;
clipblast=clipb;
opclast=opc;

sdiv.style.filter='alpha(opacity='+opc+')';

sdiv.style.clip = 'rect('+clipb+'px,'+170+'px,120px,0)';

if(parseInt(sdiv.style.top)>(toplim+1)) {
upt=setTimeout("slideup(sdivv,clipbv,toplimv,opcv)",dt); 
}

}
