function createCookie(name,value,days) 
{
    if (days) 
    {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else 
    {
        var expires = "";
    }
    document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) 
{
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) 
    {
        var c = ca[i];
        while (c.charAt(0)==' ')
             c = c.substring(1,c.length);
        if (c.indexOf(nameEQ) == 0) 
            return c.substring(nameEQ.length,c.length);
    }
    return null;
}

function popup(url,name,windowWidth,windowHeight)
{    
    myleft=(screen.width)?(screen.width-windowWidth)/2:100;	
    mytop=(screen.height)?(screen.height-windowHeight)/2:100;	
    properties = "width="+windowWidth+",height="+windowHeight+",status=0,menubar=0,location=0,scrollbars=0, top=no,";    
    window.open(url,name,properties)
}

function firstLoad()
{
    var x = readCookie('ppkcookie'); 
    if (x==null) 
    {
        popup('yas_video.html', 'videoPopup', 380, 220);
        //window.open('yas_video.html', 'videoPopup', 'status=0, toolbar=0, location=0, menubar=0, directories=0, resizable=0, scrollbars=0, width=380, height=220');
    }
    createCookie('ppkcookie','testcookie', 31);
}

//Event.observe(window, 'ondomready', firstLoad());
function addLoadEvent(func) 
{
    if(window.onload)
    {
        var oldonload = window.onload;
        window.onload = function()
        {
            oldonload();
            func();
        }
    }
    else
    {
        window.onload = func;
    }
}

addLoadEvent(firstLoad);