var windowMinSize = [80,30];	// Mininum width and height of windows.
var moveCounter = -1;	
var startEventPos = new Array();
var startPosWindow = new Array();
var startWindowSize = new Array();
var initResizeCounter = -1;	
var activeWindow = bncwindow;
var activeWindowContent = bncwindow_contentDiv;	
var windowSizeArray = new Array();
var windowPositionArray = new Array();
var currentZIndex = 100000;
var windowStateArray = new Array();	// Minimized or maximized
var activeWindowIframe = false;
var divCounter = 0;
var zIndexSet = false;
var currentToolTipId = 0;
var currentToolTipType = '';


var MSIEWIN = (navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Win')>=0 && navigator.userAgent.toLowerCase().indexOf('opera')<0)?true:false;
var opera = navigator.userAgent.toLowerCase().indexOf('opera')>=0?true:false;

if (MSIEWIN){
	 var tableDisplay='inline';
	 var trDisplay='inline';
}
else{
	 var tableDisplay='table';	
	 var trDisplay='table-row';
}
function getScrollXY() {
	var scrOfX = 0, scrOfY = 0;
  	if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    	scrOfY = window.pageYOffset;
    	scrOfX = window.pageXOffset;
  	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    	scrOfY = document.body.scrollTop;
    	scrOfX = document.body.scrollLeft;
  	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    	scrOfY = document.documentElement.scrollTop;
    	scrOfX = document.documentElement.scrollLeft;
  	}
  	return [ scrOfX, scrOfY ];
}

function initResizeWindow(e){
	activeWindow = bncwindow;
	activeWindowContent = bncwindow_contentDiv;	
	if(document.all)e = event;
	initResizeCounter = 0;
	startWindowSize = [activeWindowContent.offsetWidth,activeWindowContent.offsetHeight];
	startEventPos = [e.clientX,e.clientY];
	
	if(MSIEWIN)activeWindowIframe = activeWindow.getElementsByTagName('IFRAME')[0];
	startResizeWindow();
	return false;
		
}

function startResizeWindow(){
	if(initResizeCounter>=0 && initResizeCounter<=10){
		initResizeCounter++;
		setTimeout('startResizeWindow()',5);
	}
}

function minimizeWindow(e,inputObj){
	activeWindow = bncwindow;
	activeWindowContent = bncwindow_contentDiv;	
	if(activeWindowContent.style.display!='none'){
		activeWindowContent.style.display='none';
	}else{			
		activeWindowContent.style.display='block';
	}
}
 
function minimizeContentWindow(e,inputObj){
	activeWindow = bnccontentwindow;
	activeWindowContent = bnccontentwindow_contentDiv;	
	if(activeWindowContent.style.display!='none'){
		activeWindowContent.style.display='none';
	}else{			
		activeWindowContent.style.display='block';
	}
} 
function cancelEvent(){
	return (moveCounter==-1 && initResizeCounter==-1)?true:false;
}
function initMove(e){		
	if(document.all)e = event;
	moveCounter = 0;
	startEventPos = [e.clientX,e.clientY];
	startPosWindow = [bncwindow.offsetLeft,bncwindow.offsetTop];
	startMove();
	if(!MSIEWIN)return false;

}

function startMove(){
	if(moveCounter>=0 && moveCounter<=10){
		moveCounter++;
		setTimeout('startMove()',5);
	}
}

function stopMove(e){
	if(document.all)e = event;
	moveCounter=-1;
	initResizeCounter=-1;
	if(!bncwindow || !bncwindow_contentDiv)return;
	var state = '0';
	if(windowStateArray[bncwindow.id.replace(/[^0-9]/g,'')])state = '1';
}

function moveWindow(e){
	if(document.all)e = event;
	if(moveCounter>=10){
		bncwindow.style.left = startPosWindow[0] + e.clientX - startEventPos[0]  + 'px';
		bncwindow.style.top = startPosWindow[1] + e.clientY - startEventPos[1]  + 'px';
		
	}	
	
	if(initResizeCounter>=10){
		var newWidth = Math.max(windowMinSize[0],startWindowSize[0] + e.clientX - startEventPos[0]);
		var newHeight = Math.max(windowMinSize[1],startWindowSize[1] + e.clientY - startEventPos[1]);
		bncwindow.style.width =  newWidth + 'px';
		bncwindow_contentDiv.style.height = newHeight  + 'px';		
		if(MSIEWIN) activeWindowIframe = activeWindow.getElementsByTagName('IFRAME')[0];
		if(MSIEWIN && activeWindowIframe){
			activeWindowIframe.style.width = (newWidth) + 'px';	
			activeWindowIframe.style.height = (newHeight+20) + 'px';	
		}
			
		
	}
	if(!document.all)return false;
}

function hideWindow(){
	bncwindow.style.display='none';
	hideRateWindow();
}

function showWindow(){
	offset=getScrollXY()
	bncwindow.style.left =  offset[0] + 250 + 'px';
	bncwindow.style.top = offset[1] + 100 + 'px';	
	bncwindow.style.display='inline';
	bncwindow.style.zIndex=currentZIndex;
	currentZIndex+=100;
}

function hideToolbarWindow(){
	bnctoolbarwindow.style.display='none';
}

function showToolbarWindow(){
	offset=getScrollXY()
	bnctoolbarwindow.style.left =  offset[0] + 250 + 'px';
	bnctoolbarwindow.style.top = offset[1] + 100 + 'px';	
	bnctoolbarwindow.style.display='inline';
	bnctoolbarwindow.style.zIndex=currentZIndex;
	currentZIndex+=100;
}

function hideContentWindow(){
	bnccontentwindow.style.display='none';
	hideRateWindow();
}

function showContentWindow(){
	offset=getScrollXY()
	bnccontentwindow.style.left =  offset[0] + 250 + 'px';
	bnccontentwindow.style.top = offset[1] + 100 + 'px';	
	bnccontentwindow.style.display='inline';
	bnccontentwindow.style.zIndex=currentZIndex;
	currentZIndex+=100;
}

function showContent(){
	try {minimizeInfo();} catch(e){}
 	document.getElementById('content').style.display='none'
	document.getElementById('content_detail').style.display='block'
	$pos=ObjectPosition(document.getElementById('content_detail'))
	window.scroll(0,$pos[1]);
}

function hideContent(back){
	if (document.getElementById('content').innerHTML==""){
		if (back){
			document.location=back;
		}
		else history.go(-1);
	}
	else {
		try {minimizeInfo();} catch(e){}
		window.scroll(0,0);
		document.getElementById('content').style.display='block';
		document.getElementById('content_detail').style.display='none';
	}
}

function hideRateWindow(){
	bncratewindow.style.display='none';
}

function showRateWindow(body){
	offset=getScrollXY();
	
	bncratewindow.style.left = mouseX+'px';
	bncratewindow.style.top = mouseY+'px';	
	bncratewindow.style.display='inline';
	bncratewindow.style.zIndex=currentZIndex;
	bncratewindow.innerHTML=body;
	currentZIndex+=100;
}

bnccontent = document.createElement('DIV');

if (typeof(bncwindow)!='object'){

	if(document.all)e = event;
	
	var bncwindow = document.createElement('DIV');
	bncwindow.className='bnc_window';
	bncwindow.setAttribute('id', 'bnc_window_main');
	document.getElementsByTagName('body')[0].appendChild(bncwindow);
		
	var bncwindow_topDiv = document.createElement('DIV');
	bncwindow_topDiv.className='bnc_window_top';
	bncwindow_topDiv.onmousedown = initMove;
	bncwindow.appendChild(bncwindow_topDiv);
	
	//var txt = document.createTextNode('Add to bnc');
	//bncwindow_topDiv.appendChild(txt);
	
	var img = document.createElement('IMG');
	img.src = 'images/top_left.gif';
	img.align='left';
	bncwindow_topDiv.appendChild(img);
	
	var img = document.createElement('IMG');
	img.src = 'images/top_center.gif';
	img.style.position='absolute';
	img.style.left='3px';
	img.style.width='5000px';
	img.style.height='17px';
	img.onmousedown='initMove';
	bncwindow_topDiv.appendChild(img);
	
	var bncwindow_buttonDiv = document.createElement('DIV');
	bncwindow_buttonDiv.className='top_buttons';
	bncwindow_buttonDiv.style.width='20px';
	bncwindow_topDiv.appendChild(bncwindow_buttonDiv);
	
	var bncwindow_close_a = document.createElement('A');
	bncwindow_close_a.href="javascript:void(0)";
	bncwindow_buttonDiv.appendChild(bncwindow_close_a);
	
	var img = document.createElement('IMG');
	img.src = 'images/close.gif';
	img.onclick = hideWindow;
	img.className='closeButton';
	img.border = "0px";
	bncwindow_close_a.appendChild(img);	
	
	var img = document.createElement('IMG');
	img.src = 'images/top_right.gif';
	bncwindow_buttonDiv.appendChild(img);		
	
	var bncwindow_middleDiv = document.createElement('DIV');
	bncwindow_middleDiv.className='bnc_windowMiddle';
	bncwindow.appendChild(bncwindow_middleDiv);
	
	var bncwindow_contentDiv = document.createElement('DIV');
	bncwindow_contentDiv.className='bnc_windowContent';
	bncwindow_contentDiv.id='bnc_window';
	bncwindow_contentDiv.innerHTML='';
	bncwindow_middleDiv.appendChild(bncwindow_contentDiv);
	
	var bncwindow_bottomDiv = document.createElement('DIV');
	bncwindow_bottomDiv.className='bnc_window_bottom';
	bncwindow.appendChild(bncwindow_bottomDiv);
	
	//var img = document.createElement('IMG');
	//img.src = 'images/bottom_right.gif';
	//img.onmousedown=initResizeWindow;
	//img.className='resizeImage';
	//bncwindow_bottomDiv.appendChild(img);		
	
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
	    //Non-IE
	    myWidth = window.innerWidth;
	    myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    //IE 6+ in 'standards compliant mode'
	    myWidth = document.documentElement.clientWidth;
	    myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    //IE 4 compatible
	    myWidth = document.body.clientWidth;
	    myHeight = document.body.clientHeight;
	}
	window.scroll(0,0);
	myWidth=myWidth/2-300;
	
	bncwindow.style.width =  500 + 'px';
	//bncwindow_contentDiv.style.height = 300  + 'px';		
	//bncwindow_contentDiv.style.maxHeight = 500  + 'px';		
	//bncwindow.style.left =  myWidth + 'px';
	//bncwindow.style.top = 200 + 'px';	
	
}	

if (typeof(bnctoolbarwindow)!='object'){

	if(document.all)e = event;
	
	var bnctoolbarwindow = document.createElement('DIV');
	bnctoolbarwindow.className='bnc_window';
	bnctoolbarwindow.setAttribute('id', 'bnc_window_main');
	document.getElementsByTagName('body')[0].appendChild(bnctoolbarwindow);
		
	var bnctoolbarwindow_topDiv = document.createElement('DIV');
	bnctoolbarwindow_topDiv.className='bnc_window_top';
	bnctoolbarwindow_topDiv.onmousedown = initMove;
	bnctoolbarwindow.appendChild(bnctoolbarwindow_topDiv);
	
	//var txt = document.createTextNode('Add to bnc');
	//bncwindow_topDiv.appendChild(txt);
	
	var img = document.createElement('IMG');
	img.src = 'images/top_left.gif';
	img.align='left';
	bnctoolbarwindow_topDiv.appendChild(img);
	
	var img = document.createElement('IMG');
	img.src = 'images/top_center.gif';
	img.style.position='absolute';
	img.style.left='3px';
	img.style.width='5000px';
	img.style.height='17px';
	img.onmousedown='initMove';
	bnctoolbarwindow_topDiv.appendChild(img);
	
	var bnctoolbarwindow_buttonDiv = document.createElement('DIV');
	bnctoolbarwindow_buttonDiv.className='top_buttons';
	bnctoolbarwindow_buttonDiv.style.width='20px';
	bnctoolbarwindow_topDiv.appendChild(bnctoolbarwindow_buttonDiv);
	
	var bnctoolbarwindow_close_a = document.createElement('A');
	bnctoolbarwindow_close_a.href="javascript:void(0)";
	bnctoolbarwindow_buttonDiv.appendChild(bnctoolbarwindow_close_a);
	
	var img = document.createElement('IMG');
	img.src = 'images/close.gif';
	img.onclick = hideToolbarWindow;
	img.className='closeButton';
	img.border = "0px";
	bnctoolbarwindow_close_a.appendChild(img);	
	
	var img = document.createElement('IMG');
	img.src = 'images/top_right.gif';
	bnctoolbarwindow_buttonDiv.appendChild(img);		
	
	var bnctoolbarwindow_middleDiv = document.createElement('DIV');
	bnctoolbarwindow_middleDiv.className='bnc_windowMiddle';
	bnctoolbarwindow.appendChild(bnctoolbarwindow_middleDiv);
	
	var bnctoolbarwindow_contentDiv = document.createElement('DIV');
	bnctoolbarwindow_contentDiv.className='bnc_windowContent';
	bnctoolbarwindow_contentDiv.id='bnc_toolbar_window';
	bnctoolbarwindow_contentDiv.innerHTML='';
	bnctoolbarwindow_middleDiv.appendChild(bnctoolbarwindow_contentDiv);
	
	var bnctoolbarwindow_bottomDiv = document.createElement('DIV');
	bnctoolbarwindow_bottomDiv.className='bnc_window_bottom';
	bnctoolbarwindow.appendChild(bnctoolbarwindow_bottomDiv);
	
	//var img = document.createElement('IMG');
	//img.src = 'images/bottom_right.gif';
	//img.onmousedown=initResizeWindow;
	//img.className='resizeImage';
	//bncwindow_bottomDiv.appendChild(img);		
	
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
	    //Non-IE
	    myWidth = window.innerWidth;
	    myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    //IE 6+ in 'standards compliant mode'
	    myWidth = document.documentElement.clientWidth;
	    myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    //IE 4 compatible
	    myWidth = document.body.clientWidth;
	    myHeight = document.body.clientHeight;
	}
	window.scroll(0,0);
	myWidth=myWidth/2-300;
	
	bnctoolbarwindow.style.width =  500 + 'px';
	//bncwindow_contentDiv.style.height = 300  + 'px';		
	//bncwindow_contentDiv.style.maxHeight = 500  + 'px';		
	//bncwindow.style.left =  myWidth + 'px';
	//bncwindow.style.top = 200 + 'px';	
	
}	

if (typeof(bnToolTipMenu)!='object'){
	
}

if (typeof(bnccontentwindow)!='object'){
	
	if(document.all)e = event;
	
	var bnccontentwindow = document.createElement('DIV');
	bnccontentwindow.className='bnc_window';
	document.getElementsByTagName('BODY')[0].appendChild(bnccontentwindow);
				
	var bnccontentwindow_topDiv = document.createElement('DIV');
	bnccontentwindow_topDiv.className='bnc_window_top';
	//bnccontentwindow_topDiv.onmousedown = initMove;
	bnccontentwindow.appendChild(bnccontentwindow_topDiv);
	
	//var txt = document.createTextNode('Add to bnc');
	//bnccontentwindow_topDiv.appendChild(txt);
	
	var img = document.createElement('IMG');
	img.src = 'images/top_left.gif';
	img.align='left';
	bnccontentwindow_topDiv.appendChild(img);
	
	var img = document.createElement('IMG');
	img.src = 'images/top_center.gif';
	img.style.position='absolute';
	img.style.left='3px';
	img.style.width='5000px';
	img.style.height='17px';
	img.onmousedown='initMove';
	bnccontentwindow_topDiv.appendChild(img);
	
	var bnccontentwindow_buttonDiv = document.createElement('DIV');
	bnccontentwindow_buttonDiv.className='top_buttons';
	bnccontentwindow_buttonDiv.style.width='20px';
	bnccontentwindow_topDiv.appendChild(bnccontentwindow_buttonDiv);
	
	var bnccontentwindow_close_a = document.createElement('A');
	bnccontentwindow_close_a.href="javascript:void(0)";
	bnccontentwindow_buttonDiv.appendChild(bnccontentwindow_close_a);
	
	var img = document.createElement('IMG');
	img.src = 'images/close.gif';
	img.onclick = hideContentWindow;
	img.className='closeButton';
	img.border = "0px";
	bnccontentwindow_close_a.appendChild(img);	
	
	var img = document.createElement('IMG');
	img.src = 'images/top_right.gif';
	bnccontentwindow_buttonDiv.appendChild(img);		
	
	var bnccontentwindow_middleDiv = document.createElement('DIV');
	bnccontentwindow_middleDiv.className='bnc_windowMiddle';
	bnccontentwindow.appendChild(bnccontentwindow_middleDiv);
	
	var bnccontentwindow_contentDiv = document.createElement('DIV');
	bnccontentwindow_contentDiv.className='bnc_windowContent';
	bnccontentwindow_contentDiv.id='bnc_windowContent';
	bnccontentwindow_contentDiv.innerHTML='';
	bnccontentwindow_contentDiv.style.overflow='auto';
	bnccontentwindow_middleDiv.appendChild(bnccontentwindow_contentDiv);
	
	var bnccontentwindow_bottomDiv = document.createElement('DIV');
	bnccontentwindow_bottomDiv.className='bnc_window_bottom';
	bnccontentwindow.appendChild(bnccontentwindow_bottomDiv);
	
	//var img = document.createElement('IMG');
	//img.src = 'images/bottom_right.gif';
	//img.onmousedown=initResizeWindow;
	//img.className='resizeImage';
	//bnccontentwindow_bottomDiv.appendChild(img);		
	
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
	    //Non-IE
	    myWidth = window.innerWidth;
	    myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    //IE 6+ in 'standards compliant mode'
	    myWidth = document.documentElement.clientWidth;
	    myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    //IE 4 compatible
	    myWidth = document.body.clientWidth;
	    myHeight = document.body.clientHeight;
	}
	window.scroll(0,0);
	myWidth=200;
	
	bnccontentwindow.style.width =  850 + 'px';
	//bnccontentwindow_contentDiv.style.height = 300  + 'px';		
	bnccontentwindow_contentDiv.style.maxHeight = 600  + 'px';		
	bnccontentwindow.style.left =  myWidth + 'px';
	bnccontentwindow.style.top = 150 + 'px';	
	
}	

if (typeof(bncratewindow)!='object'){
	if(document.all)e = event;
	var bncratewindow = document.createElement('DIV');
	bncratewindow.style.background='white';
	bncratewindow.style.border='1px solid black';
	//bncratewindow.style.height='26px';
	//bncratewindow.style.width='150px';
	bncratewindow.style.padding='3px';
	bncratewindow.style.width='200px';
	bncratewindow.style.position='absolute';
	bncratewindow.style.display='none';
	bncratewindow.onclick=hideRateWindow;
	document.getElementsByTagName('BODY')[0].appendChild(bncratewindow);
	
}

			document.documentElement.onmouseup = stopMove;	
			document.documentElement.onmousemove = moveWindow;
			document.documentElement.ondragstart = cancelEvent;
			document.documentElement.onselectstart = cancelEvent;
	

hideWindow();
hideToolbarWindow();
hideContentWindow();

function show_advanced_search(){
	getContent("advancedSearch.php","bnc_window",null);
	showWindow();
}

	main_realms = new Array;
	news_realms = new Array;
	
	main_realms['news']=1;
	main_realms['social_news']=1;
	main_realms['professional']=1;
	
	news_realms['news_realms_world']=	function hideToolTipMenu(){
		
	}
1;
	news_realms['news_realms_politics']=1;
	news_realms['news_realms_business']=1;
	news_realms['news_realms_finance']=1;
	news_realms['news_realms_law_tax']=1;
	news_realms['news_realms_technology']=1;
	news_realms['news_realms_science']=1;
	news_realms['news_realms_health']=1;
	news_realms['news_realms_sport']=1;
	news_realms['news_realms_travel']=1;
	news_realms['news_realms_culture']=1;
	news_realms['news_realms_entertainment']=1;
	
	function check_all_realms(){
		if (document.advanced_search.everything.checked){
			checked=true;
		}
		else{
			checked=false;
		}
		for (k in main_realms){
			document.getElementById(k).checked=checked;
		}
		check_all_news();
	}
	
	function check_one_realm(realm){
		if (!realm.checked){window
			document.getElementById('everything').checked=false;
			for (k in news_realms){
				if (k==realm.id) document.getElementById('news').checked=false;
			}
		}

	}
	
	function check_all_news(){
		if (document.advanced_search.news.checked){
			checked=true;
		}
		else{
			checked=false;
		}
		for (k in news_realms){
			document.getElementById(k).checked=checked;
		}
	}
	
	/*function chk_search_phrase(field){
		if (document.getElementById(field).value==''){
			alert('Please specify search phrase!');
			return false;
		}
		return true;
	}*/
	function showInvitationWindow(){
		javascript: getIContent('invitation.php','bnc_windowContent',null);
		showContentWindow();

	}
	
	function ObjectPosition(obj) {
		var curleft = 0;
		var curtop = 0;
		if (obj.offsetParent) {
			do {
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
			} while (obj = obj.offsetParent);
		}
		return [curleft,curtop];
	}
	
	function getInnerSize() {
	  var myWidth = 0, myHeight = 0;
	  if( typeof( window.innerWidth ) == 'number' ) {
	    //Non-IE
	    myWidth = window.innerWidth;
	    myHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    //IE 6+ in 'standards compliant mode'
	    myWidth = document.documentElement.clientWidth;
	    myHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    //IE 4 compatible
	    myWidth = document.body.clientWidth;
	    myHeight = document.body.clientHeight;
	  }
	  return [myWidth,myHeight];
	}
	
	function showToolTipMenu(type,id,highlightWords,reference){
		
	//	if (document.getElementById('bncToolTipMenu').style.display!='inline' || currentToolTipId!=id || currentToolTipType!=type){
			hideToolTipMenu();
			if (id){
				
				windowSize=getInnerSize();
				var scrollTop = document.body.scrollTop;
				if (scrollTop == 0){
				    if (window.pageYOffset) scrollTop = window.pageYOffset;
				    else scrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
				}
				if ((windowSize[1]/2)<(mouseY-scrollTop)){
					arrow='BottomArrow';
					addX=-10;
					addY=-290;
				}
				else{
					arrow='TopArrow';
					addX=-10;
					addY=-25;
				}
				
				if ((windowSize[0]/2)<(mouseX)){
					arrow='Right'+arrow;
					addX=-350;
				}
				document.getElementById('bncToolTipMenu'+arrow).style.left = mouseX+addX+'px';
				document.getElementById('bncToolTipMenu'+arrow).style.top = mouseY+addY+'px';
				document.getElementById('bncToolTipMenu'+arrow).style.display='inline';
				document.getElementById('bncToolTipMenu'+arrow).style.zIndex=currentZIndex;
				if (window.name==='content') getContent('../actions.php?type='+type+'&id='+id+'&highlightWords='+highlightWords+'&ref='+reference,'toolTip'+arrow+'Content',false);
				else getContent('actions.php?type='+type+'&id='+id+'&highlightWords='+highlightWords+'&ref='+reference,'toolTip'+arrow+'Content',false);
				currentToolTipId=id;
				currentToolTipType=type;
				currentZIndex+=100;
			}
			
	//	}
		
	}
	
	function hideToolTipMenu(){
		document.getElementById('bncToolTipMenuTopArrow').style.display='none';
		document.getElementById('bncToolTipMenuBottomArrow').style.display='none';
		document.getElementById('bncToolTipMenuRightTopArrow').style.display='none';
		document.getElementById('bncToolTipMenuRightBottomArrow').style.display='none';
	}
	
	function showSearchHistory(){
		document.getElementById('searchhistorydiv').style.border='1px solid gray';
		document.getElementById('searchhistorydiv').style.background='white';
		document.getElementById('searchhistorydiv').style.position='absolute';
		document.getElementById('searchhistorydiv').style.width='auto';
		document.getElementById('searchhistorydiv').style.minWidth='230px';
		document.getElementById('searchhistorydiv').style.maxHeight='400px';
		document.getElementById('searchhistorydiv').style.height='auto';
		document.getElementById('searchhistorydiv').style.overflow='auto';
		document.getElementById('searchhistorydiv').style.top='110px';
		document.getElementById('searchhistorydiv').style.left='557px';
		getContent('searchHistory.php','searchhistorydiv',false);
		document.getElementById('searchhistorydiv').style.display='inline';
		document.getElementById('searchhistorydiv').style.zIndex=currentZIndex;
		currentZIndex+=100;
	}
	
	function hideSearchHistory(){
		document.getElementById('searchhistorydiv').style.display='none';
	}
	
	function showBooks(){
		document.getElementById('premiumcontentdiv').style.border='1px solid gray';
		document.getElementById('premiumcontentdiv').style.background='white';
		document.getElementById('premiumcontentdiv').style.position='absolute';
		document.getElementById('premiumcontentdiv').style.width='auto';
		document.getElementById('premiumcontentdiv').style.minWidth='230px';
		document.getElementById('premiumcontentdiv').style.maxWidth='600px';
		document.getElementById('premiumcontentdiv').style.height='auto';
		document.getElementById('premiumcontentdiv').style.maxHeight='400px';
		document.getElementById('premiumcontentdiv').style.overflow='auto';
		document.getElementById('premiumcontentdiv').style.top=(mouseY-5)+'px';
		document.getElementById('premiumcontentdiv').style.left=(mouseX-5)+'px';
		getContent('showBooks.php','premiumcontentdiv',false);
		document.getElementById('premiumcontentdiv').style.display='inline';
		document.getElementById('premiumcontentdiv').style.zIndex=currentZIndex;
		currentZIndex+=100;
	}
	
	function hideBooks(){
		document.getElementById('premiumcontentdiv').style.display='none';
	}
	
	function toggleSimilar(id){
		if (document.getElementById('similar_'+id).style.display=='none')
			document.getElementById('similar_'+id).style.display='inline';
		else
			document.getElementById('similar_'+id).style.display='none';
	}
	