function login_action(formthis){
	formthis.action='http://login.myprice.com.cn/index.php?url='+escape(window.location.href);
}
function register_url(){
	location.href='http://login.myprice.com.cn/index.php?con_param=item&url='+escape(window.location.href);
	return false;
}
function exist_url(){
	location.href='http://login.myprice.com.cn/index.php?con_param=logout&url='+escape(window.location.href);
	return false;
}
function user_login_check_null(){
  if(document.cookie.length > 0)
  { 
	//alert(document.cookie);
	var cookieString = document.cookie;
	var cookieName='cookie_userid';
	start = cookieString.indexOf(cookieName+'=');
    if (start != -1)
    { 
	  start += cookieName.length + 1;
	  var end = cookieString.indexOf(';',start);
	  if (end == -1){
		  //alert(cookieString.substring(start));
		  return unescape(cookieString.substring(start));
	  }
	  else{
		  //alert(cookieString.substring(start,end));
		  return unescape(cookieString.substring(start,end));
	  }
    }
  }
  else{
  	return null;
  }
}
function set_login_header(){
	check_cookie_userid=user_login_check_null();
	if((check_cookie_userid==null) || (check_cookie_userid=='')){
		document.getElementById('login_header_str').innerHTML=document.getElementById('login_header_display').innerHTML;
	}
	else{
		yet_login_header='<table width="100%"  border="0" cellpadding="0" cellspacing="0" background="images/dlh2.gif">'+
            '<tr>'+
              '<td width="28"><img src="images/dlh1.gif" width="28" height="34"></td>'+
              '<td align="left" valign="middle" class="shadow12blue">☆ '+check_cookie_userid+'，欢迎登录！</td>'+
              '<td width="70" align="right" valign="middle" class="shadow12blue"><a href="http://login.myprice.com.cn/index.php?con_param=logout" class="b12" onClick="return exist_url()"><font color="#4B5E64">退出登录</font></a>&nbsp;&nbsp;</td>'+
              '<td width="70" align="right" valign="middle" class="shadow12blue"><a href="http://login.myprice.com.cn/index.php?con_param=login_succeed" class="b12"><font color="#4B5E64">我的通行证</font></a></td>'+
              '<td width="10"><img src="images/dlh3.gif" width="10" height="34"></td>'+
            '</tr>'+
        '</table>';
		document.getElementById('login_header_str').innerHTML=yet_login_header;
	}
}
function set_login_information(){
	check_cookie_userid=user_login_check_null();
	if((check_cookie_userid==null) || (check_cookie_userid=='')){
	//if((check_cookie_userid!=null) && (check_cookie_userid!='')){
		yet_login_str="<span class=\"gray\">&nbsp;欢迎来到二手频道！</span>";
	}
	else{
		yet_login_str="<table width=\"100%\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"65%\"><span class=\"gray\">&nbsp;<strong><span class=\"gray\">&nbsp;欢迎<font color=\"red\">"+check_cookie_userid+"</font>来到二手频道！</span>，您可以进行如下操作</strong></span></td><td width=\"35%\" align=\"right\"><a href=\"http://flea.myprice.com.cn/user_secondhand.php\" class=\"l12\">我的二手产品</a>&nbsp;&nbsp;</td></tr></table>";
	}
	document.getElementById('login_welcome_str').innerHTML=yet_login_str;
}

  function showLayers(i)
  {
	if(document.getElementById("layer" + i)==null)
        return;
    document.getElementById("layer" + i).style.visibility='visible';
    document.getElementById("a"+i).style.backgroundColor='#FFEBA5';
  }
  function hideLayers(i)
  {
    if(document.getElementById("layer" + i)==null)
        return;
    document.getElementById("layer" + i).style.visibility='hidden';
    document.getElementById("a" + i).style.backgroundColor='';
  }
  function navbarOver(src, clrOver)
  {
    if(!src.contains(event.fromElement))
    {
      //src.style.cursor = 'pointer';
      src.bgColor = clrOver;
    }
  }
  function navbarOut(src, clrIn)
  {
    if(!src.contains(event.toElement))
    {
      //src.style.cursor = 'default';
      src.bgColor = clrIn;
    }
  }
function fnChange(o_subcateid){
   if(o_subcateid.selectedIndex!=0){
	   if(o_subcateid.options[o_subcateid.selectedIndex].value=='')
			o_subcateid.selectedIndex = o_subcateid.selectedIndex + 1;
	}
}
function secondhand_url_page_transfer(sub_id,provinceid,page){
	if(page<=0){
		page=1;
	}
	location.href="http://flea.myprice.com.cn/index.php?sub_id="+sub_id+"&provinceid="+provinceid+"&page="+page+"";
	return false;
}
