function popUpWin( url, width, height, name)
{
    var settings = "toolbar=no,"
                 + "location=no,"
                 + "directories=no,"
                 + "status=no,"
                 + "menubar=no,"
                 + "scrollbars=no,"
                 + "resizable=no,"
                 + "width=" + width + ","
                 + "height=" + height;
    str = name + "Obj = window.open( '" + url + "', '" + name + "', '" + settings + "' )";

    eval( str );
    eval( "var objRef = " + name + "Obj" );

    if( objRef ) {
        objRef.focus();
    }

    return false;
}

function goLink( url ) {
    window.location.href = url;
    return false;
}

function saveCookie( key, value, duration, path, domain ) {
    document.cookie = 'dol_' + key + "=" + escape(value) +
        ( (duration == null) ? "" : "; expires=" + getExpiryDate( duration ) ) +
        ( (path == null)     ? "" : "; path=" + path ) +
        ( (domain == null)   ? "" : "; domain=" + domain );
}

function getCookie( key ) {
    var keyPos = document.cookie.indexOf( 'dol_' + key );
    var value = '';

    if ( keyPos > -1 ) {
        var eqPos = document.cookie.indexOf( '=', keyPos );
        var scPos = document.cookie.indexOf( ';', eqPos );
        eqPos++;
        if ( scPos > -1 ) {
            value = document.cookie.substring( eqPos, scPos+1 );
        } else {
            value = document.cookie.substring( eqPos );
        }
    }
    return value;
}

function getExpiryDate( nodays ) {
    var UTCstring;
    Today = new Date();
    nomilli = Date.parse(Today);
    Today.setTime( nomilli + nodays * 24 * 60 * 60 * 1000 );
    UTCstring = Today.toUTCString();
    return UTCstring;
}

function checkEmailOnSubmit( emailId ) {
    var emailFormat = /^[a-z0-9A-Z]{1,1}[\w\.-]+@\w+\.\w+$/;
    var email = document.getElementById(emailId).value;
    if ( email.length < 6
         || !emailFormat.test( email ) ) {
        alert( 'K?rlek add meg az E-mail c?medet!' );
        return false;
    }
}


function externalLinks() {

    if (!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName("a");
    for (var i=0; i<anchors.length; i++) {
        var anchor = anchors[i];
        if ( anchor.getAttribute("href") && anchor.getAttribute("rel") == "external" )
            anchor.target = "_blank";
    }

}

var initFunctionsArray = new Array();
var same =  Math.floor(Math.random()*1000000);

function initializePage() {

    for( var i=0; i<initFunctionsArray.length; i++ ) {
        eval( initFunctionsArray[i] );
    }

    externalLinks();

}

window.onload = initializePage;
