function OpenWin(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function ClearInput(gugu) {
    gugu.value="";
}

// word count start
hiddentext ='';
hiddenlen =  hiddentext.length;
if(parseInt(navigator.appVersion.charAt(0)) >= 4) {
  isNS4 = (navigator.appName == 'Netscape') ? true : false;
  isIE4 = (navigator.appName.indexOf('Microsoft') != -1) ? true : false;
}
function Focus() {  message=1;  }         	   	   	   	   	
function Blur()  {  message=0;  }
function checkchinese(str) {
  var strlen=str.length;   	
  if(strlen>0){
    var oldstrlen=str.length
    for(var i=0;i<strlen;i++) {
      c='';  c = escape(str.charAt(i));	
      if( c.charAt(0) == '%') {	
        var cc=''; 
        cc = c.charAt(1); //IE~u,NS~A
        if(cc =='A' ||cc =='u'){ return true; }
      }
    }
  return false; } else { return false; }
}
function Key(form) { 
  if(message) {  
    var SendMsg = form.SendMsg.value;
    var SendMsglen=SendMsg.length;
    var isChinese=(checkchinese(SendMsg)||checkchinese(hiddentext));
    if(isChinese)  var max=300;  else  var max=500;
    var times = Math.ceil((SendMsglen + hiddenlen)/max);
    if(isIE4) {
      document.all.counter.innerText =  SendMsglen;
//      document.all.counter2.innerText = times;
//      document.all.counter3.innerText = times;  
}
    if(isNS4) {
      document.smform.counter.value = SendMsglen;
//      document.smform.counter2.value = times;
//      document.smform.counter3.value = times;  
}
  }

}   	   	   	
function Keychange() {   				   			   			
  var SendMsg=document.formobj.SendMsg.value;
  var SendMsglen=SendMsg.length;
  var isChinese=(checkchinese(SendMsg)||checkchinese(hiddentext));
  if(isChinese) var max=70;  else  var max=160;
  var times = Math.ceil((SendMsglen + hiddenlen)/max);
  if(isIE4) {
    document.all.counter.innerText =  SendMsglen;
//    document.all.counter2.innerText = times;
//    document.all.counter3.innerText = times;  
}
  if(isNS4) {
    document.smform.counter.value = SendMsglen;
//    document.smform.counter2.value = times;
//    document.smform.counter3.value = times;  
}

} 

// word count end

function replaceLink() 
{
	var flagLogin = document.getElementById('memberLogin');
        var loginlink = document.getElementById('UserHeader1_LogUrl');
	if(flagLogin != null)
	{
        	if(flagLogin.href == "http://member.yam.com/index.php?cid=MATCH&url=http%3A%2F%2Ffriends.yam.com%2Fpersonal%2Fmy_p.aspx")
        	{
           		loginlink.href = "http://member.yam.com/index.php?cid=MATCH&url=http%3A%2F%2Ffriends.yam.com%2Fpersonal%2Fmy_p.aspx";
        	}
        	else
        	{
           		loginlink.href = "http://member.yam.com/logout.jsp?url=http://friends.yam.com/&cid=MATCH";
        	}
        }
   
        var logoutlink = document.getElementById('LogUrl');
	if(logoutlink != null)
	{
        	logoutlink.href = "http://member.yam.com/logout.jsp?cid=MATCH&url=http%3A%2F%2Ffriends.yam.com";
	}
}
window.onload = function(){
	replaceLink();
}