﻿//这个js文件的作用是将网站的<a>标签的target属性统一设置为在本窗口打开
//目前(2009/09/07)只在项目中的4个地放引用有这个js文件
//UICommon/UserControl/Generic/Common/CommonPageBottomCtrl.ascx
//Search/UICommon/UserControl/Generic/Common/CommonPageBottomCtrl.ascx
//BuyerOffice/UICommon/CommonPageBottomCtrl.ascs
//UICommon/NewHeadFood/Foot.ascs
//以上4个地方有引用，如果在实际用的过程中，发现这个js方法写的不完善
//只需要改这个js文件即可，无须在项目中任何文件作其他改动
//add by Bob on 2009/09/07

var alist=document.getElementsByTagName('a');
for(var i=0;i<alist.length;i++)
{  
    if(alist[i].href.toLowerCase().indexOf("cn.easybizchina.com")<0 && alist[i].href.toLowerCase().indexOf("bbs.easybizchina.com")<0 && alist[i].href.toLowerCase().indexOf("easy2bid.com")<0)
    {
        if(alist[i].target=='_blank')
        {
            alist[i].target='_self';
            //alist[i].style.border="1px solid red";
        }
    }
    else
    {
        if(alist[i].target=='_blank')
        {
            //alist[i].style.border="1px solid blue";
        }
    }
//<a href="javascript:win=window.open('http://www.test.com/Account/SendInquiryNew.aspx?type=prod&id=63316','','' );void(0);" title="">
    //由于询盘SendInquiry现在的方法是新开一个窗口，于是也要增加一个这样的判断来处理询盘
    if(alist[i].href.toLowerCase().indexOf("account/sendinquirynew.aspx")>=0)
    {
        //取出http://www.test.com/Account/SendInquiryNew.aspx?type=prod&id=63316
        //这样的字符，然后赋值给alist[i].href的属性即可
        var temp=alist[i].href;
        temp=temp.replace("javascript:win=window.open('","");
        temp=temp.replace("','','' );void(0);","");
        alist[i].href=temp;
        //alist[i].target='_self';
        //alist[i].style.border="1px solid Green";
    }
//<a href="javascript:win=window.open('http://www.test.com/MemberOffice/MyFavorites/AddFavorites.aspx?type=free&id=1942','','' );void(0);">
    //这儿处理的是添加到客户的收藏夹的链接，也要改成本窗口打开
//    *******************特别提醒，添加收藏夹不能改，因为产品成功添加到收藏夹后，窗口即自动关闭
//    if(alist[i].href.toLowerCase().indexOf("memberoffice/myfavorites/addfavorites.aspx")>=0)
//    {
//        var temp=alist[i].href;
//        temp=temp.replace("javascript:win=window.open('","");
//        temp=temp.replace("','','' );void(0);","");
//        alist[i].href=temp;
//        //alist[i].target='_self';
//        alist[i].style.border="1px solid Yellow";
//    }


}