// JavaScript Document
// encoding utf8
/*
var sunjs = {};
(function($){
//sunjs.cookie start
$.cookie = {};
(function($){
	$.$get = function(){
   		var str = document.cookie;
   		if (str == "") return;
   		var arr = str.split(';');
   		for(var i=0; i < arr.length; i++){  // Break each pair into an array
    		cookies = arr[i].split('=');
			var name = cookies[0];
			var value = cookies[1];
   			$[name] = value;
   		} 
  	}
	$.$get();
	$.get= function(Name){
		var reg = "(?:; )?"+Name+"=([^;]*);?";
		var regExp = new RegExp(reg);
		if(regExp.test(document.cookie)){
			return unescape(RegExp["$1"]);
		}else{
			return null;
		}
	}
	$.unset = function(name){
		var date = new Date();
		date.setTime(date.getTime()-10000);
		var value = $.get(name);
		if(value!=null){
			$.set(name,value,date);
		}		
	}
	$.set = function(name,value){
		var argArr = this.set.arguments;
		var argCount = argArr.length;
		var expires = (argCount>2)?argArr[2]:null;
		var path = (argCount>3)?argArr[3]:null;
		var domain = (argCount>4)?argArr[4]:null;
		var secure = (argCount>5)?argArr[5]:false;
		var cookiestr =  name+"="+escape(value);
		cookiestr+=(expires==null)?"":";expires="+expires.toGMTString();
		cookiestr+=(path==null)?"":";path="+path;
		cookiestr+=(domain==null)?"":";domain="+domain;
		cookiestr+=(secure==false)?"":";secure="+secure;
		alert(cookiestr);
		document.cookie = cookiestr;
	}

})($.cookie)
//sunjs.cookie end
})(sunjs)

var uid = sunjs.cookie.get('USER_UID');
var username = decodeURI(sunjs.cookie.get('USER_USERNAME'));
var usertype = sunjs.cookie.get('USER_USERTYPE');
var statusstr='';
*/


function getCookie(key){
	var reg = "(?:; )?"+key+"=([^;]*);?";
	var regExp = new RegExp(reg);
	if(regExp.test(document.cookie)){
		return decodeURI(RegExp["$1"]);
	}else{
		return null;
	}
}

function checkLoginForm()
{
	var username = document.getElementById('username').value;
	var password = document.getElementById('password').value;
	if(username==''){
		alert('用户名不能为空');
		return false;
	}
	if(password==''){
		alert('密码不能为空');
		return false;
	}
}
var uid = getCookie('USER_UID');
var username = decodeURI(getCookie('USER_USERNAME'));
var usertype = getCookie('USER_USERTYPE');
var statusstr='';
if(uid!=null && uid>0)
{
	statusstr+='\
<div style="width:100%;height:25px;background:url(http://img.huagolf.com/common/images/bg_biao.gif) repeat-x top left;text-align:center;">\
    <div style="width:950px;margin:0 auto;">\
    	<div style="float:left;width:400px;">\
            <table cellpadding="0" cellspacing="0" width="100%" height="25" style="font-family:Arial, Helvetica, sans-serif;font-size:12px;" >\
            	<tbody>\
                	<tr>\
                    	<td width="209">欢迎您:<b>'+username+'</b> <a href="http://login.huagolf.com/logout.php"  style="color:#333333;">[注销]</a></td>\
                    <td>\
					</td>\
                  </tr>\
                </tbody>\
            </table>\
        </div>\
        <div style="float:right;width:400px;height:25px; line-height:25px; text-align:right; font-size:12px;">';
	if(usertype==21) 
	statusstr+='  <a href="http://login.huagolf.com/cooperator/supplier.php" target="_blank">供应商平台</a> | ';
	if(usertype==0||usertype==1||usertype==12||usertype==22) 
	statusstr+='  <a href="http://login.huagolf.com/cooperator/distributor.php" target="_blank">价格查询</a> | ';
	statusstr+='\
			<a href="http://login.huagolf.com/myinfo.php" target="_blank" style="color:#333333;"> 我的华高</a> | \
			<a href="http://blog.huagolf.com/'+encodeURI(username)+'" style="color:#333333;"> 高球博客</a> | \
			<a href="http://www.huagolf.com/client/club/huagolf_order_num.php" target="_blank">订单查询</a> | \
			<a href="javascript:void(0);">订购热线 400-6600-987</a>';

	statusstr+='\
        </div>\
    </div>\
</div>\
	';
	document.write(statusstr);
}else{
	statusstr+='\
<div style="width:100%;height:25px;background:url(http://img.huagolf.com/common/images/bg_biao.gif) repeat-x top left;text-align:center;">\
    <div style="width:950px;margin:0 auto;">\
    	<div style="float:left;width:500px;">\
		<form id="login"  style="margin:0; padding:0; text-align:left;" action="http://login.huagolf.com/login.php" method="post" onsubmit="return checkLoginForm();">\
            <table cellpadding="0" cellspacing="0" width="100%" height="25" style="font-family:Arial, Helvetica, sans-serif;font-size:12px;" >\
            	<tbody>\
                	<tr>\
                    	<td>用户名：&nbsp;<input type="text" name="username" id="username"  style="width:95px;font-size:12px;color:#999;background-color:#fff;border: 1px solid #ccc;" />&nbsp;&nbsp;密码：&nbsp;<input type="password" name="password" id="password"   style="width:95px;font-size:12px;color:#999;background-color:#fff;border: 1px solid #ccc;" /> <input type="image" src="http://img.huagolf.com/common/images/login02.gif" align="absmiddle" /> <a href="http://login.huagolf.com/reg.php">注册</a></td>\
                  </tr>\
                </tbody>\
            </table>\
			</form>\
        </div>\
        <div style="float:right;width:400px;height:25px; line-height:25px; text-align:right; font-size:12px;">\
			<a href="http://www.huagolf.com/client/club/huagolf_order_num.php" target="_blank">订单查询</a> | \
			<a href="http://bbs.huagolf.com" target="_blank">高人在此论坛</a> | \
			<a href="javascript:void(0);">订购热线 400-6600-987</a>\
        </div>\
    </div>\
</div>\
	';
	document.write(statusstr);
}