﻿Browser = {
	IE:     !!(window.attachEvent && !window.opera),
	Opera:  !!window.opera,
	WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
	Gecko:  navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
	MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
}
function $(element) {
  if (typeof(element) == "string")
    element = document.getElementById(element);
  return element;
}

function ImgStock(obj,fa_ObjName,img_ObjName,code){
    var imgUrl = "http://img.eastmoney.com/ForexImage/";
    
	var chgObj = $(fa_ObjName).getElementsByTagName("li");
	var objNum = chgObj.length;
	for (var i = 0; i < objNum; i++){
		chgObj[i].className = null;
	}
	obj.className = "at";
	
	$(img_ObjName).src = imgUrl + code + "_1.png?t="+Math.random();
	if ($(img_ObjName).parentNode.nodeName.toUpperCase() == "A"){
		$(img_ObjName).parentNode.href = "/stock_" + code + ".html";
	}
}

//外汇理财产品
function SearchFinancePro(BankSelObj, CurrencySelObj, BusinessTypeSelObj){
    var BankSelObjValue = $(BankSelObj).value;
    var CurrencySelObjValue = $(CurrencySelObj).value;
    var BusinessTypeSelObjValue = $(BusinessTypeSelObj).value;
    
    var url = "";
    if(CurrencySelObjValue<=2)
    	url = "/FinanceList.html";
    else
    	url = "/FinanceList,"+BankSelObjValue+"A"+CurrencySelObjValue+"E"+BusinessTypeSelObjValue+".html";
    window.open(url)
}

// 打印页面
function doPrint(){
	var str="<html>";
	var article;
	var css;
	var strAdBegin="<!--pic_cnt_start-->";
	var strAdEnd="<!--pic_cnt_end-->";
	var strTmp;
	
		css="<style>"
		+"body{font-family:宋体}"
		+"td {font-size:14px;line-height:1.8em;}"
		+".title {font-size:24px;font-weight:bold;line-height:1.6em}"
	    +"</style>";
	
		str +=	css;
		str +=	'<meta http-equiv="content-type" content="text/html; charset=gb2312">';
		str +=	'<title>'+document.title+'</title>';
		str +=	"<body bgcolor=#ffffff topmargin=5 leftmargin=5 marginheight=5 marginwidth=5 onload='window.print()'>";
		str +=	"<center><table width=600 border=0 cellspacing=0 cellpadding=0><tr><td height=34 width=150><td align=right valign=bottom><a href='javascript:history.back()'>返回</a>　<a href='javascript:window.print()'>打印</a></td></tr></table>";
		str +=	"<table width=600 border=0 cellpadding=0 cellspacing=0><tr><td>";
		//str +=  "<div align=center class=title>" + document.title + "</div><br>"
		article=document.getElementById('newText').innerHTML;
		if(article.indexOf(strAdBegin)!=-1){
			str +=article.substr(0,article.indexOf(strAdBegin));
			strTmp=article.substr(article.indexOf(strAdEnd)+strAdEnd.length, article.length);
		}else{
			strTmp=article
		}
		str +=strTmp
		str +=	"</td></tr></table>";
		str += window.location.href;
		str +=	"</center></body></html>";
		document.write(str);
		document.close();
}

// 复制网址
function copyToClipBoard(){
	var clipBoardContent=''; 
	clipBoardContent+=document.title;
	clipBoardContent+='\r\n';
	clipBoardContent+=window.location.href;
	try{
		window.clipboardData.setData("Text",clipBoardContent);
		alert("您已复制链接及标题，请粘贴到QQ/MSN等发给好友!");
	}catch(e){
		alert("对不起!您的浏览器不支持剪切板功能!")
	}}

// 加入收藏
function AddFavor() {  
    try {
        window.external.addFavorite(window.location.href, window.document.title);  
    }catch (e){  
        try{  
            window.sidebar.addPanel(window.document.title, window.location, "");  
        }catch (e) {
			alert("加入收藏失败，请使用Ctrl+D进行添加");  
        }  
    }  
}  

