
var obj_img={};
var usercontent_w=310;// offset from left
var border_width=-2;// width of border around image
var first_ratio=0.267;// ratio of first enlargement width/full width 

function news_img_over(base_id,first_call){
  if(parent&&String(parent.pM)!="undefined"&&!parent.pM){return}
  var e=document.getElementById("img_"+base_id);
  e.style.display='block';
  if(!obj_img[base_id]){
    obj_img[base_id]={enlarge:true,orig_w:e.width,orig_h:e.height,c:first_ratio};
    e.style.marginTop=-1*border_width;
  }
  if(first_call){
    obj_img[base_id].c=first_ratio;
    obj_img[base_id].enlarge=true;
  }else{
    if(!obj_img[base_id].enlarge){
      return;
    }
  }

  var w=Math.ceil(obj_img[base_id].c*obj_img[base_id].orig_w);
  var h=Math.ceil(obj_img[base_id].c*obj_img[base_id].orig_h);
  if(obj_img[base_id].c>=1){
    w=obj_img[base_id].orig_w;
    h=obj_img[base_id].orig_h;
    return;
  }
  e.width=w;
  e.height=h;
  e.style.marginLeft=usercontent_w-border_width-w+"px";
  obj_img[base_id].c=obj_img[base_id].c+0.1;
  setTimeout("news_img_over('"+base_id+"')",100);
}

function news_img_out(base_id,first_call){
  var e=document.getElementById("img_"+base_id);
  if(!obj_img[base_id]){
    obj_img[base_id]={orig_w:e.width,orig_h:e.height,c:1};
  }
  if(first_call){
    obj_img[base_id].c=obj_img[base_id].enlarge?Math.min(1,obj_img[base_id].c):1;
    obj_img[base_id].enlarge=false;
  }else{
    if(obj_img[base_id].enlarge){
      return;
    }
  }

  var w=Math.ceil(obj_img[base_id].c*obj_img[base_id].orig_w);
  var h=Math.ceil(obj_img[base_id].c*obj_img[base_id].orig_h);
  if(obj_img[base_id].c<=first_ratio){
    e.style.display='none';
    return;
  }
  e.width=w;
  e.height=h;
  e.style.marginLeft=usercontent_w-border_width-w+"px";
  obj_img[base_id].c=obj_img[base_id].c-0.1;
  setTimeout("news_img_out('"+base_id+"')",100);
}

