/******************************************************
 * NOTE:not fully compatible with Firefox
 * AUTHOR:chenhonghong@gmail.com, M-TIME
 *****************************************************/
//define the context uri base env.js

if ( this!=top )top.location=this.location;

var images_url='http://image.marry5.com/www/home/images/head/';
var MY = CONTEXT_URI_MY;
var MESSAGE = CONTEXT_URI_MESSAGE;
var HOME = CONTEXT_URI_HOME;
var ARTICLE = CONTEXT_URI_ARTICLE;
var PSYCHO2 = CONTEXT_URI_PSYCHO2;
var SEARCH = CONTEXT_URI_SEARCH;
var BUY = CONTEXT_URI_BUY;
var PARTY = CONTEXT_URI_PARTY;
var LIFE = CONTEXT_URI_LIFE;
var BBS = CONTEXT_URI_BBS;
var ONLINE = CONTEXT_URI_ONLINE;
var SSO = CONTEXT_URI_SSO;
var STORY = CONTEXT_URI_STORY;

document.write('<style type="text/css">');
document.write('.ye14{');
document.write('color:#006699');
document.write('}');
document.write('.tdbg{');
document.write('background-image: url('+images_url+'0025_1.jpg);');
document.write('}');
document.write('#header #hea_logo {');
document.write('}');
document.write('#header #hea_logo #hea_logo_nav_left {');
document.write('float:left;margin-left:5px;margin-top:15px;');
document.write('}');

document.write('#header #hea_logo #hea_logo_nav {');
document.write('width: 510px;');
document.write('margin-left: 250px;');
document.write('height: 80px;');
document.write('margin-top: 10px;');
document.write('margin-bottom: 10px;');
document.write('font-family: "宋体";');
document.write('font-size: 12px;');
document.write('font-style: normal;');
document.write('font-weight: normal;');
document.write('color: #333333;');
document.write('text-decoration: none;');
document.write('}');
document.write('#header #hea_logo #hea_logo_nav a {');
document.write('font-family: "宋体";');
document.write('font-size: 12px;');
document.write('font-weight: normal;');
document.write('color: #333333;');
document.write('text-decoration: none;');
document.write('}');
document.write('#header #hea_logo #hea_logo_nav a:hover {');
document.write('font-family: "宋体";');
document.write('font-size: 12px;');
document.write('font-weight: normal;');
document.write('color: #333333;');
document.write('text-decoration: underline;');
document.write('}');


document.write('#header {');
document.write('height: 158px;');
document.write('width: 775px;');
document.write('margin-right: auto;');
document.write('margin-left: auto;');
document.write('background-color: #FFFFFF;');
document.write('}');
document.write('#header #hea_nav {');
document.write('background-image: url('+images_url+'0002.jpg);');
document.write('width: 755px;');
document.write('margin-right: 10px;');
document.write('margin-left: 10px;');
document.write('height: 31px;');
document.write('background-repeat: no-repeat;');
document.write('}');
document.write('#header #hea_nav #top_menu {');
document.write('font-family: "宋体";');
document.write('font-size: 14px;');
document.write('font-weight: bold;');
document.write('color: #FFFFFF;');
document.write('text-decoration: none;');
document.write('}');
document.write('#header #hea_nav #top_menu a {');
document.write('font-family: "宋体";');
document.write('font-size: 14px;');
document.write('font-weight: bold;');
document.write('color: #FFFFFF;');
document.write('text-decoration: none;');
document.write('}');
document.write('#header #hea_nav #top_menu a:hover {');
document.write('font-family: "宋体";');
document.write('font-size: 14px;');
document.write('font-weight: bold;');
document.write('color: #FFFFFF;');
document.write('text-decoration: underline;');
document.write('}');


document.write('#header #hea_nav2 {');
document.write('height: 27px;');
document.write('display: none;');
document.write('margin-right: 10px;');
document.write('margin-left: 10px;');
document.write('padding-top:3px;');
document.write('background-image: url('+images_url+'0018.gif);');
document.write('background-repeat: no-repeat;');
document.write('padding-right: 50px;');
document.write('text-align: right;');
document.write('}');


document.write('#header #hea_nav #nav li {');
document.write('float: left;');
document.write('display: block;');
document.write('font-family: "宋体";');
document.write('font-size: 14px;');
document.write('font-weight: bold;');
document.write('color: #FFFFFF;');
document.write('text-decoration: none;');
document.write('z-index: auto;');
document.write('padding-top: 8px;');
document.write('margin-left: 2px;');
document.write('}');
document.write('#header #hea_nav2 a {');
document.write('font-family: "宋体";');
document.write('font-size: 12px;');
document.write('font-weight: normal;');
document.write('color: #000000;');
document.write('text-decoration: none;');
document.write('}');
document.write('#header #hea_nav2 a:hover {');
document.write('font-family: "宋体";');
document.write('font-size: 12px;');
document.write('font-style: normal;');
document.write('font-weight: normal;');
document.write('color: #990000;');
document.write('text-decoration: none;');
document.write('}');

document.write('#header #hea_nav #nav li a {');
document.write('font-family: "宋体";');
document.write('font-size: 14px;');
document.write('font-weight: bold;');
document.write('color: #FFFFFF;');
document.write('text-decoration: none;');
document.write('text-align: center;');
document.write('display: block;');
document.write('height: 23px;');
document.write('width: 88px;');
document.write('}');
document.write('#header #hea_nav #nav li a:hover {');
document.write('font-family: "宋体";');
document.write('font-size: 14px;');
document.write('font-weight: bold;');
document.write('color: #FFFFFF;');
document.write('text-decoration: underline;');
document.write('}');

document.write('#header #hea_nav #nav li a#current {');
document.write('font-family: "宋体";');
document.write('font-size: 14px;');
document.write('font-weight: bold;');
document.write('color: #0066CC;');
document.write('text-decoration: none;');
document.write('}');
document.write('#header #hea_nav_test {');

document.write('background-image: url('+images_url+'0026.jpg);');
document.write('background-repeat: no-repeat;');
document.write('width: 755px;');
document.write('margin-right: 10px;');
document.write('margin-left: 10px;');
document.write('height: 20px;');
document.write('}');

document.write('.fo12 {');
document.write('font-family: "宋体";');
document.write('font-size: 12px;');
document.write('color: #333333;');
document.write('text-decoration: none;');
document.write('}');

document.write('#header #hea_nav3 {');
document.write('height: 22px;');
document.write('margin-right: 10px;');
document.write('margin-left: 10px;');
document.write('background-repeat: no-repeat;');
document.write('text-align: left;');
document.write('padding-top: 8px;');
document.write('padding-left: 5px;');
document.write('}');
document.write('#header #hea_nav3 a {');
document.write('font-family: "宋体";');
document.write('font-size: 12px;');
document.write('font-weight: normal;');
document.write('color: #000000;');
document.write('text-decoration: none;');
document.write('}');
document.write('#header #hea_nav3 a:hover {');
document.write('font-family: "宋体";');
document.write('font-size: 12px;');
document.write('font-style: normal;');
document.write('font-weight: normal;');
document.write('color: #990000;');
document.write('text-decoration: underline;');
document.write('}');


document.write('</style>');


document.write('<div id="header">');
document.write('<div id="hea_logo">');
document.write('<div id="hea_logo_nav_left"><a href="'+HOME+'"><img src="'+images_url+'logo.gif" alt="返回嫁我网首页" border="0"/></a></div>');
document.write('<div id="hea_logo_nav">');
document.write('<table width="500" border="0" cellspacing="0" cellpadding="0">');
document.write('<tr>');
document.write('<td align="left">');
document.write('<table width="500" border="0" cellspacing="0" cellpadding="0">');
document.write('<tr>');
document.write('<td align="center" height="20">');
//document.write('<a href="javascript:openAdviceWin()">意见反馈</a> | ');
//document.write('<a href="javascript:head_addBookmark()">加入收藏</a> | ');
//document.write('<a href="http://public.marry5.com/home/helpcenter/promotion.htm">推荐给好友</a> | ');
//document.write('<a href="'+ STORY +'">成功故事</a> | ');
//document.write('<a href="http://public.marry5.com/home/help/help_index.htm">帮助中心</a>'); 
document.write('</td>');
document.write("<td align='right'><div id='logPanel'></div></td>");
document.write('</tr>');
document.write('</table>');
document.write('</td>');
document.write('<tr>');
document.write('<td height="60" align="right"><div id="hea_logo_nav_ad"></div></td>');
document.write('</tr>');
document.write('</table>');
document.write('</div>');
document.write('</div>');
document.write('<div id="hea_nav">');
document.write('<div style="float:left"><table width="100%" border="0" cellspacing="0" cellpadding="0">');
document.write('<tr>');
document.write('<td height="3"></td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td valign="top"><table width="755" border="0" cellspacing="0" cellpadding="0" id="top_menu">');
document.write('<tr>');
document.write('<td width="10" height="28">&nbsp;</td>');
document.write('<td width="50" id="td_home"><a href="'+HOME+'"><div id="nav_home" align="center">首页</div></a></td>');
document.write('<td width="2"><div id="img_home"><img src="'+images_url+'0020.gif" width="2" height="14" /></div></td>');
document.write('<td width="78" id="td_my"><a href="'+MY+'/manage.m5"><div id="nav_my" align="center">我的主页</div></a></td>');
document.write('<td width="2" id="img_my"><img src="'+images_url+'0020.gif" width="2" height="14"/></td>');
document.write('<td width="78" id="td_psycho"><a href="'+PSYCHO2+'"><div id="nav_psycho" align="center">真爱推荐</div></a></td>');
document.write('<td width="2" id="img_psycho"><img src="'+images_url+'0020.gif" width="2" height="14" /></td>');
document.write('<td width="78" id="td_search"><a href="'+SEARCH+'"><div id="nav_search" align="center">搜索会员</div></a></td>');
document.write('<td width="2" id="img_search"><img src="'+images_url+'0020.gif" width="2" height="14" /></td>');
document.write('<td width="78" id="td_online"><a href="'+ONLINE+'"><div id="nav_online" align="center">在线聊天</div></a></td>');
document.write('<td width="2" id="img_online"><img src="'+images_url+'0020.gif" width="2" height="14" /></td>');
document.write('<td width="78" id="td_article"><a href="'+ARTICLE+'"><div id="nav_article" align="center">心情日记</div></a></td>');
document.write('<td width="2" id="img_article"><img src="'+images_url+'0020.gif" width="2" height="14" /></td>');
document.write('<td width="78" id="td_party"><a href="'+PARTY+'"><div id="nav_party" align="center">交友活动</div></a></td>');

document.write('<td width="2" id="img_party"><img src="'+images_url+'0020.gif" width="2" height="14" /></td>');
document.write('<td width="78" id="td_story"><a href="'+STORY+'"><div id="nav_story" align="center">成功故事</div></a></td>');

document.write('<td width="2" id="img_story"><img src="'+images_url+'0020.gif" width="2" height="14" /></td>');
//document.write('<td width="41" id="td_life"><a href="'+LIFE+'"><div id="nav_life" align="center">杂志</div></a></td>');
document.write('<td width="78" ><a href="http://alibaba.marry5.com" target="_blank"><div  align="center"><font color="yellow">白领购物</font></div></a></td>');
document.write('<td width="2" id="img_life"><img src="'+images_url+'0020.gif" width="2" height="14" /></td>');
document.write('<td width="40" id="td_bbs"><a href="'+BBS+'"><div id="id_bbs" align="center">社区</div></a></td>');
document.write('<td width="10">&nbsp;</td>');
document.write('</tr>');
document.write('</table></td>');
document.write('</tr>');
document.write('</table></div>');
document.write('</div>');
document.write('<div id="hea_nav2">');
document.write('</div>');
document.write('<div class="fo12" id="hea_nav3">');
document.write('您现在的位置：<a href="'+HOME+'">首页</a> <span id="channelTitle"></span> <span id="pageTitle"></span>');
document.write('</div>');
document.write('</div>');


//retrieve the member name from cookie
var member_name = retrieveCookie('member_name');
var userName = null;
try{
userName = convertCookie(member_name);
}catch(e){
userName = null;
}

var LOGGED = "Hi 您好！"+userName+" | <a href='"+BUY+"'>支付中心</a> | <span id='entrance'>快速入口</span> | <a href='"+SSO+"/signOut.m5'>退出</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href='http://public.marry5.com/home/help/help_index.htm'>帮助</a> | <a href='javascript:head_addBookmark()'>收藏</a>";
var UNLOGGED = "<a href='javascript:logon();'>登录</a> | <a href='"+SSO+"/register.m5'>注册</a> | <a href='"+SSO+"/getPassword.m5'>忘记密码</a> | <a href='http://public.marry5.com/home/help/help_index.htm' target='_blank'>帮助</a> | <a href='javascript:head_addBookmark()'>收藏</a>";

var isGuide = userName==null;

//display the welcome content accordings to login status
var lp = document.getElementById("logPanel");

if(isGuide){
lp.innerHTML = UNLOGGED;
}else{
lp.innerHTML = LOGGED;
}


/**
 * retrieve a cookie by its name.
 */
function retrieveCookie(c_name) {
if (document.cookie.length > 0)
{
c_start = document.cookie.indexOf(c_name + "=")
if (c_start != -1)
{
c_start = c_start + c_name.length + 1
c_end = document.cookie.indexOf(";", c_start)
if (c_end == -1) c_end = document.cookie.length
return unescape(document.cookie.substring(c_start, c_end))
}
}
return null
}

/**
 * convert the decoded string to Chinese character.
 */
function convertCookie(str) {
var strArr;
var strRtn = "";
if (str == null) return null;
strArr = str.split(",");

for (var i = 0; i <= strArr.length - 1; i++) {
strRtn += String.fromCharCode(eval(strArr[i]));
}

return strRtn;
}

/**
 * guide to login page, and return to this page after logged.
 */
function logon(){
var url = document.URL;
 if(url.indexOf("?") > 0){
   url += "&login=true";
  }else{
    url+= "?login=true";
  }
var sso = SSO + "/Login";
sso += "?entrance=";
sso += encodeURIComponent(url);
window.location = sso;
}

/**
 * ============================================================================
 * display the page location
 * Auto highlight the channel title and display the location according to the 
 * current location.
 * ============================================================================
 */
var u = document.URL;
var disabledChannelTitle = false;

var pt = "";
try{
pt = page_title;
}catch(e){};
try{
disabledChannelTitle = hide_channel_title;
}catch(e){};

if(pt != ""){
var _pageTitle = document.getElementById("pageTitle");
_pageTitle.innerHTML = " &gt;&gt; <b>"+pt+"</b>";
}

/**
 * prepare the second nav
 */
var SECOND_MY = new Array(
new Array("资料管理","editProfile.m5"),
new Array("我的相册","albumItemListManage.m5"),
new Array("我的好友","listFriends.m5"),
new Array("我的关注","favoriteOtherManage.m5"),
new Array("鸿雁传书",MESSAGE + "/receiveds.m5")
);
var SECOND_PARTY = new Array(
new Array("最新活动", PARTY + "/news.m5"),
new Array("活动回顾", PARTY + "/reviews.m5"),
new Array("我的活动", PARTY + "/mySigneds.m5")
);

/**
 * render the second nav if specified
 */
function renderSecond(navArray){
try{
var second = document.getElementById("hea_nav2");
var html = "";
for(var i = 0; i < navArray.length; i ++){
html += '<img src="'+images_url+'dian5.gif" />&nbsp;' + '<a href="'+navArray[i][1]+'">'+navArray[i][0]+'</a> &nbsp;' ;
}
second.innerHTML = html;
second.style.display = "block";
}catch(e){return;};
}

function renderChannelTitle(_url,_title){
if(disabledChannelTitle == true){
return;
}
var channelTitle = document.getElementById("channelTitle");
channelTitle.innerHTML = "&gt;&gt; <a href='"+_url+"'>"+_title+"</a>";
}

function highLightChannel(channel){
var nav = document.getElementById("nav_"+channel);
var td_nav=document.getElementById("td_"+channel);
nav.className = "ye14";
td_nav.className="tdbg";
}

if(u.indexOf(MY) > -1 && u.indexOf("viewMember") < 0){
document.getElementById("img_home").innerHTML="";
document.getElementById("img_my").innerHTML="";

highLightChannel("my");
renderChannelTitle(MY,"我的主页");
}
else if(u.indexOf(ONLINE) > -1){
document.getElementById("img_search").innerHTML="";
document.getElementById("img_online").innerHTML="";

highLightChannel("online");
renderChannelTitle(ONLINE,"在线聊天");
}
else if(u.indexOf(ARTICLE) > -1){
document.getElementById("img_online").innerHTML="";
document.getElementById("img_article").innerHTML="";

highLightChannel("article");
renderChannelTitle(ARTICLE,"心情日记");
}
else if(u.indexOf(PSYCHO2) > -1){
document.getElementById("img_my").innerHTML="";
document.getElementById("img_psycho").innerHTML="";

highLightChannel("psycho");
renderChannelTitle(PSYCHO2,"真爱推荐");
}
else if(u.indexOf(SEARCH) > -1){
document.getElementById("img_psycho").innerHTML="";
document.getElementById("img_search").innerHTML="";

highLightChannel("search");
renderChannelTitle(SEARCH,"搜索会员");
}
else if(u.indexOf(PARTY) > -1){
document.getElementById("img_article").innerHTML="";
document.getElementById("img_party").innerHTML="";

highLightChannel("party");
renderChannelTitle(PARTY,"交友活动");
}
else if(u.indexOf(STORY) > -1){
document.getElementById("img_party").innerHTML="";
document.getElementById("img_story").innerHTML="";

highLightChannel("story");
renderChannelTitle(STORY,"成功故事");
}
else if(u.indexOf(LIFE) > -1){
document.getElementById("img_party").innerHTML="";
document.getElementById("img_life").innerHTML="";

highLightChannel("life");
renderChannelTitle(LIFE,"恋爱杂志");
}
else if(u.indexOf(BBS) > -1){
document.getElementById("img_life").innerHTML="";

highLightChannel("bbs");
renderChannelTitle(BBS,"缘分社区");
}
else if(u.indexOf(MESSAGE) > -1){
renderChannelTitle(MESSAGE + "/receiveds.m5","鸿雁传书");
}
else if(u.indexOf(BUY) > -1){
renderChannelTitle(BUY,"支付中心");
}
/*
else if(u.indexOf(HOME) > -1){
var nav = document.getElementById("nav_home");
nav.className = "ye14";
document.getElementById("img_home").innerHTML="";
}
*/


var advise_link = 'http://www.marry5.com/my/advicePage.m5?entry='+window.location
function openAdviceWin(){
var url=advise_link+window.location; 
window.open(url,'advice','width=600px,height=400px,status=no,scrollbars =no,directories=no,resizable=no,status=yes,toolbar=false,left=200,top=150');
}

function head_addBookmark() {
var title='嫁我网-构筑和谐婚姻';
var url='http://www.marry5.com/'
if (window.sidebar) {
//for ie
 window.sidebar.addPanel(title, url,""); 
} else if( document.all ) {
//ofr fire fox
window.external.AddFavorite( url, title);
} else if( window.opera && window.print ) {
return true;
}
}

//console ad 
if(u.indexOf(BUY) > -1){
hea_logo_nav_ad.style.visibility="hidden";
}
if(u.indexOf(PSYCHO2) > -1){
	if((u.indexOf("recommendGuide.m5") > -1)||(u.indexOf("priceList.m5") > -1))
	hea_logo_nav_ad.style.visibility="hidden";
}if (u.indexOf("/sso/signOn.m5") > -1)
{
	hea_logo_nav_ad.style.visibility="hidden";
}if ((u.indexOf("/sso/register.m5") > -1)||(u.indexOf("/my/phase1.m5") > -1)||(u.indexOf("/my/phase2.m5") > -1)||(u.indexOf("/my/phase3.m5") > -1))
{
	hea_logo_nav_ad.style.visibility="hidden";
}

// pageTop ad
alimama_pid="mm_11467074_1296923_2796980"; 
alimama_titlecolor="0000FF"; 
alimama_descolor ="000000"; 
alimama_bgcolor="FFFFFF"; 
alimama_bordercolor="E6E6E6"; 
alimama_linkcolor="008000"; 
alimama_bottomcolor="FFFFFF"; 
alimama_anglesize="0"; 
alimama_bgpic="0"; 
alimama_icon="0"; 
alimama_sizecode="12"; 
alimama_width=468; 
alimama_height=60; 
alimama_type=2; 
alimama_containerid="hea_logo_nav_ad";
document.writeln('<script src="http://a.alimama.cn/inf.js" type=text/javascript></script>');


// ad pv js
document.writeln('<script src="http://public1.marry5.com/js/load.js" type=text/javascript></script>');