var baloon
var baloonTimer1;
var baloonTimer2;
var baloonID;

function showBaloon(e) {
		if (getCookie('HideHelp') != 1) {
		if (e == 1) {
			baloon = document.getElementById("baloon");
			baloonTimer1 = false;
			baloonTimer2 = true;
			window.clearTimeout(baloonID);
			baloonID = window.setTimeout("unhideBaloon()", 500);
		} else if (e == 2) {
				baloon.style.display='none';
		} else {
			baloonTimer1 = true;
			baloonTimer2 = false;
			window.clearTimeout(baloonID);
			baloonID = window.setTimeout("hideBaloon()", 800);
		}
	}
}
function hideBaloon() {
	if (baloonTimer1 == true) {
		baloon.style.display='none';
		doUrchin('/hide-baloon');
	}
}
function unhideBaloon() {
	if (baloonTimer2 == true) {
		baloon.style.display='block';
		doUrchin('/show-baloon');
	}
}

function doUrchin(n) {
	if (typeof(urchinTracker) == 'function') {
		urchinTracker(n);
	}
}

function hideHelp() {
	if (getCookie('HideHelp') != 1) {
		setCookie('HideHelp',1,90);
		baloon.style.display='none';
	} else {
		setCookie('HideHelp',0,-10);
		baloon = document.getElementById("baloon");
		baloon.style.display='block';
	}
}
function setCookie(name, value, expire) {
	var d = new Date();
	var e = new Date();
	e.setTime(d.getTime() + (60*60*24*expire*1000));
	document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : ("; expires=" + e.toGMTString()))
}
function getCookie(Name) {
          var search = Name + "="
          if (document.cookie.length > 0) { // if there are any cookies
                    offset = document.cookie.indexOf(search) 
                    if (offset != -1) { // if cookie exists 
                              offset += search.length 
                              // set index of beginning of value
                              end = document.cookie.indexOf(";", offset) 
                              // set index of end of cookie value
                              if (end == -1) 
                                        end = document.cookie.length
                              return unescape(document.cookie.substring(offset, end))
                    } 
          }
}



//for showUserMsg  vvv
var thename;
var theobj;
var startH=-80;
var openTimer;

function CustomUserMsgEmail() {
	showUserMsg(1);
}
function CustomUserMsgSMS() {
	showUserMsg(2);
}
function CustomUserMsgMsg() {
	showUserMsg(3);
}

function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

var CurrentMsg;
function showUserMsg(qw) {
	var blah;
	if (getCookie('NoMsg') != qw) {
		CurrentMsg = qw;
		thename = "userMsg";
		theobj=document.getElementById? document.getElementById(thename):document.all.thename;
		blah = theobj.innerHTML;
		theobj.innerHTML= blah + cum[qw];
		theobj.style.left=document.all&&!window.opera? ietruebody().clientWidth-parseInt(theobj.style.width)-20 : window.innerWidth-parseInt(theobj.style.width)-20 + "px";
		theobj.style.top=-80+"px";
		theobj.style.display='block';
		viewIt();
	}
}
function viewIt() {
	if(startH<=2) {
		theobj.style.top=startH+"px";
		startH+=1;
		openTimer=setTimeout("viewIt()",20);
	}else{
		clearTimeout(openTimer);
	}
}
function hideUserMsg() {
	var blah;
	thename = "userMsg";
	theobj=document.getElementById? document.getElementById(thename):document.all.thename;
	setCookie('NoMsg',CurrentMsg);
	unViewIt();
	doUrchin('/stop-user-msg');
}

function unViewIt() {
	if(startH>-60) {
		theobj.style.top=startH+"px";
		startH-=2;
		openTimer=setTimeout("unViewIt()",10);
	}else{
		clearTimeout(openTimer);
		theobj.style.display='none';
	}
}

function userMsgtoggle(e) {
		var ee;
		ee = document.getElementById(e);
		var s = ee.src.indexOf('message-tab-click');
		if (s>0) {
			ee.src='/pix/@.gif';
			} else {
			ee.src='/pix/message-tab-click.gif';
		}
}

//for showUserMsg  ^^^

function alertLogout() {
	if (confirm(loconfirm)) {
		doUrchin('/logout');
		window.location.href='/logout';
		return false;
		} else {
		return false;
  }
}
