
var edushianchor_obj=document.getElementsByTagName('span');
var edushiflags=edushirnd_str(6,true,false,false);
edushiflags+=GetRandomNum(100000,1000000);
for(var i=0;i<edushianchor_obj.length;i++)
{
    edushianchor_classid=escape(edushianchor_obj[i].getAttribute('classid'));
    if(edushianchor_classid=='edushianchor') {

            setTimeout('edushianchor_getdata(' + i + ')', 100);
    }
}

function edushi_AnchorData(AnchorData) {
    //edushi_AnchorData({Index:'0',OID:'133',CID:'29586',AnchorUrl:'http://hangzhou.edushi.com/?{$UnitID}',KeyWords:'杭州阿拉丁信息科技股份有限公司',CityCode:'hz'});
    if (AnchorData) {
        var _AnchorUrl = AnchorData.AnchorUrl;
        var imgUrl = 'http://dw.edushi.com/face/';
        if (AnchorData.CID > 0) {
            _AnchorUrl += '&CID=' + AnchorData.CID;
        }
        if (typeof EDUSHI_Anchor_ImgUrl!='undefined') {
            imgUrl = EDUSHI_Anchor_ImgUrl;
        }
        else {
            var edushianchor_imgtype = escape(edushianchor_obj[AnchorData.Index].getAttribute('imgtype'));
            if (edushianchor_imgtype !='null') {
                imgUrl += edushianchor_imgtype + '.gif';
            }
            else {
                imgUrl += '0.gif';
            }
        }
        edushianchor_type = escape(edushianchor_obj[AnchorData.Index].getAttribute('type'));
        if (edushianchor_type) {
            if (edushianchor_type.toLowerCase() == "pic") {
                edushianchor_PicStyle(imgUrl,AnchorData);
            }
            else if (edushianchor_type.toLowerCase() == "map") {
            edushianchor_MapStyle(imgUrl, AnchorData, _AnchorUrl);
            }
            else {
                edushianchor_NormalStyle(imgUrl, AnchorData, _AnchorUrl);
            }
        }
        else {
            edushianchor_NormalStyle(imgUrl, AnchorData, _AnchorUrl);
        }
    }
}
function edushianchor_NormalStyle(imgUrl, AnchorData, AnchorUrl) {

    var sInnerHTML = '<a href="' + AnchorUrl + '" target="_blank"><img src="' + imgUrl + '" border=0 onclick="edushianchor_c(\'' + AnchorData.KeyWords + '\',\''+AnchorUrl+'\',\''+AnchorData.CityCode+'\')"></a>';
    //edushianchor_show(0, '<a href="http://hangzhou.edushi.com/?133&cid=29586" target="_blank"><img src="http://dw.edushi.com/face/0.gif" border=0 onclick="edushianchor_c(\'%e6%9d%ad%e5%b7%9e%e9%98%bf%e6%8b%89%e4%b8%81%e4%bf%a1%e6%81%af%e7%a7%91%e6%8a%80%e8%82%a1%e4%bb%bd%e6%9c%89%e9%99%90%e5%85%ac%e5%8f%b8%2c+http%3a%2f%2fhangzhou.edushi.com%2f%3f133%2c+hz\')"></a>');
    edushianchor_show(AnchorData.Index, sInnerHTML);
}
function edushianchor_PicStyle(imgUrl, AnchorData, AnchorUrl) {
    var imgID = 'edushiAnchorImg_' + AnchorData.Index;
    var sInnerHTML = '<img src="' + imgUrl + '" border="0" style="cursor:hand;" onclick="edushianchor_PicStyleShow(\'' + AnchorData.Index + '\',\'' + AnchorData.CityCode + '\',\'' + AnchorData.KeyWords + '\');" id="' + imgID + '"></img>';
    edushianchor_show(AnchorData.Index, sInnerHTML);
}
function edushianchor_MapStyle(imgUrl, AnchorData, AnchorUrl) {

}
function edushianchor_PicStyleShow(Index,CityCode,KeyWords) {
    alert();
}
function edushianchor_getdata(index)
{
    edushianchor_city=escape(edushianchor_obj[index].getAttribute('city'));
    edushianchor_sitename=escape(edushianchor_obj[index].getAttribute('sitename'));
    edushianchor_address=escape(edushianchor_obj[index].getAttribute('address'));
    edushianchor_imgtype=escape(edushianchor_obj[index].getAttribute('imgtype'));
    edushianchor_type=escape(edushianchor_obj[index].getAttribute('type'));
    edushianchor_scriptobj=document.createElement('script');
    edushianchor_scriptobj.language='javascript';
    edushianchor_scriptobj.src='http://dw.edushi.com/dw.aspx?idIndex='+index+'&imgtype='+edushianchor_imgtype+'&type='+edushianchor_type+'&city='+edushianchor_city+'&sitename='+edushianchor_sitename+'&address='+edushianchor_address;
    document.body.appendChild(edushianchor_scriptobj);
 }

function edushianchor_show(index,inner) {
    if (index >= 0) {
        edushianchor_obj[index].innerHTML = inner;
        edushianchor_obj[index].style.display = '';
    }
    else {
        document.write(inner);
    }
}

function edushianchor_l(edushi_l,edushi_indexID)
{   if(edushi_indexID>=0)
    {   var edushi_siteName=escape(edushianchor_obj[edushi_indexID].getAttribute('sitename'));
        var edushi_address=escape(edushianchor_obj[edushi_indexID].getAttribute('address'));
        var url='http://dw.edushi.com/Default.aspx?edushi_l='+edushi_l+'&sitename='+edushi_siteName+'&address='+edushi_address+'&flags='+edushiflags+'&action=dw';
        setTimeout('edushianchor_exe(\''+url+'\')',1000);
     }
}

function edushianchor_c(keyword,anchor,city)
{   var edushi_Keyword=escape(keyword);
    var url='http://dwl.edushi.com/Default.aspx?&keyword='+edushi_Keyword+'&action=click';
    edushianchor_scriptc=document.createElement('script');
    edushianchor_scriptc.language='javascript';
    edushianchor_scriptc.src=url;
    document.body.appendChild(edushianchor_scriptc);
}

function edushianchor_exe(url)
{   edushianchor_scriptl=document.createElement('script');
    edushianchor_scriptl.language='javascript';
    edushianchor_scriptl.src=url;
    document.body.appendChild(edushianchor_scriptl);
}

//获得随机函数
function GetRandomNum(minNum,maxNum)
{return minNum+Math.round((Math.random()*(maxNum-minNum)));}

function edushirnd_str(str_0,str_1,str_2,str_3)
{   var Seed_array=new Array();
    var seedary;
    var i;
    Seed_array[0]=""
    Seed_array[1]="A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
    Seed_array[2]="a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z";
    Seed_array[3]="0,1,2,3,4,5,6,7,8,9";
    if(!str_1&&!str_2&&!str_3)
    {str_1=true;str_2=true;str_3=true;}
if(str_1){Seed_array[0]+=Seed_array[1];}
if(str_2){Seed_array[0]+=","+Seed_array[2];}
if(str_3){Seed_array[0]+=","+Seed_array[3];}
Seed_array[0]=Seed_array[0].split(",");seedary=""
for(i=0;i<str_0;i++)
{seedary+=Seed_array[0][Math.round(Math.random()*(Seed_array[0].length-1))]}
return(seedary);}
