var contextPath = "";
var banner_img =[
	["banner_1.jpg","医脉通在线划词翻译","http://www.medlive.cn/forum/topic_view.php?topic_id=24743"],
	["banner_2.jpg","医学招聘","http://www.51medjob.com/"]
];
//加入收藏
function bookmarkit(){
	switch(getOs()){
		case 1:
			window.external.addFavorite('http://www.meddir.cn/','金叶天翔医学导航');
		break;
		case 2:
			window.sidebar.addPanel('金叶天翔医学导航', 'http://www.meddir.cn/', "");
		break;
		case 0:
			alert("加入收藏失败，您使用的浏览器不支持这个功能");
		break;
	}
}

function getOs() {
   if(navigator.userAgent.indexOf("MSIE")>0)return 1;
   if(navigator.userAgent.indexOf("Firefox")>0)return 2;
   return 0;
}


//设为首页
function setHome(obj){
	obj.style.behavior='url(#default#homepage)';
	obj.setHomePage('http://www.meddir.cn/');
	return false;
}

//搜索
function doSearch(type){
	var key = "";
	if(type == 1) {
	//通用搜索
		key = encodeURIComponent(document.getElementById("key1").value);
		//google搜索
		if(document.getElementById("checkboxGoogle").checked) {
			var url = "http://www.google.cn/search?hl=zh-CN&q=" + key;
			var winGoogle = window.open(url,"winGoogle");
			//winGoogle.focus();
		}
		//百度搜索
		if(document.getElementById("checkboxBaidu").checked) {
			var url = "http://www.baidu.com/s?ie=utf-8&wd=" + key;
			var winBaidu = window.open(url,"winBaidu");
			//winBaidu.focus();
		}
		//站内搜索
		if(document.getElementById("checkboxSelf").checked) {
			//var url = "http://www.baidu.com/s?ie=utf-8&wd="+ key +"%20site%3Awww.meddir.cn";
			var url = "http://www.google.cn/search?complete=1&hl=zh-CN&newwindow=1&q="+key+"+site%3Ameddir.com.cn&meta=";
			var winWeb = window.open(url,"winWeb");
			//winWeb.focus();
		}
		//google地图搜索
		if(document.getElementById("checkboxGoogleMap").checked) {
			//var url = "http://map.baidu.com/m?ie=utf-8&word="+key;
			var url = "http://ditu.google.cn/maps?hl=zh-CN&tab=wl&q="+key;
			var winMap = window.open(url,"winMap");
			//winMap.focus();
		}
		//google学术搜索
		if(document.getElementById("checkboxGoogleScholar").checked) {
			var url = "http://scholar.google.com/scholar?q="+key;
			var winScholar = window.open(url,"winScholar");
			//winScholar.focus();
		}
		//词典搜索
		if(document.getElementById("checkboxBaiduDic").checked) {
			var url = "http://www.baidu.com/baidu?ie=utf-8&bs=&sr=&z=&ct=1048576&cl=3&f=8&word=" + key;
			var winDic = window.open(url,"winDic");
			//winDic.focus();
		}
		//文档搜索
		if(document.getElementById("checkboxBaiduDoc").checked) {
			var url = "http://www.baidu.com/baidu?ie=utf-8&ft=all&q1="+key;
			var winDoc = window.open(url,"winDoc");
			//winDoc.focus();
		}
	}else{
	//专业搜索
		key = encodeURIComponent(document.getElementById("key2").value);
		//医学词汇
		if(document.getElementById("checkboxMedWord").checked) {
			var url = "http://www.onelook.com/?w="+key+"&ls=b";
			var winMedWord = window.open(url,"winMedWord");
			//winMedWord.focus();
		}
		//药品价格
		if(document.getElementById("checkboxMedPrices").checked) {
		//	var url = "/navi/comment/include/searchPrices.jsp?keyinput="+key;
			var url = "/navi/comment/include/searchPrices.jsp?keyinput="+key +"&urlType=2";
			var winMedPrice = window.open(url,"winMedPrice");
			winMedPrice.focus();
		}
		//英文百科
		if(document.getElementById("checkboxWikipedia").checked) {
			var url = "http://www.encyclopedia.com/SearchResults.aspx?Q="+key;
			var winMedicine = window.open(url,"winMedicine");
			//winMedicine.focus();
		}
		//Mesh词表
		if(document.getElementById("checkboxMesh").checked) {
			var url = "http://www.ncbi.nlm.nih.gov/sites/entrez?EntrezSystem2.PEntrez.DbConnector.Db=mesh&EntrezSystem2.PEntrez.DbConnector.TermToSearch="+key;
			var winMesh = window.open(url,"winMesh");
			//winMesh.focus();
		}
		//医学图像
		if(document.getElementById("checkboxMedImage").checked) {
			var url = "/navi/comment/include/searchDTD.jsp?keywords="+key;
			var winMedImage = window.open(url,"winMedImage");
			//winMedImage.focus();
		}
		//CNKI文献
		if(document.getElementById("checkboxCNKI").checked) {
			var url = "http://search.cnki.net/SearchResult.aspx?searchword="+key;
			var winCNKI = window.open(url,"winCNKI");
			//winCNKI.focus();
		}
		//PubMed文献
		if(document.getElementById("checkboxPubMed").checked) {
			var url = "http://www.ncbi.nlm.nih.gov/sites/entrez?EntrezSystem2.PEntrez.DbConnector.Db=pubmed&EntrezSystem2.PEntrez.DbConnector.TermToSearch="+key;
			var winPubMed = window.open(url,"winPubMed");
			//winPubMed.focus();
		}
		//HighWire Press
		if(document.getElementById("checkboxHighWire").checked) {
			var url = "http://highwire.stanford.edu/cgi/searchresults?andorexactfulltext=and&src=hw&searchsubmit=redo&resourcetype=1&search=Search&fulltext="+key;
			var winHighWire = window.open(url,"winHighWire");
			//winHighWire.focus();
		}
	}
	return false;
}
//浏览三级页面
function viewDetail(msg,url) {
	var showMsg = "";
	if(url && url != "") {
		showMsg += "<a href=" + url + " target=_blank style='text-decoration: underline'>浏览详细介绍<\/a>" + "<br><br>"
	}
	showMsg += msg;
	if(showMsg != "") {
		//显示tooltip
		Tip(showMsg, BGCOLOR,'#FFFFFF',BORDERCOLOR,'#96AAC3',WIDTH, 210, TITLE, '简介',TITLEBGCOLOR,'#C1CFE0',TITLEFONTCOLOR,'#436295',SHADOW, true, FADEIN, 300, FADEOUT, 300, STICKY, 1, OFFSETX, -20, CLOSEBTN, true, CLICKCLOSE, true);
	}
}

/** No 25.
 *  分页页面换页用
 *  参 数: toPage  -- 要去的页的页数
 *  参 数: strAction  -- form提交向的action
 *  参 数: objForm  -- 要提交的form对象
 *  返回值: 削除后的文字列
 */
function goPage(toPage,strAction,objForm) {
	if(strAction.indexOf("?")>0){
		strAction=strAction+"&nowPage="+toPage
	}else{
		strAction=strAction+"?nowPage="+toPage
	}
	var runMsg = document.getElementById("runMsg");
	if(runMsg) {
		runMsg.style.display = "block";
	}
	objForm.action = strAction;
	objForm.target = "_self";
	objForm.submit();
}
//资源url点击计数
function doCountAndView(id,webPage) {
	var url= contextPath + '/admin/url_count.do';
	var pars= 'id=' + id;
	var myAjax = new Ajax.Request(
			url,
			{
				method: 'get',
				parameters: pars
			});

	var win_view = window.open(webPage,'win_view');
	win_view.focus();
}
//三级页面浏览次数计数
function doCountDetail(id) {
	var url= contextPath + '/admin/url_intro_count.do';
	var pars= 'id=' + id;
	var myAjax = new Ajax.Request(
		url,
		{
			method: 'get',
			parameters: pars
		});

}

