﻿//var newElement=document.createElement("script");
//newElement.setAttribute("type","text/javascript");
//newElement.setAttribute("src","jquery.pack.js");
//document.body.appendChild(newElement);

function checkImStatus(memberId)
{
　　var url = "/Tools/XHttp.aspx?t=im&f=check&mid="+memberId+"&date="+new Date();
    $.get(url, function(data)
    {
    
      if(data=="1")
　　  {
　　    $("#IMStatus").append("<a href=/Storefront-OnlineChat"+memberId+".aspx><img src=\"/images/storefront/icon_online.gif\" alt=\"点此与我在线洽谈\" /></a>");
　　  }
　　});
}

function getImInfo(memberId)
{
　　var url = "/Tools/XHttp.aspx?t=im&f=get&mid="+memberId+"&date="+new Date();
    $.get(url, function(data)
    {
        var objIM=eval('(' + data + ')');
　　　　for(var i=0;i<objIM.Name.length;i++)
　　　　{
　　　　    $("#IM_"+objIM.Name[i]).show();
　　　　    //$("#IM_"+objIM.Name[i]).hover(function() {
             //       $(this).css("border", "solid 1px #99cc00");
             //       }, function() {
             //       $(this).css("border", "solid 1px #cccccc");
             //   });
　　　　   
　　　　}
　　});
}

function showIMDetail(sn)
{
    $(".imlist table").hide();
    $("#IMDetail_"+sn).show();    
    for(i=1;i<5;i++)
    {
        if(i==sn)
        {
        $("#IM_"+i).css("border", "solid 1px #99cc00");
        }else
        {
        $("#IM_"+i).css("border", "solid 1px #cccccc");
        }
    }     
}

function closeChatDetail()
{	
    for(i=1;i<5;i++)
    {
        $("#IM_"+i).css("border", "solid 1px #cccccc");
        $("#IMDetail_"+i).hide();
    }    
}
		
function openWindow(target, width, height, style, wnd)
{
	if(!width) width=600;
	if(!height) height=400;
	if(!wnd) wnd="_blank";
	if(!style) style="toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes";
	wtop=5;
	wleft= (window.screen.availWidth - width) / 2;
	style +=",left="+wleft+",top="+wtop+",height="+height+",width="+width;
	window.open(target,wnd,style);	
}
