function showPopup(popupName, shadowName, titleText){
    var popup = $(popupName);//document.getElementById(popupName);
    var shadow = $(shadowName);//document.getElementById(shadowName);
    var title = document.getElementById(popupName + "Title")
    if(popup==null || shadow==null){
        return;
    }
    var width = Width();
    var height = Height();
    
    shadow.style.left=0;
    shadow.style.top=0;
    shadow.style.width = width + "px";
    shadow.style.height = height + "px";
    
    var pheight = height*80/100;
    var pwidth = width*80/100;
    
    var pleft = width/2-pwidth/2;
    var ptop = height/2-pheight/2;
    
    popup.style.left = pleft + "px";
    popup.style.top = ptop + "px";
    popup.style.width = pwidth + "px";
    popup.style.height = pheight + "px";
    
    document.body.oldClass = document.body.className;
    document.body.className = "document-hidden-body";
    if(title!=null && titleText!=null){
        title.innerHTML = titleText;
    }
    showObject(shadow);
    showObject(popup);
    scroll(0,0)
}

function hidePopup(popupName, shadowName){
    var popup = $(popupName);//document.getElementById(popupName);
    var shadow = $(shadowName);//document.getElementById(shadowName);
    if(popup==null || shadow==null){
        return;
    }
    
    document.body.className = document.body.oldClass;
    hideObject(shadow);
    hideObject(popup);
}

function closePopup(){
    hidePopup("popup", "popupShadow")
}

function hideObject(object){
    if(object==null) return;
    object.style.display="none";
    object.style.visibility="hidden";
}

function showObject(object){
    if(object==null) return;
    object.style.visibility="visible";
    object.style.display='block';
}

function Width()
{
    if (parseInt(navigator.appVersion)>3) 
    {
        winW=0;
         if (navigator.appName=="Netscape") 
         {
            winW = window.innerWidth;
         }
         if (navigator.appName.indexOf("Microsoft")!=-1) 
         {
          winW = document.body.offsetWidth;
         }
         if(winW==0)
         {
            winW = window.innerWidth;
         }
    }
    return winW;
}

function Height()
{
    if (parseInt(navigator.appVersion)>3) 
    {
        winH=0;
         if (navigator.appName=="Netscape") 
         {
            winH = window.innerHeight;
         }
         if (navigator.appName.indexOf("Microsoft")!=-1) 
         {
            if(typeof(document.documentElement)!="undefined"){
                if(document.documentElement.clientHeight<document.body.offsetHeight){
                    winH = document.documentElement.clientHeight;
                }
                else{
                    winH = document.body.offsetHeight;
                }
            }
            else{
                winH = document.body.offsetHeight;
            }
         }
         if(winH==0)
         {
            winH = window.innerHeight;
         }
    }
    return winH;
}

function DinamicObj(objName, url, parameters, returnFunc, safe)
{ 
//var d= new Date();
//var t1 = d.getMilliseconds()+d.getSeconds()*1000;
if(safe==null)
    safe=false;

var gObjName=objName;
var xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
 {
    alert ("Browser does not support HTTP Request");
    return;
 }
xmlhttp.onreadystatechange=function()
{
    if(xmlhttp!=null)
    {
        if(xmlhttp.readyState!=null)
        {
            if ((xmlhttp.readyState==4 || xmlhttp.readyState=="complete") && gObjName!=null)
            { 
                if(xmlhttp.responseText!="")
                {
                    if(document.getElementById(gObjName)!=null)
                    {
                        if(document.getElementById(gObjName).tagName=="INPUT" || document.getElementById(gObjName).tagName=="TEXTAREA")
                        {
                          if(safe==false)
                                document.getElementById(gObjName).innerHTML=xmlhttp.responseText;
                            else
                               document.getElementById(gObjName).innerHTML=unescape(xmlhttp.responseText.replace(/\+/g, '%20'));
                          //  var t2 = d.getMilliseconds()+d.getSeconds()*1000;
                          //  alert(t1-t1);
                        }
                        else
                        {
                            if(safe==false)
                                document.getElementById(gObjName).innerHTML=xmlhttp.responseText;
                            else
                               document.getElementById(gObjName).innerHTML=unescape(xmlhttp.responseText.replace(/\+/g, '%20'));
                          //  var t2 = d.getMilliseconds()+d.getSeconds()*1000;
                         //   alert(t1-t1);
                        }
                    }
                    else if(window.parent.document.getElementById(gObjName)!=null)
                    {
                        if(window.parent.document.getElementById(gObjName).tagName=="INPUT" || window.parent.document.getElementById(gObjName).tagName=="TEXTAREA")
                        {
                            if(safe==false)
                                window.parent.document.getElementById(gObjName).innerHTML=xmlhttp.responseText;
                            else
                                window.parent.document.getElementById(gObjName).innerHTML=unescape(xmlhttp.responseText.replace(/\+/g, '%20'));
                          //  var t2 = d.getMilliseconds()+d.getSeconds()*1000;
                          //  alert(t1-t1);
                        }
                        else
                        {
                            if(safe==false)
                                window.parent.document.getElementById(gObjName).innerHTML=xmlhttp.responseText;
                            else
                                window.parent.document.getElementById(gObjName).innerHTML=unescape(xmlhttp.responseText.replace(/\+/g, '%20'));
                        }
                    }
                    if(returnFunc!=null)
                    {
                        returnFunc();
                    }
                }
                else
                {
                    try
                    {
                        window.parent.status = "OK";
                    }
                    catch(e){}
                }
            }
        } 
    }
};
xmlhttp.open("GET",url,true);
if(parameters!=null)
{
   xmlhttp.send(encodeURI(parameters));
}
else
{
    xmlhttp.send(null);
}
}


function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

