function flasher(id, shrink) {
    if (document.getElementById(id)) {
        var flashElement=document.getElementById(id);
        if (flashElement.innerHTML.length>0)
            {
//                Effect.Queues.get('global').interval = 100;
                new Effect.Highlight(id, {startcolor:'#FFFF00', endcolor:'#FFFFFF', duration: 4.0} );
                new Effect.Pulsate(id, {duration: 0.5, pulses: 1});
                if (shrink !== false) new Effect.Shrink(id, {duration: 0.5, queue: 'end'} );
            }
    }
}

function highlight_message() {
//    var id="flashMessage";
    flasher('flashMessage');
    Event.stopObserving(window, 'load', highlight_message);
}

function checkInput(elem) {
    if (elem.value == 'Please enter a Keyword' ||
        elem.value == 'What do you need help with?' ||
        elem.value == 'What would you like to discuss?' ||
        elem.value == 'Tags') {
        
        // set proper values
        elem.value='';
    }
    $(elem).setStyle({color: '#000'});
}

/* Script by GalaSoft Laurent Bugnion */ 
/* 27.01.2001 */ 
/* www.galasoft.ch */ 

var cookiePath = '/'; 

// Cookie functions --------------------------------------------------------- 
// Thanx a lot to Jerry Aman, Optima System 
// and Bill Dortch, hIdaho Design for the free use of their code. 
// Found on http://www.cookiecentral.com/js_cookie8.htm 

//--------------------------------------------------------------------------- 
// Utility function to get the cookie's value 

function getCookieVal( offset ) { 
  var endstr = document.cookie.indexOf ( ";", offset ); 
  if ( endstr == -1 ) { 
    endstr = document.cookie.length; 
  } 
  return unescape( document.cookie.substring( offset, endstr ) );
}

//--------------------------------------------------------------------------- 
// Returns the value of a cookie corresponding to the name 
// Returns null if the cookie can't be found 
function getCookie( name ) { 
  var arg = name + "="; 
  var alen = arg.length; 
  var clen = document.cookie.length; 
  var i = 0; 
  while ( i < clen ) { 
    var j = i + alen; 
    if ( document.cookie.substring( i, j ) == arg ) { 
      return getCookieVal ( j ); 
    } 
    i = document.cookie.indexOf( " ", i ) + 1; 
    if ( i == 0 ) { break; } 
  } 
  return null; 
} 

//--------------------------------------------------------------------------- 
// Sets a cookie according to the name and value. 
// Optional parameters: 
// - expires (Date object) 
// - path (use cookiePath for the whole domain) 
// - domain 
// - secure 
// For more information about those parameter, check www.cookiecentral.com 
function setCookie( name, value ) { 
  var argv = setCookie.arguments; 
  var argc = setCookie.arguments.length; 
  var expires = (argc > 2) ? argv[2] : null; 
  var path = (argc > 3) ? argv[3] : null; 
  var domain = (argc > 4) ? argv[4] : null; 
  var secure = (argc > 5) ? argv[5] : false; 
  document.cookie = name + "=" + escape (value) + 
                    ( ( expires == null ) ? "" : ( "; expires=" + expires.toGMTString() ) ) + 
                    ( ( path == null ) ? "" : ( "; path=" + path ) ) + 
                    ( ( domain == null ) ? "" : ( "; domain=" + domain ) ) + 
                    ( ( secure == true ) ? "; secure" : "" ); 
}

function testCookie() { 
  // set cookie that expires in one minute
  var expDate = new Date(); 
  expDate.setTime( expDate.getTime() + ( 60 * 1000 ) ); 
  setCookie( "testCookie", "OK", expDate ); 
  
  testing = getCookie( "testCookie" ); 
  if ( testing == "OK" ) { 
    return true; 
  } else { 
    return false; 
  } 
}

function cookieMessage() {
  if (testCookie() == false) {
    document.write('<div style="color: #000; background-color: #ffc0cb; font-weight: bold; font-size: 120%; width: 760px; padding: 10px;">');
    document.write("You do not have cookies enabled for this site.  Please enable them to post/respond.<br/>");
    document.write("You can find out how <a href='http://www.google.com/cookies.html'>here</a>.");
    document.write('</div>');
  }
}


Event.observe(window, 'load', highlight_message, false)
