window.onload = init;

function get_cookie_name() {
// fixed cookie name
// DO NOT MODIFY
return "[" + get_window_name() +"]";
}

function get_window_name() {
// the expected window name
return "IbsHelp";
}

function has_cookie() {
return document.cookie.length > 0 && document.cookie.indexOf(get_cookie_name() + "=") != -1;
}

function write_cookie() {
// fixed guid
// expires immediately
// global path
document.cookie = get_cookie_name() + "=ac37a437-b717-421f-98ec-165f27b61520;path=/;";
}

function init() {
// only write the cookie if
// it has been opened via script
if (window.opener != null && window.name == get_window_name() && ! has_cookie())
write_cookie();
}
