function writeHead(id){
  var result='<table width="970" cellpadding=0 cellspacing=0 border=0>';
  result=result+'  <tr height=40>';
  result=result+'  <td width=282 align=middle><a href="/ch/results.aspx"><img src="/images/logo001.jpg" border=0 alt="property"></a></td>';
  result=result+'  <td align=left width=458 valign=bottom><a href="http://www.property.co.nz/ch/help.aspx?q=8"><img src="/images/banner_ch.gif" border=0></a></td><td width=230 height=85 rowspan=2 align=middle><div id=agentDisplay><table width=230 cellpadding=0 cellspacing=0 border=0><tr height=85><td align=right style="padding-right:20px;"><img src="/ads/ad2.jpg" border=0></td></tr></table></div></td>';
  result=result+'  </tr><tr height=30 valign=top><td colspan=2 align=left style="padding-left:35px;"><a href="/"><img src="/images/logo002.jpg" border=0 alt="property"></a></td></tr>';
  result=result+'  <tr height=25 valign=bottom><td background="/images/head_bg.gif" width=970 align=middle colspan=3>';
  result=result+'    <table width="100%" cellpadding=0 cellspacing=0 border=0>';
  result=result+'     <tr height=25 valign=bottom>';
  result=result+'      <td width=15></td>';  
  result=result+'      <td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td><td width=120 style="padding-bottom:4px;" align=middle'+returnColor(id,4)+'><a href="/ch/results.aspx"><font color=#FFFFFF style="font-size:10pt;"><b>用文字搜索</b></font></a></td><td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td>';
  result=result+'      <td width=120 style="padding-bottom:4px;" align=middle'+returnColor(id,3)+'><a href="/ch/pmap.aspx"><font color=#FFFFFF style="font-size:10pt;"><b>从地图上搜索</b></font></a></td><td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td>';
  result=result+'      <td width=120 style="padding-bottom:4px;" align=middle'+returnColor(id,1)+'><a href="/ch/users/usermain_lm.aspx"><font color=#FFFFFF style="font-size:10pt;"><b>个人空间</b></font></a></td><td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td>';
  result=result+'      <td width=120 style="padding-bottom:4px;" align=middle'+returnColor(id,6)+'><a href="/ch/users/usermain_fav.aspx"><font color=#FFFFFF style="font-size:10pt;"><b>我的喜爱 '+getFavcount()+'</b></font></a></td><td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td>';
  if(id==0){
    result=result+'    <td width=120'+returnColor(id,0)+' style="padding-bottom:4px;" align=middle><font color=#FFFFFF style="font-size:10pt;"><b>物业详细</b></font></td><td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td>';
  }else if(id==2){
    result=result+'    <td width=120'+returnColor(id,2)+' style="padding-bottom:4px;" align=middle><font color=#FFFFFF style="font-size:10pt;"><b>注册</b></font></td><td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td>';
  }else if(id==7){
    result=result+'    <td width=120'+returnColor(id,7)+' style="padding-bottom:4px;" align=middle><font color=#FFFFFF style="font-size:10pt;"><b>登录</b></font></td><td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td>';
  }else if(id==8){
    result=result+'    <td width=120'+returnColor(id,8)+' style="padding-bottom:4px;" align=middle><font color=#FFFFFF style="font-size:10pt;"><b>帮助</b></font></td><td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td>';
  }else if(id==9){
    result=result+'    <td width=120'+returnColor(id,9)+' style="padding-bottom:4px;" align=middle><font color=#FFFFFF style="font-size:10pt;"><b>相关资源</b></font></td><td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td>';
  }else{
    result=result+'    <td width=120></td><td width=10 align=middle></td>';  	  
  }
  result=result+'      <td align=middle width=85></td>';
  result=result+'      <td width=240 align=middle>';
  if(id==4){
  result=result+'      <table width=240 cellpadding=0 cellspacing=0 border=0>';
  result=result+'       <tr valign=bottom><td align=middle style="padding-bottom:4px;"><font color=#FFFFFF><b>搜索</b></font></td><td width=2></td><td width=130 valign=middle style="padding-bottom:1px;"><input type=text style="width:130px;font-size:10px;italy;font-style:italic;" autocomplete="off" class=class001 onkeyup="keyPressAction()" onKeyPress="keyPressAction()" onKeyDown="if(event.keyCode==13){event.keyCode=9;goAction();}" id="w" name="w" value="楼盘代号或经纪人名" onClick="verifyKeyword(this)"></td><td width=30 align=middle style="padding-bottom:8px;"><a href=#><img src="/images/arrow.gif" border=0 onclick="goAction();"></a></td></tr><tr><td colspan=2></td><td class="class004"><div id="suggestion" class="rightsuggestiondiv"></div></td><td width=30></td></tr>';
  result=result+'      </table>';
  }
  result=result+'     </td>';
  result=result+'     </tr>';
  result=result+'    </table>';
  result=result+'   </td>';
  result=result+' </tr>';
  result=result+' <tr height=2><td colspan=3 bgcolor=#F86F05></td></tr>';  
  result=result+'</table>';
  
  document.write(result);
}

function writeHeadWithoutLogin(id){
  var result='<table width="970" cellpadding=0 cellspacing=0 border=0>';
  result=result+'  <tr height=40>';
  result=result+'  <td width=282 align=middle><a href="/ch/results.aspx"><img src="/images/logo001.jpg" border=0 alt="property"></a></td>';
  result=result+'  <td align=left width=458 valign=bottom><a href="http://www.property.co.nz/ch/help.aspx?q=8"><img src="/images/banner_ch.gif" border=0></a></td><td width=230 height=85 rowspan=2 align=middle><div id=agentDisplay><table width=230 cellpadding=0 cellspacing=0 border=0><tr height=85><td align=right style="padding-right:20px;"><img src="/ads/ad2.jpg" border=0></td></tr></table></div></td>';
  result=result+'  </tr><tr height=30 valign=top><td colspan=2 align=left style="padding-left:35px;"><a href="/"><img src="/images/logo002.jpg" border=0 alt="property"></a></td></tr>';
  result=result+'  <tr height=25 valign=bottom><td background="/images/head_bg.gif" width=970 align=middle colspan=3>';
  result=result+'    <table width="100%" cellpadding=0 cellspacing=0 border=0>';
  result=result+'     <tr height=25 valign=bottom>';
  result=result+'      <td width=15></td>';
  result=result+'      <td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td><td width=120 style="padding-bottom:4px;" align=middle'+returnColor(id,4)+'><a href="/ch/results.aspx"><font color=#FFFFFF style="font-size:10pt;"><b>用文字搜索</b></font></a></td><td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td>';
  result=result+'      <td width=120 style="padding-bottom:4px;" align=middle'+returnColor(id,3)+'><a href="/ch/pmap.aspx"><font color=#FFFFFF style="font-size:10pt;"><b>从地图上搜索</b></font></a></td><td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td>';
  if(id==11){
    result=result+'      <td width=120'+returnColor(id,11)+' style="padding-bottom:4px;" align=middle><a href="/ch/users/login.aspx"><font color=#FFFFFF style="font-size:10pt;"><b>注册</b></font></a></td><td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td>';
  }else if(id==7){
    result=result+'      <td width=120'+returnColor(id,7)+' style="padding-bottom:4px;" align=middle><a href="/ch/users/login.aspx"><font color=#FFFFFF style="font-size:10pt;"><b>登录</b></font></a></td><td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td>';
  }
  
  if(id==0){
    result=result+'    <td width=120'+returnColor(id,0)+' style="padding-bottom:4px;" align=middle><font color=#FFFFFF style="font-size:10pt;"><b>物业详细</b></font></td><td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td>';
  }else if(id==2){
    result=result+'    <td width=120'+returnColor(id,2)+' style="padding-bottom:4px;" align=middle><font color=#FFFFFF style="font-size:10pt;"><b>注册</b></font></td><td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td>';
  }else if(id==8){
    result=result+'    <td width=120'+returnColor(id,8)+' style="padding-bottom:4px;" align=middle><font color=#FFFFFF style="font-size:10pt;"><b>帮助</b></font></td><td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td>';
  }else if(id==9){
    result=result+'    <td width=120'+returnColor(id,9)+' style="padding-bottom:4px;" align=middle><font color=#FFFFFF style="font-size:10pt;"><b>相关资源</b></font></td><td width=5 align=middle style="padding-bottom:4px;"><font color=#ffffff>|</font></td>';
  }else{
    result=result+'    <td width=120></td><td width=10 align=middle></td>';  	  
  }
  if((id!=11)&&(id!=7)){
  	result=result+'    <td width=120></td><td width=10></td>';
  }
  result=result+'      <td align=middle width=85></td>';
  result=result+'      <td width=360 align=middle>';
  if(id==4){
  result=result+'      <table width=240 cellpadding=0 cellspacing=0 border=0>';
  result=result+'       <tr valign=bottom><td align=middle style="padding-bottom:4px;"><font color=#FFFFFF><b>搜索</b></font></td><td width=2></td><td width=130 valign=middle style="padding-bottom:1px;"><input type=text style="width:130px;font-size:10px;italy;font-style:italic;" autocomplete="off" class=class001 onkeyup="keyPressAction()" onKeyPress="keyPressAction()" onKeyDown="if(event.keyCode==13){event.keyCode=9;goAction();}" id="w" name="w" value="楼盘代号或经纪人名" onClick="verifyKeyword(this)"></td><td width=30 align=middle style="padding-bottom:8px;"><a href=#><img src="/images/arrow.gif" border=0 onclick="goAction();"></a></td></tr><tr><td colspan=2></td><td class="class004"><div id="suggestion" class="rightsuggestiondiv"></div></td><td width=30></td></tr>';
  result=result+'      </table>';
  }
  result=result+'     </td>';
  result=result+'     </tr>';
  result=result+'    </table>';
  result=result+'   </td>';
  result=result+' </tr>';
  result=result+' <tr height=2><td colspan=3 bgcolor=#F86F05></td></tr>';  
  result=result+'</table>';
  
  document.write(result);
}

function returnImage(a,b){
	var result="r_but_n_new.gif";
	
	if(a==b) result="r_but_o_new.gif";
	return result;
}

function returnColor(a,b){
	var result="";
	
	if(a==b) result=" class='class0071'";
	return result;
}

function returnChecked(a,b){
	var result="";
	
	if(a==b) result=" checked";
	return result;
}

function writeBottom(){
   var result='<table width="980" cellpadding=0 cellspacing=0 border=0>';
   result=result+'<tr height=30>';
   result=result+'<td width="300"></td><td align=right><font color=#888888><small>Copyright &copy; 2007 &nbsp;&nbsp;</small></font></td><td><img src="/images/blogo.jpg"></td><td align=left><font color=#888888> <small>Property Online Limited</small></font></td><td width="300"></td>';
   result=result+'</tr>';
   result=result+'<tr height=15><td colspan=5 style="padding-left:440px;"><font color=#888888><small>Disclaimer</small></font></td></tr>';
   result=result+'</table>';
   
   document.write(result);
}

function goUpload(){
   top.location='/users/usermain_ul.aspx';
}

function writeAccountRightNav(id){
   var returnstring='<table width="140" cellpadding=0 cellspacing=0 border=0>';
   returnstring=returnstring+'<tr height=32><td></td></tr>';
   returnstring=returnstring+'		          <tr height=30>';
   returnstring=returnstring+'		            <td><input type=radio'+returnChecked(1,id)+' onclick="top.location=\'/users/usermain_lm.aspx\'"><a href="/ch/users/usermain_lm.aspx"><font color="'+returnColor(1,id)+'"><b><u>Listing Online</u></b></font></a></td>';
   returnstring=returnstring+'		          </tr>';
   returnstring=returnstring+'		          <tr height=10><td></td></tr>';
   returnstring=returnstring+'		          <tr height=30>';
   returnstring=returnstring+'		            <td><input type=radio'+returnChecked(2,id)+' onclick="top.location=\'/users/usermain_lm.aspx\'"><a href="/ch/users/usermain_lh.aspx"><font color="'+returnColor(2,id)+'"><b><u>Listing History</u></b></font></a></td>';
   returnstring=returnstring+'		          </tr>';
   returnstring=returnstring+'		          <tr height=10><td></td></tr>';	
   returnstring=returnstring+'		          <tr height=30>';
   returnstring=returnstring+'		            <td><input type=radio'+returnChecked(3,id)+' onclick="top.location=\'/users/usermain_ul.aspx\'"><a href="/ch/users/usermain_ul.aspx"><font color="'+returnColor(3,id)+'"><b><u>Listing Upload</u></b></font></a></td>';
   returnstring=returnstring+'		          </tr>';
   returnstring=returnstring+'		          <tr height=10><td></td></tr>';
   returnstring=returnstring+'		          <tr height=30>';
   returnstring=returnstring+'		            <td><input type=radio'+returnChecked(4,id)+' onclick="top.location=\'/users/usermain.aspx\'"><a href="/ch/users/usermain.aspx"><font color="'+returnColor(4,id)+'"><b><u>Personal Detail</u></b></font></a></td>';
   returnstring=returnstring+'		          </tr>';		          
   returnstring=returnstring+'		          <tr height=10><td></td></tr>';
   returnstring=returnstring+'		          <tr height=30>';
   returnstring=returnstring+'		            <td><input type=radio'+returnChecked(5,id)+' onclick="top.location=\'/users/usermain_pass.aspx\'"><a href="/ch/users/useremail.aspx"><font color="'+returnColor(5,id)+'"><b><u>Email Notification</u></b></font></a></td>';
   returnstring=returnstring+'		          </tr>';		          
   returnstring=returnstring+'		          <tr height=10><td></td></tr>';
   returnstring=returnstring+'		          <tr height=30>';
   returnstring=returnstring+'		            <td><input type=radio'+returnChecked(6,id)+' onclick="top.location=\'/users/userlogout.aspx\'"><a href="/ch/users/userlogout.aspx"><font color="'+returnColor(6,id)+'"><b><u>Sign Out</u></b></font></a></td>';
   returnstring=returnstring+'		          </tr>';   
   returnstring=returnstring+'		        </table>';	
   

   document.write(returnstring);
}

function changeClassName(object,a,b,c){
	if(c==1){
	   if(parseInt(a)!=parseInt(b)) object.className="class0081";
	}else{
	   if(parseInt(a)!=parseInt(b)) object.className="";
    }
}