var page = "../popup/avisoconcurso.html"; 
var PopupWidth = 350;  //Change the PopupWidth to your requirements. 
var ScreenWidth = screen.width;//Change to your available screen width. 
document.write('<div id="a1">'); 
document.write('<div id="awesomePopup" style="display:none;">'); 
document.write('<div style="position: fixed;">'); 
document.write('<div id="myid" style="width:500px; height:400px;">'); 
document.write('<div style="width:500px;height=400px;">'); 
var frameheight = 405; 
if (frameheight > 500) { 
var frameheight = 500; 
} 
document.write('<iframe style="border:2px solid #056331;margin-top:0px;margin-left:0px;margin-right:0px;margin-bottom:0px" frameborder=0 border=0 width=320 height=' + frameheight + ' src="' + page + '"></iframe>'); 
document.write('</div>'); 
document.write('</div>'); 
document.write('</div>'); 
document.write('</div>'); 
document.write('</div>'); 
var SetPopup = document.getElementById("popup"); 
document.write('<div id="popup" style="visibility:hidden;z-index:4;width:'+PopupWidth+';position:absolute;"></div>'); 

function StartPopup(objC,c) { 
    SetPopup = document.getElementById("popup"); 
    SetPopup.innerHTML = c.innerHTML 
    SetPopup.style.left =  (screen.width -  PopupWidth)/2 //getPos(objC,"Left"); 
    var ScreenSize = getPos(objC,"Left") + PopupWidth; 
    if (ScreenSize > ScreenWidth) { 
        var scrOffsetC = getPos(objC,"Left") +  PopupWidth - (ScreenWidth); 
        SetPopup.style.left = getPos(objC,"Left") - (scrOffsetC - 0); 
    } 
    SetPopup.style.top = 90; // getPos(objC,"Top") + objC.offsetHeight))/2; 
    SetPopup.style.visibility = 'visible'; 
    document.body.innerHTML+='<div id="UpBck" style="position:absolute;width:'+ScreenWidth+';height:100%;top:0px;left:0px;background:#000000;filter:alpha(opacity=60);-moz-opacity:0.6;opacity:0.6;">' 
    UpBck.style.visibility = 'visible'; 
    document.body.style.overflow = "hidden"; 
} 

function getPos(objC,sPos) { 
    var iPos = 0; 
    while (objC != null) { 
        iPos += objC; 
        objC = objC.offsetParent; 
    } 
    return iPos; 
} 

function CloseAwesomePopup() { 
    SetPopup = document.getElementById("popup"); 
    SetPopup.style.visibility = 'hidden'; 
    UpBck.style.visibility = 'hidden'; 
    document.body.style.overflow = "auto"; 
} 


// End -->  
