/**
 * Loads the "Set this page as homepage" window
 */
function setAsHomepage(obj, url) {
  if (navigator.userAgent.indexOf("MSIE")!=-1) { 
    obj.style.behavior='url(#default#homepage)';
    obj.setHomepage(url);
  }
  else
    alert('Sorry, this function will not work with non-IE browsers.\nTo make ' + url + ' your homepage just drag the URL from your URL box to your HOME icon.');
}

/**
 * Loads the "bookmark this page" window
 */
function bookmark(title,url)
{	 
  if (window.sidebar) { // Mozilla Firefox Bookmark
    window.sidebar.addPanel(title, url,"");
  } else if( window.external ) { // IE Favorite
    window.external.AddFavorite(url, title);
  }
}

/**
 * Email this page link generator
 */
function emailPage() {
  var mailSubject = "?subject=An interesting article at 777.com";
  var mailBody = "&body=Thought you should check out this great article at 777.com:%0D%0A" + document.URL;
  window.location.href="mailto:" + mailSubject + mailBody;
}

/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
var delayb4scroll=1;
var marqueespeed=1;
var pauseit=1;

var copyspeed=marqueespeed;
var pausespeed=(pauseit==0)? copyspeed: 0;
var actualheight='';

function scrollmarquee(){
  if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
    cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px";
  else
    cross_marquee.style.top=parseInt(marqueeheight)+8+"px";
}

function initializemarquee() {
  if (document.getElementById("marqueecontainer")) {
    cross_marquee=document.getElementById("vmarquee");
    cross_marquee.style.top=0;
    marqueeheight = document.getElementById("marqueecontainer").offsetHeight;
    actualheight=cross_marquee.offsetHeight;
    if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){
      cross_marquee.style.height=marqueeheight+"px";
      cross_marquee.style.overflow="scroll";
      return;
    }
    setTimeout('lefttime=setInterval("scrollmarquee()",70)', delayb4scroll);
  }
}

/***  Horizontal Marquee ***/
var actualwidth = '';
var marqueespeedH = 1;
var copyspeedH=marqueespeedH;
var int_id = 0;
var pause_int_id = 0;

function scrollmarqueeH(dir){
  switch (dir) {
    case 'left':
      if (parseInt(cross_marqueeH.style.left)>(actualwidth*(-1)+8))
        cross_marqueeH.style.left=parseInt(cross_marqueeH.style.left)-copyspeedH+"px";
      else
        cross_marqueeH.style.left=parseInt(marqueewidth)+8+"px";
      break;
    case 'right':
      if (parseInt(cross_marqueeH.style.left)>(actualwidth*(-1)+8))
        cross_marqueeH.style.left=parseInt(cross_marqueeH.style.left)+copyspeedH+"px";
      else
        cross_marqueeH.style.left=parseInt(marqueewidth)-8+"px";
      break;
    default:
      break;
  }
}

function scrollMarqueeTimerH(dir) {
  if (int_id > 0) {
    clearInterval(int_id);
  }
  setTimeout('int_id=setInterval("scrollmarqueeH(\''+dir+'\')",20)', delayb4scroll);
  clearInterval(pause_int_id);
  dir = 'left';
  setTimeout('pause_int_id=setInterval(\'scrollMarqueeTimerH("left")\',12000)', delayb4scroll);
  setTimeout('clearInterval(int_id)', 2000);
}

function initializemarqueeH() {
  if (document.getElementById("marqueecontainer")) {
    cross_marqueeH=document.getElementById("hmarquee");
    cross_marqueeH.style.left=0;
    marqueewidth = document.getElementById("marqueecontainer").offsetWidth;
    actualwidth=cross_marqueeH.offsetWidth;
    if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){
      cross_marqueeH.style.width=marqueewidth+"px";
      cross_marqueeH.style.overflow="auto";
      return;
    }
    dir = 'left';
    setTimeout('pause_int_id=setInterval(\'scrollMarqueeTimerH("left")\',12000)', delayb4scroll);
  }
}

/**
 * Adds tracking code given as parameter to the body
 */

var track_id_rand = -1;

function addTrackingCode(code, zone) {
//  if (track_id_rand < 0) {
//    track_id_rand = Math.round(100000*Math.random());
//  }
//  mytrack = '<img src="mtr.php?rand=' + track_id_rand + '&zone=' + zone + '" border=0 width=1 height=1 />';
  //mytrack = '';
  code = '<IMG border=0 hspace=0 vspace=0 width=1 height=1 src="' + code + '" />';
  document.body.innerHTML = document.body.innerHTML + code;
}