﻿var repostsDivHeight = 0, repostsDivTop = 0, repostsDivOpacity = 0, FinishDivHeight = 500;
var posx=0,posy=0;
var OpacityTimerAndResize;

function ShowRepostsDiv(DivHeight){
    HideTools();
    
    IsRepostsClick=true;
    var repostsDiv = document.getElementById("RepostsDiv");

   	repostsDiv.style.filter="alpha(opacity:0)";
	repostsDiv.style.opacity="0.00";
	repostsDivOpacity = 0;
	FinishDivHeight = DivHeight;
	
	repostsDiv.style.display = 'block';
	document.getElementById("RepostsTable").style.display='none';
    repostsDivHeight=10;
    repostsDiv.style.height='3px';
    document.getElementById("RepostOverflowDiv").style.height='1px';

	OpacityTimerAndResize=window.setInterval("SetOpacityInAndResize()", "10");

    var RepostButton = document.getElementById("RepostButton");
    if (isFirefox){
	    repostsDiv.style.top=(absPosition(RepostButton).y + 22)+"px";
	}else{
	    repostsDiv.style.top=(absPosition(RepostButton).y + 19)+"px";
	}
	repostsDiv.style.left=(absPosition(RepostButton).x - 207)+"px";

	repostsDivTop=repostsDiv.offsetTop;
	if (repostsDivTop-FinishDivHeight<150) {FinishDivHeight=repostsDivTop-150};
	if (FinishDivHeight>600) {FinishDivHeight=600};
    return false;
}

function HideRepostsDiv(){
  try{
    if (IsRepostsClick==false){
        var repostsDiv = document.getElementById("RepostsDiv");
        if (repostsDiv){
	        if (OpacityTimerAndResize!=null){window.clearInterval(OpacityTimerAndResize);}
            OpacityTimerAndResize=null;
	        repostsDiv.style.display = 'none';
            repostsDiv.style.height='3px';
            document.getElementById("RepostOverflowDiv").style.height='1px';
   	        repostsDiv.style.filter="alpha(opacity:0)";
	        repostsDiv.style.opacity="0.00";
	        repostsDivHeight=10;
	    }
    }else{
        IsRepostsClick=false;
    }
  }catch(ex){}
}

function SetOpacityInAndResize(){
    var repostsDiv = document.getElementById("RepostsDiv");
	
    repostsDivOpacity+=5
	repostsDivHeight+=FinishDivHeight/20;

    repostsDiv.style.height=repostsDivHeight+'px';
    repostsDiv.style.top=repostsDivTop-repostsDivHeight+'px';

    document.getElementById("RepostOverflowDiv").style.height=(repostsDivHeight-2)+'px';


	repostsDiv.style.filter="alpha(opacity:" + repostsDivOpacity + ")";
	repostsDiv.style.opacity="0." + repostsDivOpacity;
	
	if (repostsDivOpacity>=100)
	{
		repostsDiv.style.filter="alpha(opacity:100)";
	    repostsDiv.style.opacity="1";
	    if (OpacityTimerAndResize!=null){window.clearInterval(OpacityTimerAndResize);}
        OpacityTimerAndResize=null;
        repostsDiv.style.height=FinishDivHeight+'px';
        document.getElementById("RepostOverflowDiv").style.height=(FinishDivHeight-2)+'px';
        repostsDiv.style.top=repostsDivTop-FinishDivHeight+'px';
        document.getElementById("RepostsTable").style.display='';
	}
    return false;
}

function RedirectToRepostPhoto(URL){
   //window.parent.location=URL;
   return Redirect(URL, false);
}
