
/*** Additional Parameters for Google Use ***/
var site_google_adsize = 'nosize';
var google_channel_override = 'life123';

/*** This function is used to set the cookie. This builds the appropriate cookie string and sets the cookie  ***/

function set_cookie ( name, value, expires, path, domain, secure) {
  var today = new Date();
         today.setTime( today.getTime() );
         
         /*
         if the expires variable is set, make the correct
         expires time, the current script below will set
         it for x number of days, to make it for hours,
         delete * 24, for minutes, delete * 60 * 24
         */
         if ( expires )
         {
         expires = expires * 1000 * 60 * 60 * 24;
         }
         var expires_date = new Date( today.getTime() + (expires) );
         
         document.cookie = name + "=" +escape( value ) +
         ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
         ( ( path ) ? ";path=" + path : "" ) +
         ( ( domain ) ? ";domain=" + domain : "" ) +
         ( ( secure ) ? ";secure" : "" );
}

/* This function is used to get the cookie name and value, then returns the value portion of the match, 
*  passing it through the unescape() function to convert any escaped characters back to normal. 
*  (If it doesn't find the cookie, it returns a null value.) 
*/

function get_cookie ( cookie_name ) {
        var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
        if ( results )
            return ( unescape ( results[2] ) );
        else
            return null;
}


/* This fuction performs a check on the incoming cookie parameter value to the existing one 
* and changes it's value to the incoming one if it has got a different value to it
*/

function checkCookie(fName) {
        var fSrcOld=get_cookie('fcsource');
        var fSrcNew = fName;
        if (fSrcOld!=null && fSrcOld!="")
        {
           if(fSrcOld!=fSrcNew){
    set_cookie ( "fcsource", fSrcNew,'','/','',''); 
           } 
        }
}

/*** This function reads the Url string and gets any requested parameter values in the URL ***/

function urlParams( name ) {
       name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
       var regexS = "[\\?&]"+name+"=([^&#]*)";
       var regex = new RegExp( regexS );
       var results = regex.exec( window.location.href );
       if( results == null )
          return "";
        else
          return results[1];
}

/*** checks for Valid Channel ID's***/
function isValid(sName){

  if(sName=="300x600browse") return true;
  if(sName=="468x60browse") return true;
  if(sName=="adblade") return true;
  if(sName=="adon") return true;
  if(sName=="dell") return true;
  if(sName=="exciteexplore") return true;
  if(sName=="fbook") return true;
  if(sName=="findquick") return true;
  if(sName=="gadbanners") return true;
  if(sName=="gadwords") return true;
  if(sName=="gradlinks") return true;
  if(sName=="miva") return true;
  if(sName=="miva1") return true;
  if(sName=="mktgask") return true;
  if(sName=="mktglsmart") return true;
  if(sName=="mktgmiva3") return true;
  if(sName=="mktgmiva4") return true;
  if(sName=="mktgpulse") return true;
  if(sName=="mktgsfeed") return true;
  if(sName=="mktgyahoo") return true;
  if(sName=="msnad") return true;
  if(sName=="mstoolbar1") return true;
  if(sName=="myweb1") return true;
  if(sName=="myweb2") return true;
  if(sName=="nonus") return true;
  if(sName=="opensearch") return true;
  if(sName=="su") return true;
  if(sName=="toolbar") return true;
  if(sName=="vclick") return true;
  if(sName=="ysearch") return true;
}

var fSource = urlParams('fcsource').toLowerCase();

  if(fSource!=null && fSource.length>0 && isValid(fSource)){

  if (!get_cookie ("fcsource") ) {
     set_cookie ( "fcsource", fSource,'','/','',''); 
     google_channel_override = get_cookie("fcsource");
  } else {
     checkCookie(fSource);
     google_channel_override = get_cookie("fcsource");
    }
  } else {
       if(get_cookie("fcsource")!=null) {
          google_channel_override = get_cookie("fcsource");
       }
   }
   

/*** Additional Google Setup for AdServer ***/
GS_googleAddAdSenseService('ca-pub-2731187216061657');
GS_googleEnableAllServices();

/*
* This function is required and is used to display
* the ads that are returned from the JavaScript
* request. You should modify the document.write
* commands so that the HTML they write out fits
* with your desired ad layout.
*/

function google_ad_request_done(google_ads) {
  var s = '';
  var i;

  /* optional clickable backgrounds. If this is set,
  * the second and third lines of text ads are
  * linked to the advertiser's URL. This increases
  * click-through but decreases click-through
  * accuracy.
  */

  var clickable_background = 0;

  /*
  *Attribution for Google ads
  */

  var google_attribution = 'Sponsored Links';
  var title_span = '<span class="google_title_span">';
  var description_span = '<span class="google_description_span">';
  var url_style = 'class="google_url_style">';

  /*
  * Verify that there are actually ads to display.
  */

  if (google_ads.length == 0)
  return;

  /*
  * If an image or Flash ad is returned, display that ad.
  * If a rich media ad is returned, display that as "as is."
  * Otherwise, build a string containing all of the ads and
  * then use a document.write() command to print that string.
  */

  if (google_ads[0].type == "image") {
    s += '<a target="_blank" style="cursor: pointer; cursor: hand" href="'
    + google_ads[0].url + '" '
    + 'onclick="return fc_click(\'google_image\',\'ad\');" '
    + 'onmouseout="window.status=\'\'" '
    + 'onmouseover="window.status=\'go to '
    + google_ads[0].visible_url + '\';return true;'
    + '"> <img border="0" src="' + google_ads[0].image_url
    + '"width="' + google_ads[0].image_width
    + '"height="' + google_ads[0].image_height
    + '"></a>';
  } else if (google_ads[0].type == "flash") {
    s += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +
    'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"'+
    ' WIDTH="' + google_ad.image_width +
    '" HEIGHT="' + google_ad.image_height + '">' +
    '<PARAM NAME="movie" VALUE="' + google_ad.image_url + '">' +
    '<PARAM NAME="quality" VALUE="high">' +
    '<PARAM NAME="AllowScriptAccess" VALUE="never">' +
    '<EMBED src="' + google_ad.image_url +
    '" WIDTH="' + google_ad.image_width +
    '" HEIGHT="' + google_ad.image_height +
    '" TYPE="application/x-shockwave-flash"' +
    ' AllowScriptAccess="never" ' +
    ' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
  } else if (google_ads[0].type == "html") {
    s += google_ads[0].snippet;
  }

  /*attributes ad to Google*/

  if (google_ads[0].type == "image"){
  } else if (google_ads[0].type == "text") {
    s += '<div class="clearer"></div><div class="google_attribution">'+
    google_attribution +'</div><ul>';

    /*
    * Larger text for single ad.
    */

    if (google_ads.length == 1) {
      title_span = '<span style="text-decoration:none;font-size:20pt">';
      description_span = '<span style="color:#000000;font-size:16pt">';
      //url_style =' style="color:#008000;font-size:14pt;text-decoration:none">' ;
      url_style =' style="font-size:14pt;text-decoration:none">' ;
    }

    /*
    * For text ads, append each ad to the string.
    */
    for(i=0; i < google_ads.length; ++i) {
      s += '<li><a target="_blank" href="' + google_ads[i].url + '" ' +
      'onclick="return fc_click(\'google_' + site_google_adsize + '\',\'ad\');"' +
      'onmouseout="window.status=\'\'" ' +
      'onmouseover="window.status=\'go to ' +
      google_ads[i].visible_url + '\';return true;" ' +
      'style="text-decoration:none" >' +
      title_span +
      google_ads[i].line1 + '</span> ';
      if (clickable_background == 0){
        s += '</a><br/>';
      }
      s += '<a target="_blank" href="' + google_ads[i].url + '" ' +
      'onclick="return fc_click(\'google_' + site_google_adsize + '\',\'ad\');"' +
      'onmouseout="window.status=\'\'" ' +
      'onmouseover="window.status=\'go to ' +
      google_ads[i].visible_url + '\';return true;" ' +
      'style="text-decoration:none">' +
      description_span +
      google_ads[i].line2 + ' ' +
      google_ads[i].line3 + '<br/></span>';
      if (clickable_background == 1){
        s += '</a>';
      }
      s += '<a target="_blank" href="' + google_ads[i].url + '" ' +
      'onclick="return fc_click(\'google_' + site_google_adsize + '\',\'ad\');"' +
      'onmouseout="window.status=\'\'" ' +
      'onmouseover="window.status=\'go to ' +
      google_ads[i].visible_url + '\';return true;" ' +
      url_style +
      google_ads[i].visible_url + '</span></a></li>';
    }
  s+= '</ul>';
  }
  document.write(s);
  return;
}

function google_radlink_request_done(radlinks) {
  /*
  * This function is required and is used to display
  * the ads that are returned from the JavaScript
  * request. You should modify the document.write
  * commands so that the HTML they write out fits
  * with your desired Link Unit layout.
  */
  if (radlinks.length < 1)
     return;
  document.write("<div class=\"link_list\">\n<ul>\n");
  for(i=0; i < radlinks.length; ++i) {
     document.write("<li><a target=\"_top\" onclick=\"return fc_click('google_radlink','ad');\" href=\"/site-pages/related-search/related-link-results.shtml?google_kw=" + radlinks[i].url_escaped_term + "&google_rt=" + radlinks[i].radlink_token + "&google_page_url=" + window.location + "\">" + radlinks[i].term + "</a></li> \n");
  }
  document.write("</ul>\n</div>");
}


