// change greeting here
function greetingArr() {
this[0] = '<a href=http://match.sina.com/cgi-bin/sd.cgi><img src=http://home.sina.com/images/welcome_txt4.gif border=0 ALIGN=TOP ALIGN=MIDDLE></a><img src=http://images.sina.com/shared/images/sina_clear.gif width=10 border=0>';
this[1] = '<a href=http://match.sina.com/cgi-bin/sd.cgi><img src=http://home.sina.com/images/welcome_txt4.gif border=0 ALIGN=TOP ALIGN=MIDDLE></a><img src=http://images.sina.com/shared/images/sina_clear.gif width=10 border=0>';
this[2] = '<a href=http://match.sina.com/cgi-bin/sd.cgi><img src=http://home.sina.com/images/welcome_txt4.gif border=0 ALIGN=TOP ALIGN=MIDDLE></a><img src=http://images.sina.com/shared/images/sina_clear.gif width=10 border=0>';
this[3] = '<a href=http://match.sina.com/cgi-bin/sd.cgi><img src=http://home.sina.com/images/welcome_txt4.gif border=0 ALIGN=TOP ALIGN=MIDDLE></a><img src=http://images.sina.com/shared/images/sina_clear.gif width=10 border=0>';
this[4] = '<a href=http://match.sina.com/cgi-bin/sd.cgi><img src=http://home.sina.com/images/welcome_txt4.gif border=0 ALIGN=TOP ALIGN=MIDDLE></a><img src=http://images.sina.com/shared/images/sina_clear.gif width=10 border=0>';
this.length = 5;
}

var mRand = Math.random() + "";
var tmpRand = mRand.substring(2,mRand.length);
	
gArr = new greetingArr();
gInd = tmpRand % gArr.length;
var greetingMsg = gArr[gInd];
var hName = window.location.hostname;
var hNmArray = hName.split('.');
if (hNmArray[0] == 'game') {greetingMsg = gArr[1];}
// main
var sinalogin = GetCookie('sina-Login');
var st = (sinalogin == null) ? 'login' : 'logout';

var tdTxt = '<tr valign=center height=14>';
// show Welcome and NZ name if logged in
tdTxt += '<td class=ttd width=460 valign=top><div align=left><span class=MEMBERTEXT><img src=http://home.sina.com/images/sina_1x1.gif width=5 height=1>';
if (sinalogin != null) {
	tdTxt += 'Welcome, ' + sinalogin + '! ';
} else {
	tdTxt += 'Welcome!';
}
tdTxt += '<img src=http://images.sina.com/shared/images/sina_clear.gif border=0 width=20 height=1 ALIGN=MIDDLE>' + greetingMsg + '</span></div>';
tdTxt += '</td>';

// show member options, upgrading to VIP
tdTxt += '<td align=RIGHT valign=top nowrap><div align=right>';
if (sinalogin == null) {	
	tdTxt += '<a href=http://members.sina.com/><span class=MEMBERTEXT><img src=http://home.sina.com/images/member_tx.gif border=0 width=150 height=17 align=top></span></a>';
} else {
	if (checkPremium()) {
		tdTxt += '<a href=http://magcenter.sina.com/><span class=MEMBERTEXT><img src=http://home.sina.com/images/memUpgrade.gif border=0 width=111 height=15 align=top></span></a>';
	} else {
		tdTxt += '<span class=MEMBERTEXT>&nbsp;&nbsp;</span>';
	}
}
tdTxt += '</td>';

// login || logout | help
tdTxt += '<td width=130 class=ttd valign=top nowrap align=right>';
tdTxt += '<span class=MEMBERTEXT>| </span><a href=http://members.sina.com/'+st+'/><span class=MEMBERTEXT>' + st +'</span></a><span class=MEMBERTEXT> | </span>';
tdTxt += '<a href=http://home.sina.com/help/><span class=MEMBERTEXT>help?</span></a>';

// homepage icon
if (hNmArray[0] == 'home') {
	tdTxt += '<img src=http://home.sina.com/images/sina_1x1.gif width=5 height=1>';
	tdTxt += '</td>';
} else {
	tdTxt += '<span class=MEMBERTEXT> |</span>';
	tdTxt += '</td>';
	tdTxt += '<td width=90 valign=top><a href=http://home.sina.com/><img src=http://home.sina.com/images/returnHome.gif border=0></a></td>';
}

tdTxt += '</tr>';
// if fromNews, don't print
var fromNews;
if (fromNews == null) document.write(tdTxt);


