//Popup Box- By Jim Silver @ jimsilver47@yahoo.com
//Exlusive permission granted to Dynamic Drive (http://dynamicdrive.com) to include this script in their DHTML archive.
//For full source code, terms of use, and 100's more scripts, visit http://www.dynamicdrive.com

var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

var showed = 0;

//drag drop function for NS 4////
/////////////////////////////////

var dragswitch=0
var nsx
var nsy
var nstemp

function drag_dropns(name){
if (!ns4)
return
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}

//drag drop function for ie4+ and NS6////
/////////////////////////////////


////drag drop functions end here//////

function hidebox(cook){

if(!cook) {
    var expdate = new Date ();
	expdate.setMonth(expdate.getMonth() + 12); // one year from now
   SetCookie("layerclose", "1", expdate,"/");
}

if(ie4||ns6) crossobj=ns6? document.getElementById("showimage") : document.all.showimage
if (ie4||ns6)
crossobj.style.visibility="hidden"
else if (ns4)
document.showimage.visibility="hide"
}

function showbox(){
if (showed ==0 ) { showed = parseInt(GetCookie("layerclose")); }
if (showed == 1) {return;}

//crossobj=ns6? document.getElementById("showimage") : document.all.showimage
if(ie4||ns6) crossobj=ns6? document.getElementById("showimage") : document.all.showimage
if (ie4||ns6)
crossobj.style.visibility="visible"
else if (ns4)
document.showimage.visibility="show"

showed=1;
}

function SetCookie (name,value,expires,path,domain,secure)
{
        document.cookie = name + "=" + escape (value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function getCookieVal (offset)
{
        var endstr = document.cookie.indexOf (";", offset);
        if (endstr == -1)
                endstr = document.cookie.length;
        return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name)
{
        var arg = name + "=";
        var alen = arg.length;
        var clen = document.cookie.length;
        if( (document.cookie == null) || (document.cookie.length == null))
        {
                return null;
        }
        var i = 0;
        while (i < clen)
        {
                var j = i + alen;
                if (document.cookie.substring(i, j) == arg)
                        return getCookieVal (j);
                i = document.cookie.indexOf(" ", i) + 1;
                if (i == 0) break;
        }
        return null;
}

function POP(URL) {
  popupWin = window.open(URL, 'Participant', 'width=400,height=350,menubar=no,resizable=yes,scrollbars=yes')
    window.top.name = 'opener';
	hidebox(1);
}

//timerID = setTimeout("showbox()", 5000);

