
function getFlashMovieObject( movieName){
  if ( window.document[movieName]){
      return window.document[movieName];
  }
  if ( navigator.appName.indexOf( "Microsoft Internet")==-1){
  	if ( document.embeds && document.embeds[ movieName]){
    	return document.embeds[ movieName]; 
    }
  } else {
   	return document.getElementById( movieName);
  }
}

function newwindow(url) {
  window.open(url,"_blank");
}  

//window.onload= function(){setTimeout(popup, 2000, "http://www.yahoo.com")};
function popup(url, fullWin){
  doPopup(url, fullWin, false)
}

function loginPopup(url, fullWin) {
  doPopup(url, fullWin, true)
}

function getDocumentHash() {
  var hash = document.location.hash;
  var search = document.location.search;
  if (hash=="") return search;
  if (search=="") return hash;
  return search+"&"+hash.substr(1);
}

function doPopup(url, fullWin, isLogin) {
  url = unescape(url);
  //alert("url: " + url);
  
  setTimeout( function() {
    var w;
    if(fullWin){
    	w = window.open(url, "_blank");
    }
    else{
	  	w = window.open(url, "_blank", "location=1,scrollbars=1,status=1,width=750,height=600");
	}

    if(!w){
    	var flash =  getFlashMovieObject(myName);
   		if(isLogin){
   			flash.onLoginPopupBlocked();
   	 	}
   	 	else{
   	 		flash.onPopupBlocked(url);
   	 	}
    }
    
 }, 0);
 
}

function getBrowser(){
	return window.navigator.userAgent
}


// called externally
function updateFlash(account, username, cookies, l, wssid, abwssid, intl, lang, lgs, showArchivingConsentRoadblock, xml) {
  loginCookies = cookies;
  lf = l;
  var movie = getFlashMovieObject(myName);
  movie.userSignedIn(account, username, cookies, wssid, abwssid, intl, lang, lgs, showArchivingConsentRoadblock, xml);
  focusMe();
}

var noWarning = true;
var scrollTimer = 0;

var alertMsg = "You will not be able to send and receive instant messages anymore";
function setAlertMsg(s){
  alertMsg = s
}

window.onbeforeunload = function(e) {
	if (!e) e = event;
	if (noWarning) return;
	e.returnValue = alertMsg;
}

var plugin;
var safari_growl_plugin_enabled = false;

function advancedNotify(yid, msg) {
	if(!safari_growl_plugin_enabled) return;
	
	msg = unescape(msg);

	if(!plugin) {
            plugin = document.embeds["SafariWebIM"];
    }
    plugin.sendGrowlNotification(yid, msg);
}

function startNotify(msg) {

	msg = unescape(msg);
	var windowSize = 100;
	var offset = -1;
	var msg = msg +" - ";
	stopNotify();
	// setInterval causes delayed event to be queued-up
	// which makes the marquee very jumpy at times.
	var f = function() {
		offset = (offset+1)%msg.length;
		var txt = msg.substr(offset, windowSize);
		while (txt.length<windowSize) {
			txt += msg.substr(0, windowSize-txt.length);
		}
		document.title = txt;
		scrollTimer = setTimeout(f, 100);
	};
	scrollTimer = setTimeout( f, 100);
}

function stopNotify() {
	if (scrollTimer) {
		clearTimeout(scrollTimer)
		scrollTimer=0;
		document.title=myTitle;
	}
}

var myTitle = document.title;
function intlTitle(t){
  myTitle = t;
  document.title = t;
}

/* --disabled. improper i18n and mac support.--
var savedFontSize=0;
function fontWatch() {
  var canari = document.getElementById("canari");
  if (!canari) return;
  var height = canari.offsetHeight;
  if (height != savedFontSize) {
    try {
      var movie = getFlashMovieObject(myName);
      movie.defaultFontSizeChanged(height*10/19); // normalize somewhat
      savedFontSize = height;
    } catch (e) {
      // oh nooz. too soon.
    }
  }
}
document.writeln("<span id=canari>This_is_some_text</span>");
setInterval(fontWatch, 100);
*/

