/**
 * captures redirect event, redirects to selected index from <select> node
 * @author Peter Kruithof
 */
function onRedirectFromSelection(e)
{
    if (e) {
        cancelEvent(e);

        var target = getTarget(e);

        if (target) {
            var loc = target.options[target.selectedIndex].value;
            document.location.href = loc;
        }
    }
}


//billboard
function getCookie(name)
{
 var start = document.cookie.indexOf( name + "=" );
 var len = start + name.length + 1;
 if ((!start) && (name != document.cookie.substring(0, name.length))) {
     return null;
 }
 if (start == -1) return null;
 var end = document.cookie.indexOf(";", len);
 if (end == -1) end = document.cookie.length;
 return unescape(document.cookie.substring(len, end));
}

function initBillboard()
{
// if (billboardArgs) {
     var id = billboardArgs[0].id;

     // check if cookie has been set
     var cookie = getCookie('hide_' + id);
     if (cookie) return;

//     if (id) {

         var node = document.getElementById(id);
//         billboardArgs.push(node);
         openBillboard(node.parentNode);
//now done in template itself because this won't work in ie
//         swfobject.createSWF.apply(swfobject, billboardArgs);
//     }
// }
}

function openBillboard(node)
{
 if (node) {
     node.className = node.className.replace(/nodisplay/, '');
 }
}

function closeBillboard(id)
{
 var node = document.getElementById(id);
 if (node) {
     node.parentNode.className += ' nodisplay';
 }
}

function closeBillboardForever(id)
{
 closeBillboard(id);

 // set expiration date for cookie
 var date = new Date();
 date.setDate((date.getDate() + 30)); // set to 30 days

 // set cookie
 var cookiestring = 'hide_' + id + '=1; expires=' + date;
 document.cookie = cookiestring;
}

