﻿// JavaScript Document
var GlobalParameter_domain = "http://www.yinxiangjiaodian.com/";
var Validate_User_Url = GlobalParameter_domain + "Logon/Logon_Command.aspx";
var Cookie_User_Logon_Name = "Z_User_State";
var Cookie_User_Logon_Time = "Z_Logon_Time";
var User_User_Logon_State = "FALSE";
var User_Logon_Type_Url = "http://www.yinxiangjiaodian.com/UserInfo/Command/UserInfo.aspx?CC=Logon";


$(document).ready(function()
{	
	User_Logon_State();

});
	
	

	
function User_Logon_State() {

    User_User_Logon_State = $.cookie(Cookie_User_Logon_Name);


   if (User_User_Logon_State == null || User_User_Logon_State == "null") 
	{
		$("#login_state_ok").html("<a href='http://www.yinxiangjiaodian.com/Logon.htm' ><font color=#b90404><b>1.尚未登录</b></font></a>")
	} 
	else 
	{

        $("#hright").html("正在读取登陆状态,请稍等");
		
		
        $.ajax({

            url: User_Logon_Type_Url,
            type: 'GET',
            dataType: 'xml',
            timeout: 20000,
            error: function() 
			{
                $("#hright").html("检测用户登陆状态失败...请刷新页面重试.")

            },
            success: function(b) 
			{
				
                Temp_User_Logon_State = $(b).find('Uset_Logon_State').text();
						
                Temp_User_Type = $(b).find('User_Type').text();
                if (Temp_User_Logon_State == "true" || Temp_User_Logon_State == true) 
				{
             
				   $("#login_state_ok").html("1.登录成功");
					
				   $("#hright").html('[ <a href=http://www.yinxiangjiaodian.com>首页</a> <a target="_blank" href="http://www.yinxiangjiaodian.com/UserInfo/User_Center.aspx"><font color=red><b>我的帐户</b></font></a><a href="http://www.yinxiangjiaodian.com/ShoppingCart/MyCart_er.aspx"><b>购物车</b></a><a href="http://www.yinxiangjiaodian.com/UserInfo/Deposit.aspx">预存款</a><a href="http://www.yinxiangjiaodian.com/UserInfo/Command/UserInfo.aspx?CC=Logout">退出登录</a> ]')
                	if(_o[2]=="c")
					{
						Get_Stock();
					}
					else
					{
						$("#New_2_bottom_company").append("|not c");
					}
						
				} 
				else 
				{
                    $("#hright").html("[<a href=http://www.yinxiangjiaodian.com>首页</a> <a href='http://www.yinxiangjiaodian.com/Register/Register.htm' target='_blank'>注册</a><a href='http://www.yinxiangjiaodian.com/Logon.htm'  target='_blank'>登录</a><a href='http://www.yinxiangjiaodian.com/UserInfo/User_Center.aspx'  target='_blank'>我的帐户</a><a href='http://www.yinxiangjiaodian.com/ShoppingCart/MyCart_er.aspx'  target='_blank'>购物车</a> ]");
                    $.post("http://www.yinxiangjiaodian.com/UserInfo/Command/UserInfo.aspx", 
					{
						CC: "Logout"
					},
                    function(a) 
					{
                        alert("您的登陆有效时间已到,请重新登陆后继续购物.");
                        window.location.reload()
                    })
                }
            }
        })
    }
}
	
	
	
	
	
	
	
jQuery.fn.floatdiv=function(location){
		//判断浏览器版本
	var isIE6=false;
	var Sys = {};
    var ua = navigator.userAgent.toLowerCase();
    var s;
    (s = ua.match(/msie ([\d.]+)/)) ? Sys.ie = s[1] : 0;
	if(Sys.ie && Sys.ie=="6.0"){
		isIE6=true;
	}
	var windowWidth,windowHeight;//窗口的高和宽
	//取得窗口的高和宽
	if (self.innerHeight) {
		windowWidth=self.innerWidth;
		windowHeight=self.innerHeight;
	}else if (document.documentElement&&document.documentElement.clientHeight) {
		windowWidth=document.documentElement.clientWidth;
		windowHeight=document.documentElement.clientHeight;
	} else if (document.body) {
		windowWidth=document.body.clientWidth;
		windowHeight=document.body.clientHeight;
	}
	return this.each(function(){
		var loc;//层的绝对定位位置
		var wrap=$("<div></div>");
		var top=-1;
		loc=location;
		var str=loc.top;
		str=str.replace("px","");
		top=str;
		if(isIE6)
		{
			if (top>=0)
			{
				wrap=$("<div style=\"top:expression(documentElement.scrollTop+"+top+");\"></div>");
			}else{
				wrap=$("<div style=\"top:expression(documentElement.scrollTop+documentElement.clientHeight-this.offsetHeight);\"></div>");
			}
		}
		$("body").append(wrap);
		wrap.css(loc).css({position:"fixed",z_index:"999"});
		if (isIE6)
		{
			
			wrap.css("position","absolute");
			$("body").css("background-attachment","fixed").css("background-image","url(n1othing.txt)");
		}
		$(this).appendTo(wrap);
	});
};
	


jQuery.cookie = function(name, value, options) {

    if (typeof value != 'undefined') {

        options = options || {

};

        if (value === null) {

            value = '';

            options.expires = -1

        }
        var expires = '';

        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {

            var date;

            if (typeof options.expires == 'number') {

                date = new Date();

                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000))

            } else {

                date = options.expires

            }
            expires = '; expires=' + date.toUTCString()

        }
        var path = options.path ? '; path=' + (options.path) : '';

        var domain = options.domain ? '; domain=' + (options.domain) : '';

        var secure = options.secure ? '; secure': '';

        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('')

    } else {

        var cookieValue = null;

        if (document.cookie && document.cookie != '') {

            var cookies = document.cookie.split(';');

            for (var i = 0;

            i < cookies.length;

            i++) {

                var cookie = jQuery.trim(cookies[i]);

                if (cookie.substring(0, name.length + 1) == (name + '=')) {

                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));

                    break

                }

            }

        }
        return cookieValue

    }

};




	
	
	

