var showMess = (function(){
	var winUrl, hTitle = null,dicType;

	var bEvent = function(id,dic){

		var tag = null, tagPic = null, version = null;
		dicType=dic;
		version = document.getElementById(id);
		version.style.display = 'block';
	
		tag = version.parentNode;
		tagPic = tag.getElementsByTagName('span')[0];
		tagPic.className = 'new_up';		

		window.addEventListener ? document.addEventListener('click',show,false) : document.attachEvent('onclick',show);
		window.addEventListener ? document.addEventListener('mouseover',setTitle,false) : document.attachEvent('onmouseover',setTitle);
	}

	var show = function(e){
		var handEvt = e.target || e.srcElement,
			  evtParent = handEvt.parentNode,
			  mess = null, delSpace = /(^\s*)|(\s*$)/g;
	
		if((handEvt.tagName.toLowerCase() == 'span') && (evtParent.className == 'title')){

			hTitle = handEvt;
			
			if(evtParent.nextSibling.nodeType == 1){
				mess = evtParent.nextSibling;
			}
			else{
				mess = evtParent.nextSibling.nextSibling;
			}
			if(mess.style && mess.style.display){
				if(mess.style.display == '' || mess.style.display == 'block'){
					mess.style.display = 'none';
					handEvt.className = '';
				}
				else{
					mess.style.display = 'block';
					handEvt.className = 'new_up';
				}
			}
			else{
				if(handEvt.className == ''){
					mess.style.display = 'block';
					handEvt.className = 'new_up';
				}
				else{
					mess.style.display = 'none';
					handEvt.className = '';
				}
			}
			if(dicType=='en'){
				if(mess.id=='dl_dic_01'){
					nds_nav('http://rd.nciku.com/i:1000016938/c:25010/t:1?http://www.nciku.com/en/search/Collins_EC');
				}
				if(mess.id=='dl_dic_02'){
					nds_nav('http://rd.nciku.com/i:1000016939/c:21140/t:1?http://www.nciku.com/search/en/Comprehensive_EC');
				}
				if(mess.id=='dl_dic_03'){
					nds_nav('http://rd.nciku.com/i:1000016940/c:63686/t:1?http://www.nciku.com/search/Collins_EE');
				}	
				if(mess.id=='dl_dic_04'){
					nds_nav('http://rd.nciku.com/i:1000016942/c:1624/t:1?http://www.nciku.com/search/EC/Example_search_result');
				}
			}else if(dicType=='zh'){
				if(mess.id=='dl_dic_01'){
					nds_nav('http://rd.nciku.com/i:1000016943/c:55718/t:1?http://www.nciku.com/search/Collins_CE');
				}
				if(mess.id=='dl_dic_02'){
					nds_nav('http://rd.nciku.com/i:1000016944/c:65469/t:1?http://www.nciku.com/search/Comprehensive_CE');
				}
				if(mess.id=='dl_dic_03'){
					nds_nav('http://rd.nciku.com/i:1000016945/c:29267/t:1?http://www.nciku.com/search/FLTRP_CC');
				}
				if(mess.id=='dl_dic_04'){
					nds_nav('http://rd.nciku.com/i:1000016947/c:51662/t:1?http://www.nciku.com/search/CE/Example_search_result');
				}
			}
		}
	}
	
	var setTitle = function(e){
		var handEvt = e.target || e.srcElement,
			  evtParent = handEvt.parentNode,
			  delSpace = /(^\s*)|(\s*$)/g;
	
		if((handEvt.tagName.toLowerCase() == 'span') && (evtParent.className == 'title')){
			handEvt.title = handEvt.title.replace(delSpace,'');
		}
	}

	var print = function(){
			var win = window.open(winUrl,'','width=690,height=700,scrollbars=yes');			
	}

	return{
		init: function(id,dicType){
			bEvent(id,dicType);
		},

		newWin: function(url){
			var btnPrint = document.getElementById('print');
			winUrl = url;
			window.addEventListener ? btnPrint.addEventListener('click',print,false) : btnPrint.attachEvent('onclick',print);
		}
	}
})()
