function invitation() {
    window.open("invitation.htm",
   "SurveyWindow",
   "top=150,left=150,width=340,height=300,toolbar=0,location=0,directories=0,status=0,resizable=yes,scrollbars=no,menubar=no");
}

// this function will be run onload() to check if browser accepts cookies
// if the browser does not accept cookies, do nothing
// if the browser accepts cookies, check for DND cookie
// there is a hidden form in the body of the html document - see popup window code and comments

function cookie_check() {

    // uncomment the return statement when you want to disable the popup from showing regardless
    // of whether their cookie is set or not.
    //
    // Make sure the return statement is not commented out if you want to show the invitation survey
    // depending on whether they have the cookie set or not.
    // 
    return;
    // 

    var cookieEnabled = false;

    if ( (navigator.appVersion.charAt(0) == "4") && (navigator.appName == "Netscape") ) {
        var cookieName = 'testCookie' + (new Date().getTime());
        document.cookie = cookieName + '=cookieValue';
        var cookieEnabled = document.cookie.indexOf(cookieName) != -1;
    } else {
        var cookieEnabled=(navigator.cookieEnabled)?true:false;
    }

    if (cookieEnabled) {
        //alert ("Browser accepts cookies!");
        dnd_cookie_check();
    } else {
        //alert ("Browser DOES NOT accept cookies!");
    }
}


// this function is only called if the browser accepts cookies
// it checks for the DND cookie
// if DND cookie does not exist, launch survey window
// if DND cookie DOES exist, do nothing
function dnd_cookie_check() {

    if (GetCookie('iwpopup')) {
        //alert ("DND cookie is Alredy SET - Popup will not appear");
    } else {
        //alert ("setting cookie!");
        set_dnd();
        window.open("/docs/survey/invitation.htm",
        "SurveyWindow",
        "top=150,left=150,width=340,height=300,toolbar=0,location=0,directories=0,status=0,resizable=yes,scrollbars=no,menubar=no");
    }
}

function set_dnd() {
    var expdate = new Date();
    expdate.setTime(expdate.getTime() + (180 * 24 * 60 * 60 * 1000));
    SetCookie('iwpopup', 'dnd', expdate, '', '');
    //alert ("DND Cookie set ...");
}

function delete_dnd() {
    DeleteCookie('iwpopup','','');
    //alert ("DND Cookie deleted ...");
}

function timeOutWin(n) {
    setTimeout("window.close()", n);
}

// check for ns4 as it does not support window.opener.document.survey.submit
// which has to be used to capture the refering url from the parent window
// this function currently exists in /iw/js/openSurveyPage.js - I copied it here for clarifications sake

function openInParent() {
    if( ((navigator.appVersion.charAt(0) == "4") && (navigator.appName == "Netscape")) ||
        (navigator.appVersion.indexOf("Mac") != -1) ) {
        window.opener.parent.location = "http://surveys.att.net/cgi-bin/miva/webhelpsrvy.mv";
        self.close();
    } else {
        window.opener.document.dnd_survey.submit();
        self.close();
    }
}

function getPopupURL() {

    var popURL = "http://surveys.att.net/cgi-bin/miva/webhelpsrvy.mv";
    return (popURL);
}
