function showFaculty(lng){
	var prDIV = document.getElementById("faculty"+lng);
	var clDIV = document.getElementById("facultyClip");
	prDIV.style.left		= (clDIV.offsetLeft + 600 - prDIV.offsetWidth) + "px";
	showHideSelect(facultyListVisible)
	prDIV.style.visibility	= (facultyListVisible) ? "hidden" : "visible";
	facultyListVisible		= !facultyListVisible;
	return false
}


function showHideSelect(fV){
	var oSelects = document.getElementsByTagName("SELECT");
	if(oSelects && oSelects.length>0){
		for(var kk=0; kk<oSelects.length; kk++){
			oSelects[kk].style.visibility	= (!fV) ? "hidden" : "visible";
		}
	}
}

var facultyListVisible		= false;

function printArticle(id_article, chapter){
	var myChapter	= (chapter=="") ? "" : ("&chapter=" + chapter);
	var myHref	= "/default.aspx?print=1&article="+id_article+myChapter
	var myWin = window.open(myHref,"","width=500, height=350, scrollbars=yes, status=yes")	
	return
}

function mailArticle(id_article, chapter){
	var myChapter	= (chapter=="") ? "" : ("&chapter=" + chapter);
	var	myHref	= "/default.aspx?articlebymail=1&article="+id_article+myChapter
	
	var myWin = window.open(myHref,"","width=220, height=330, scrollbars=no, status=yes")	
	return
}

document.onkeypress = checkENTER;

function checkENTER(e){
	if(!e){
		if(event.keyCode && event.keyCode == 13){
			if(event.srcElement.name == "txtSearch"){
				//enter MS
				//document.location='/?section=1&server=1&searchtext='+encodeURI(document.forms[0].txtSearch.value)/*+GetSearchOptions()*/;
				startSearch('/?server='+search_id_server);
			}
			event.cancelBubble = false;
			return false;
		}
	}else{
		if(e.which && e.which == 13){
			if(e.target.name == "txtSearch"){
				//enter OTHER
				//document.location='/?section=1&server=1&searchtext='+document.forms[0].txtSearch.value/*+GetSearchOptions()*/;
				startSearch('/?server='+search_id_server);
			}
			e.cancelBubble = false;
			return false
		}
	}
	return true
}

//**********************************************
function showThumbs(iFile, wFile, hFile){
	var wXDet = window.open("/default.aspx?showPrint=1&file=" + iFile,"showThumbs","scrollbars=yes,width=" + wFile + ",height=" + (parseInt(hFile)+/*25*/0) + ",status=no,noresize");
}

function startSearch(currURL){
	var params = new String();
	if(document.forms[0].rdTxt.checked)
	{
		params = currURL+'&searchtext='+encodeURI(document.forms[0].txtSearch.value+'&highlighttext='+encodeURI(document.forms[0].txtSearch.value));
	}
	if(document.forms[0].rdPer.checked)
	{

		params = search_per+'&catsrtext=' + encodeURI(document.forms[0].txtSearch.value) + '&catsrfield=10'; 
	}
	if(document.forms[0].rdDok.checked)
	{

		params = search_dok+'&catsrtext=' + encodeURI(document.forms[0].txtSearch.value) + '&catsrfield=10'; 
	}

	if(document.forms[0].rdFile && document.forms[0].rdFile.checked)
	{

		params = search_file+'&catsrtext=' + encodeURI(document.forms[0].txtSearch.value) + '&catsrfield=39'; 
	}
	document.location = params;
}