	//***********************************************************************
	//* APPLICATION	: DDF+ Web
	//* COMPONENT	: 
	//* PAGE			: This is a javascript library.
	//* CREATION		: 01.05.2000
	//* AUTHOR		: Vincent Graf
	//* CONTENT		: 
	//*		
	//***********************************************************************
	//* UPDATES		:
	//*
	//***********************************************************************

	
	//--------------------------------------------
	// This function is called on unload 
	// to set the opener boolean flag to false
	//----------
	function lf_ManageOpener() {
		if (!(window.opener.bIsOpen==null))
			window.opener.bIsOpen=false;		
	}

	//***********************************************************************
	// Function glf_popupwindow opens and display the right popup window
	//***********************************************************************
	function glf_popupwindow(lwin_Window, sURL, iWidth, iHeight, iLeft, iTop, sScroll, iLanguage){
		var lwin_WindowReturn;
		if (lwin_Window==null){
		 var sParam;
		 if (sURL.indexOf('?')<1){
		 	sURL=sURL + '?l=' + iLanguage;
		 }else{
		 	sURL=sURL + '&l=' + iLanguage;
		 }
		 //sParam='height=' + iHeight + ',width=' + iWidth + ',screenX=' + iLeft + ',left=' + iLeft + ',screenY=' + iTop + ',top=' + iTop + ',fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0';
		 //sParam='height=' + iHeight + ',width=' + iWidth + ',screenX=' + iLeft + ',screenY=' + iTop + ',fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0';
         sParam='height=' + iHeight + ',width=' + iWidth + ',left=' + iLeft + ',top=' + iTop + ',screenX=' + iLeft + ',screenY=' + iTop + ',fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0';
		 var sName='lwin_WindowReturn' + iLanguage;
		 lwin_WindowReturn = window.open(sURL, sName, sParam);
		 lwin_WindowReturn.resizeTo(iWidth,iHeight);
		}else{
			lwin_Window.resizeTo(iWidth,iHeight);
			lwin_Window.focus();
			lwin_WindowReturn=lwin_Window;
		}
		return lwin_WindowReturn;
	}
	//***********************************************************************
	// Function glf_close_popupwindow closes the right popup window
	//***********************************************************************
	function glf_close_popupwindow(lwin_Window){
		var lwin_WindowReturn;
		if (lwin_Window==null){
		}else{
			lwin_Window.close();
			//alert('close');
		}
		return true;
	}
	//******************************************************************
	//* This function checks if a form element has a specific substring
	//* in its name and if it is the case, it checks it (assuming it is 
	//* a checkbox !)
	//******************************************************************
	function f_SelectAll(str_Language) {
		for (var i=0; i< document.form_ResultsList.elements.length;i++){
			//alert(str_Language + ";" + document.form_ResultsList.elements[i].type + "; " +  document.form_ResultsList.elements[i].name.indexOf(str_Language) + "; " + document.form_ResultsList.elements[i].name);
			//alert(form_ResultsList.elements[i].type + ";" + form_ResultsList.elements[i].name);
			if (document.form_ResultsList.elements[i].type == "checkbox" && document.form_ResultsList.elements[i].name.indexOf(str_Language) >0){
				if ((str_Language == '\\t\\') || (str_Language == '\\q\\') ){
					if (document.form_ResultsList.selectAllE.checked){
						document.form_ResultsList.elements[i].checked =true;
					}else{
						document.form_ResultsList.elements[i].checked =false;
					}
				}
				if ((str_Language == '\\u\\') || (str_Language == '\\r\\')){
					if (document.form_ResultsList.selectAllF.checked){
						document.form_ResultsList.elements[i].checked =true;
					}else{
						document.form_ResultsList.elements[i].checked =false;
					}
				}
				if ((str_Language == '\\v\\') || (str_Language == '\\s\\')){
					if (document.form_ResultsList.selectAllS.checked){
						document.form_ResultsList.elements[i].checked =true;
					}else{
						document.form_ResultsList.elements[i].checked =false;
					}
				}
			}
		}
		return true;
	}
	//******************************************************************
	//* This function checks if a form element has a specific substring
	//* in its name and if it is the case, it checks it (assuming it is 
	//* a checkbox !)
	//******************************************************************
	function f_ClearAll(str_Language) {
		for (var i=0; i< document.form_ResultsList.elements.length;i++){						
			//alert(document.form_ResultsList.elements[i].type + ";" + document.form_ResultsList.elements[i].name + "; "  + document.form_ResultsList.elements[i].name.indexOf(str_Language));
			if (document.form_ResultsList.elements[i].type == "checkbox" && document.form_ResultsList.elements[i].name.indexOf(str_Language) >=0){
				document.form_ResultsList.elements[i].checked =false;
			}
		}
		return false;
	}
	//******************************************************************
	//* This function checks if a form element has a specific substring
	//* in its name and if it is the case, it checks it (assuming it is 
	//* a checkbox !)
	//******************************************************************
	function f_SubmitForm(str_Query) {
		//window.location="GEN_downloadFiles.asp?" + str_Query;
		var b1Checked;
		var iTotaltByte;
		var iAux;
		iAux=0;
		b1Checked = false;
		iTotaltByte = 0;
		if (document.form_ResultsList.OnlyResultsList.checked){
			document.form_ResultsList.action=document.form_ResultsList.actionFix.value + str_Query;
			document.form_ResultsList.submit();
			return false;
		}
		for (var i=0; i< document.form_ResultsList.elements.length;i++){						
			if (document.form_ResultsList.elements[i].type == "checkbox" && document.form_ResultsList.elements[i].name.indexOf('file;') >=0 && document.form_ResultsList.elements[i].checked){
				if (i<document.form_ResultsList.elements.length-1){
				  //alert(document.form_ResultsList.elements[i+1].name + '=' + document.form_ResultsList.elements[i+1].value);
				  if (document.form_ResultsList.elements[i+1].value != ''){
     		     iAux=parseInt(document.form_ResultsList.elements[i+1].value);
    			   iTotaltByte=iTotaltByte + iAux;
    	    }
				}
				b1Checked=true;
			}
		}
		if (!b1Checked){
			alert (lang_DOWNLOAD_CHECK_1_DOC_AT_LEAST);
			return false;
		}
		if (confirm('Your zipped file is around ' + Math.round(iTotaltByte/1024/4.7) + ' KB. Do you wish to proceed?'))
		{
			document.form_ResultsList.action=document.form_ResultsList.actionFix.value + str_Query;
			document.form_ResultsList.submit();
		}else{
			return false;
		}
		return false;
	}
	
	function f_actionOnResultListOnlyClick(){
		if (document.form_ResultsList.OnlyResultsList.checked){
				document.form_ResultsList.includelist.checked = true;
		}
	}
	
	function f_actionOnIncludeIndexClick(){
		if (!document.form_ResultsList.includelist.checked){
				document.form_ResultsList.OnlyResultsList.checked = false;
		}
	}

	//******************************************************************
	//* This function redirect a preprog search on the results page
	//* It is only used by the <select> items of the preprog searches.
	//******************************************************************
	function f_selectChangeYear(str_SelectName) {
		for (var i=0; i< document.form_Browse.elements.length;i++){						
			if (document.form_Browse.elements[i].name == str_SelectName){
				document.form_Browse.action='gen_searchResult.asp?rn=1&q1=' + document.form_Browse.elements[i].value;
				document.form_Browse.submit();
			}
		}
		return true;
	}



	//******************************************************************
	//* This function ask for confirmation of viewing if size>200kb
	//*	and if YES open the windowViewer
	//******************************************************************
	function f_CheckSizeBeforeViewing(str_FileSize, str_FilePath, str_Msge, iMaxFileSize) {
		if (isNaN(str_FileSize)||isNaN(iMaxFileSize)) return;
		if (parseInt(str_FileSize)>=parseInt(iMaxFileSize)){
			if (confirm(str_Msge + parseInt(str_FileSize/1024) + ' KB'))
			{
				window.open('GEN_viewerwindow.asp?'+str_FilePath, 'viewer', 'height=600,width=700,screenX=20,screenY=20,top=20,left=20,fullscreen=0,location=0, menubar=0, resizable=1, scrollbars=1, status=0, toolbar=0')
			}
		}else{
				window.open('GEN_viewerwindow.asp?'+str_FilePath, 'viewer', 'height=600,width=700,screenX=20,screenY=20,top=20,left=20,fullscreen=0,location=0, menubar=0, resizable=1, scrollbars=1, status=0, toolbar=0')
		}
	}
	//******************************************************************
	//* Samre as above for the IMRD version
	//******************************************************************
	function f_CheckSizeBeforeViewingImrd(str_FileSize, str_FilePath, str_Msge, iMaxFileSize) {
		if (isNaN(str_FileSize)||isNaN(iMaxFileSize)) return;
		if (parseInt(str_FileSize)>=parseInt(iMaxFileSize)){
			if (confirm(str_Msge + parseInt(str_FileSize/1024) + ' KB'))
			{
				window.open('../GEN_viewerwindow.asp?'+str_FilePath, 'viewer', 'height=600,width=700,screenX=20,screenY=20,top=20,left=20,fullscreen=0,location=0, menubar=0, resizable=1, scrollbars=1, status=0, toolbar=0')
			}
		}else{
				window.open('../GEN_viewerwindow.asp?'+str_FilePath, 'viewer', 'height=600,width=700,screenX=20,screenY=20,top=20,left=20,fullscreen=0,location=0, menubar=0, resizable=1, scrollbars=1, status=0, toolbar=0')
		}
	}
	function f_NoViewing(str_FileSize, str_FilePath, str_Msge, iMaxFileSize) {
		if (isNaN(str_FileSize)||isNaN(iMaxFileSize)) return;
		alert(str_Msge + parseInt(str_FileSize/1024) + ' KB')
	}

	//******************************************************************
	//* This function is used only for translators: if lang1 is checked then check lang2
	//******************************************************************
	function OnClickOriginalFormatCheckBox(pName, pLang){
	var lName;
	var lLang1;
	var lLang2;
	var lFldName;
	var lFound;
	var pLangAux;
	var lName2;
		lName = pName.toUpperCase();
		lFound = false;
		// Second Check Box
		if (pLang == "T") {
			lLang1="\\U\\";
			lLang2="\\V\\";
			pLangAux =/\\T\\/;
		}else{
			if (pLang == "U") {
				lLang1="\\T\\";
				lLang2="\\V\\";
				pLangAux =/\\U\\/;
			}else{
				if (pLang == "V") {
					lLang1="\\T\\";
					lLang2="\\U\\";
					pLangAux =/\\V\\/;
				}
			}
		} 	 
		// (Un)check second checkbox
		lName2 = lName.replace(pLangAux, lLang1);
		lName = lName2;
		for (var i=0; i< document.form_ResultsList.elements.length; i++) {
			lFldName = document.form_ResultsList.elements[i].name;
			lFldName = lFldName.toUpperCase();
			if (document.form_ResultsList.elements[i].type == "checkbox" && lFldName.indexOf(lName)>=0) {
				if (document.form_ResultsList.elements[i].checked) {
					document.form_ResultsList.elements[i].checked = false;
				}else{
					document.form_ResultsList.elements[i].checked = true;
				}
				lFound = true;
			}
		}
		if (lFound == false){
			lName = lName.replace(lLang1 , lLang2);
			for (var j=0; j< document.form_ResultsList.elements.length; j++) {
				lFldName = document.form_ResultsList.elements[j].name;
				lFldName = lFldName.toUpperCase();
				if (document.form_ResultsList.elements[j].type == "checkbox" && lFldName.indexOf(lName)>=0) {
			        	if (document.form_ResultsList.elements[j].checked) {
						document.form_ResultsList.elements[j].checked = false;
					}else{
						document.form_ResultsList.elements[j].checked = true;
					}
				}
			}
		}
	}
	//******************************************************************
	//* This function checks if a form element has a specific substring
	//* in its name and if it is the case, it checks it (assuming it is
	//* a checkbox !)
	//******************************************************************
	function f_SelectAllTrans(bChecked) {
		for (var i=0; i< document.form_ResultsList.elements.length;i++){
			if (document.form_ResultsList.elements[i].type == "checkbox" && document.form_ResultsList.elements[i].name.indexOf("file;") >=0){
					if (bChecked){
						document.form_ResultsList.elements[i].checked =true;
					}else{
						document.form_ResultsList.elements[i].checked =false;
					}
				}
		}
		return true;
	}

	//*****************************************************************************
	//* This function set the new value of request in case of multiple part result
	//*****************************************************************************
	function f_multiPartResult(sValue, iPartNum){
	    document.form_simpleSearch.q2.value = unescape(sValue.replace(/[+]/g," "));
	    document.form_simpleSearch.partNum.value = iPartNum;
	    document.form_simpleSearch.submit();
	}
	
	function b_openPopUp(s_url, s_name, s_params){
		eval("window.open('" + s_url + "','"+ s_name + "','"+ s_params + "')");
	}
	
	function changeLinkColor(id, label){
		window.status="";
		document.getElementById(id).style.color=document.vlinkColor;
	}
	
	function changeStatusBarLabel(label){ 
		window.status = label; 
		return true;
	} 
	
	function resetStatusBarLabel(){
		window.status=""; 
	} 
