// Generate Randowm Number
function GetRandom ()
{
    var randomNumber = Math.floor ( Math.random() * 5 );
    if ( randomNumber == 0 ) randomNumber = GetRandom();
    return randomNumber;
}

function DispPopup(title, body, url)
{
var picLink = 'Popup/popup.jpg';
var faceLink = 'Popup/face.jpg';
var xLink = 'Popup/x.jpg';
document.getElementById('PopupContent').innerHTML = '<a href="' + url + '" target="_blank"><img id="PopupImg" src="' + picLink + '" width="201" height="116" border="0" alt="" /></a><div class="PopupFace"><a href="' + url + '" target="_blank"><img src="' + faceLink + '" border="0"></a></div><div class="PopupTitle"><a href="' + url + '" target="_blank" >' + title + '</a></div><div class="PopupBody"><a href="' + url + '" target="_blank">' + body + '</a></div><div id="PopupX"><a href="#" onClick="CloseBox();return false"><img src="' + xLink + '" border="0"></a></div>';
}

function CloseBox()
{
crossobj = document.getElementById("PopupContent").style;
crossobj.visibility = "hidden";
}

//<![CDATA[

var popupWinoldonloadHndlr=window.onload, popupWinpopupHgt, popupWinactualHgt, popupWintmrId=-1, popupWinresetTimer;
var popupWincntDelta;
window.onload=popupWinespopup_winLoad;

function SetPosition()
{
    var browser=navigator.appName
    var b_version=navigator.appVersion
    var version=parseFloat(b_version)

    el=document.getElementById('popupWin');

    if ( browser != "Microsoft Internet Explorer" )
    {
        el.style.position = 'fixed';
    }
    else
    {
        if ( version >= 7 )
        {
            el.style.position = 'fixed';
        }
        else
        {
            el.style.position = 'absolute';
        }
    }
}
        
function popupWinespopup_ShowPopup(show)
{
    if (popupWintmrId!=-1) return;

    el=document.getElementById('popupWin');
    el.style.right='201px';
    el.style.top='';
    el.style.filter='';
    SetPosition();

    if (navigator.userAgent.indexOf('Opera')!=-1)
        el.style.bottom=(document.body.scrollHeight*1-document.body.scrollTop*1
        -document.body.offsetHeight*1+1*popupWinpopupBottom)+'px';

    popupWinactualHgt=0; el.style.height=popupWinactualHgt+'px';
    el.style.visibility='';
    if (!popupWinresetTimer) el.style.display='';
    popupWintmrId=setInterval(popupWinespopup_tmrTimer,(popupWinresetTimer?1000:20));
}

function popupWinespopup_winLoad ()
{
    if (popupWinoldonloadHndlr!=null) popupWinoldonloadHndlr();

    elCnt=document.getElementById('popupWin_content')
    el=document.getElementById('popupWin');
    popupWinpopupBottom=el.style.bottom.substr(0,el.style.bottom.length-2);

    popupWinpopupHgt=el.style.height;
    popupWinpopupHgt=popupWinpopupHgt.substr(0,popupWinpopupHgt.length-2); popupWinactualHgt=0;
    popupWincntDelta=popupWinpopupHgt-(elCnt.style.height.substr(0,elCnt.style.height.length-2));

    popupWinresetTimer=true;
    popupWinespopup_ShowPopup(null);

}


function popupWinespopup_tmrTimer()
{
  el=document.getElementById('popupWin');
  if (popupWinresetTimer)
  {
    el.style.display='';
    clearInterval(popupWintmrId); popupWinresetTimer=false;
    popupWintmrId=setInterval(popupWinespopup_tmrTimer,20);
  }
  popupWinactualHgt+=5;
  if (popupWinactualHgt>=popupWinpopupHgt)
  {
    popupWinactualHgt=popupWinpopupHgt; clearInterval(popupWintmrId); popupWintmrId=-1;
    document.getElementById('popupWin_content').style.display='';
  }

  if ((popupWinactualHgt-popupWincntDelta)>0)
  {
    elCnt=document.getElementById('popupWin_content')
    elCnt.style.display='';
    elCnt.style.height=(popupWinactualHgt-popupWincntDelta)+'px';
  }
  el.style.height=popupWinactualHgt+'px';
}

//]]>
