
			dojo.require("dojo.lfx.*");
			dojo.require("dojo.event.*");
			dojo.require("dojo.dom");
			dojo.require("dojo.widget.*");
			dojo.require("dojo.widget.Tooltip");
			dojo.require("dojo.string.extras");
			dojo.require("dojo.widget.AnimatedPng");

			
		
			var numberOfTerms = 1;
			var numberOfPrefTerms = 1;
			var numberOfWithoutTerms = 1;
			var numberOfPrefWithoutTerms = 1;
			var numberOfLocationTerms = 1;
			var dlg1;
			var dlg2;
			var btn1;
			var lang;
			var langISO;
			var pageId;
			
			var labelPos;
			
			//var tradArray = new Array();
			
			
			/*
			var djConfig = {
			isDebug: true,
			debugContainerId : "dojoDebug"
			};
			*/


            function addTerm() {
				if (numberOfTerms == 1){
					var nodeToHide = dojo.byId('andOrLabel');
					nodeToHide.style.display = '';
				}

				numberOfTerms++;
				
				var insertPosition = dojo.byId("insert-term"); 	// where to insert
	
					
				//1
				var parentDiv = document.createElement("div");
				parentDiv.id = "term-" + numberOfTerms;
				parentDiv.className = "form-elem";
				
				//2
				var childNode = document.createElement("span");
				childNode.id = "insert-term-radio";
				parentDiv.appendChild(childNode)
				
				//2' (creaating the radio buttons) 
				if (dojo.render.html.ie){
					childNode = document.createElement("<INPUT TYPE='RADIO' id='term-" + numberOfTerms + "-radio' NAME='term-" + numberOfTerms + "-radio' VALUE='and' CLASS='radionInputClass-and' CHECKED='checked'>");
					parentDiv.appendChild(childNode);
					childNode = document.createElement("<INPUT TYPE='RADIO' id='term-" + numberOfTerms + "-radio' NAME='term-" + numberOfTerms + "-radio' VALUE='or' CLASS='radionInputClass-or'>");
					parentDiv.appendChild(childNode);
				}
				else{
					var objRadItem = document.createElement("input");
					objRadItem.type = "radio";
					objRadItem.name = "term-" + numberOfTerms + "-radio";
					objRadItem.id = "term-" + numberOfTerms + "-radio";
					objRadItem.value = "and";
					objRadItem.className = "radionInputClass-and";
					objRadItem.defaultChecked = true; 
					parentDiv.appendChild(objRadItem);
					var objRadItem2 = document.createElement("input");
					objRadItem2.type = "radio";
					objRadItem2.name = "term-" + numberOfTerms + "-radio";
					objRadItem2.id = "term-" + numberOfTerms + "-radio";
					objRadItem2.value = "or";
					objRadItem2.className = "radionInputClass-or";
					objRadItem2.defaultChecked = false;
					parentDiv.appendChild(objRadItem2);
				}
				
				//3
				//trying to create programaticaly the combobox widget
				var myComboBox = dojo.widget.createWidget("comboBox", { id: "text-term-" + numberOfTerms, name: "text-term-" + numberOfTerms, dataUrl: dojo.widget.byId('text-term-1').dataUrl, buttonSrc: "../../../fileadmin/dojo/combo_box_arrow.gif", style: "width:180px;", autoComplete: false, mode: "remote", maxListLength: "10", forceValidOption: false, searchDelay: "400"});
				//appending it to the parentNode
				parentDiv.appendChild(myComboBox.domNode);
				
				//4
				childNodeSpan = document.createElement("span");
				childNodeSpan.id = "span-term-" + numberOfTerms;
				parentDiv.appendChild(childNodeSpan)
				
				//5 and 6
				if (dojo.render.html.ie){
				//if (BrowserDetect.browser == "Explorer"){
					childNode = document.createElement("<A id='deleteTermLink' HREF='javascript:void(0);' onclick='deleteTerm(this);'>");
					childImg = document.createElement("<IMG ID='img-term-" + numberOfTerms + "' NAME='img-term-" + numberOfTerms + "' SRC='typo3conf/ext/ifpma_webservice/res/moins.gif'>");
					childNode.appendChild(childImg);
					parentDiv.appendChild(childNode);		
				}
				else{
					childNode = document.createElement("a");
					childNode.href = "javascript:void(0);";				
					childNode.id = "deleteTermLink";
					childNode.setAttribute('onclick', 'deleteTerm(this);')
					childImg = document.createElement("img");
					childImg.id = "img-term-" + numberOfTerms;
					childImg.src = "typo3conf/ext/ifpma_webservice/res/moins.gif";
					childNode.appendChild(childImg);
					parentDiv.appendChild(childNode);
				}
			
				childNodeSpan = document.createElement("span");
				childNodeSpan.innerHTML = '&nbsp;';
				parentDiv.appendChild(childNodeSpan)

				//8 (creating the synonym checkbox)
				if (dojo.render.html.ie){
				//if (BrowserDetect.browser == "Explorer"){
					childNode = document.createElement("<INPUT id='useSynonym-" + numberOfTerms + "' NAME='useSynonym-" + numberOfTerms + "' CLASS='MyAdvancedSearchCheckBoxClass2' VALUE='true' CHECKED='checked' TYPE='checkbox'>");
					parentDiv.appendChild(childNode);
				}			
				else{
					var objCheck = document.createElement("input");
						objCheck.type = "checkbox";
						objCheck.name = "useSynonym-" + numberOfTerms;
						objCheck.id = "useSynonym-" + numberOfTerms;
						objCheck.value = "true";
						objCheck.className = "MyAdvancedSearchCheckBoxClass2";
						objCheck.defaultChecked = true; 
					parentDiv.appendChild(objCheck);
				}
				
				//inserting the subtree inside the main DOM
				//dojo.lfx.html.wipeIn(parentDiv, 500).play(); // effect below	
				dojo.dom.insertBefore(parentDiv, insertPosition);
				
				//creating the tooltip: must be executed AFTER its parent node has been inserted!
				var myHref = dojo.byId('add-term-tooltip').getAttribute("href");
				myHref = myHref.replace("addTermHelp.html","deleteTermHelp.html")
				var myTooltip = dojo.widget.createWidget('tooltip', 
				{
				connectId:'img-term-' + numberOfTerms, 
				href:myHref
				});
				myTooltip.domNode.className = "tooltip";
				parentDiv = dojo.byId("term-" + numberOfTerms); 
				parentDiv.appendChild(myTooltip.domNode);
				dojo.dom.insertBefore(parentDiv, insertPosition);
	
			}
			
			
			function addTermWithParam(withTerms, withoutTerms, locationTerms, andOr, synonymList ) {
				initTerms();
				//alert(andOr);
			    var myArray = withTerms.split('|');
				var andOrArray = andOr.split('|');
				var synonymArray = synonymList.split('|');
				
				var myFirstComboBox = dojo.widget.byId("text-term-1");
				
				
				if (dojo.render.html.ie){
					var tempNode = dojo.dom.getNextSiblingElement(dojo.byId('insert-term-radio'));
					tempNode2 = dojo.dom.getFirstChildElement(tempNode);
					tempNode = dojo.dom.getNextSiblingElement(tempNode2);
					tempNode = dojo.dom.getNextSiblingElement(tempNode);
					tempNode.value = myArray[0];
					tempNode2.value = myArray[0];
					myFirstComboBox.setValue(myArray[0]);
				}
				else{
					myFirstComboBox.setValue(myArray[0]);					
				}
				
				//setting the first synonym checkbox
				if (withTerms){
					if (synonymArray[0] == 'true' || synonymArray[0] == 'on'){
						dojo.byId('useSynonym-1').checked = "checked";
					}
					else{
						dojo.byId('useSynonym-1').checked = "";
					}
				}


				// the other text inputs
				for (count = 1; count < myArray.length; count++){
					//incrementing the number of terms
					numberOfTerms++;
					
					//displaying the And / Or label
					if (numberOfTerms == 2){
						var nodeToHide = dojo.byId('andOrLabel');
						nodeToHide.style.display = '';
					}
					
					
					//where to insert
					var insertPosition = dojo.byId("insert-term");
							
						//1
						var parentDiv = document.createElement("div");
						parentDiv.id = "term-" + numberOfTerms;
						parentDiv.className = "form-elem";
						
						//2
						var childNode = document.createElement("span");
						childNode.id = "insert-term-radio";
						parentDiv.appendChild(childNode)
						
						//check if AND or OR
						
						if (dojo.render.html.ie){
							if (andOrArray[count-1] == 'and'){
							childNode = document.createElement("<INPUT TYPE='RADIO' id='term-" + numberOfTerms + "-radio' NAME='term-" + numberOfTerms + "-radio' VALUE='and' CLASS='radionInputClass-and' CHECKED='checked'>");
							}
							else{
							childNode = document.createElement("<INPUT TYPE='RADIO' id='term-" + numberOfTerms + "-radio' NAME='term-" + numberOfTerms + "-radio' VALUE='and' CLASS='radionInputClass-and'>");
							}
							parentDiv.appendChild(childNode);
							if (andOrArray[count-1] == 'or'){
							childNode = document.createElement("<INPUT TYPE='RADIO' id='term-" + numberOfTerms + "-radio' NAME='term-" + numberOfTerms + "-radio' VALUE='or' CLASS='radionInputClass-or' CHECKED='checked'>");
							}
							else{
							childNode = document.createElement("<INPUT TYPE='RADIO' id='term-" + numberOfTerms + "-radio' NAME='term-" + numberOfTerms + "-radio' VALUE='or' CLASS='radionInputClass-or'>");
							}
							parentDiv.appendChild(childNode);
						}
						else{
							//2' (creaating the radio buttons) 
							//var radioTrimed;
							var objRadItem = document.createElement("input");
							objRadItem.type = "radio";
							objRadItem.name = "term-" + numberOfTerms + "-radio";
							objRadItem.id = "term-" + numberOfTerms + "-radio";
							objRadItem.value = "and";
							objRadItem.className = "radionInputClass-and";
							
							// A DEBUGER LAL [ BEGIN ]
							andOrArray[count-1] = rtrim(andOrArray[count-1]);
							andOrArray[count-1] = ltrim(andOrArray[count-1]);
							// A DEBUGER LAL [ END ]
							
							if (andOrArray[count-1] == 'and'){
								objRadItem.defaultChecked = true; 
							}
							parentDiv.appendChild(objRadItem);
							var objRadItem2 = document.createElement("input");
							objRadItem2.type = "radio";
							objRadItem2.name = "term-" + numberOfTerms + "-radio";
							objRadItem2.id = "term-" + numberOfTerms + "-radio";
							objRadItem2.value = "or";
							objRadItem2.className = "radionInputClass-or";
							if (andOrArray[count-1] == 'or'){
								objRadItem2.defaultChecked = true; 
							}							
							parentDiv.appendChild(objRadItem2);
						}
						
						//3
						//trying to create programaticaly the combobox widget
						var myComboBox = dojo.widget.createWidget("comboBox", { id: "text-term-" + numberOfTerms, name: "text-term-" + numberOfTerms, dataUrl: dojo.widget.byId('text-term-1').dataUrl, buttonSrc: "../../../fileadmin/dojo/combo_box_arrow.gif", style: "width:180px;", autoComplete: false, mode: "remote", maxListLength: "10", forceValidOption: false, searchDelay: "400"});
						//initialising the value with the read value
						myComboBox.setValue(myArray[count]);
						//appending it to the parentNode
						parentDiv.appendChild(myComboBox.domNode);
						
						//4
						childNode = document.createElement("span");
						childNode.id = "span-term-" + numberOfTerms;
						parentDiv.appendChild(childNode)
						
						//5 and 6
						if (dojo.render.html.ie){
							childNode = document.createElement("<A id='deleteTermLink' HREF='javascript:void(0);' onclick='deleteTerm(this);'>");
							childImg = document.createElement("<IMG ID='img-term-" + numberOfTerms + "' NAME='img-term-" + numberOfTerms + "' SRC='typo3conf/ext/ifpma_webservice/res/moins.gif'>");
							childNode.appendChild(childImg);
							parentDiv.appendChild(childNode);		
						}
						else{
							childNode = document.createElement("a");
							childNode.href = "javascript:void(0);";		
							childNode.id = "deleteTermLink";
							childNode.setAttribute('onclick', 'deleteTerm(this);')
							childImg = document.createElement("img");
							childImg.id = "img-term-" + numberOfTerms;
							childImg.src = "typo3conf/ext/ifpma_webservice/res/moins.gif";
							childNode.appendChild(childImg);
							parentDiv.appendChild(childNode);
						}
						
						childNodeSpan = document.createElement("span");
						childNodeSpan.innerHTML = '&nbsp;';
						parentDiv.appendChild(childNodeSpan)
						
						
						//8 (creating the synonym checkbox)
						if (dojo.render.html.ie){
							if (synonymArray[count] == 'true' || synonymArray[count] == 'on'){
								childNode = document.createElement("<INPUT id='useSynonym-" + numberOfTerms + "' NAME='useSynonym-" + numberOfTerms + "' CLASS='MyAdvancedSearchCheckBoxClass2' VALUE='true' CHECKED='checked' TYPE='checkbox'>");
							}
							else{
								childNode = document.createElement("<INPUT id='useSynonym-" + numberOfTerms + "' NAME='useSynonym-" + numberOfTerms + "' CLASS='MyAdvancedSearchCheckBoxClass2' VALUE='true' TYPE='checkbox'>");
							}
							parentDiv.appendChild(childNode);
						}
						else{
							var objCheck = document.createElement("input");
								objCheck.type = "checkbox";
								objCheck.name = "useSynonym-" + numberOfTerms;
								objCheck.id = "useSynonym-" + numberOfTerms;
								objCheck.value = "true";
								if (synonymArray[count] == 'true' || synonymArray[count] == 'on'){
									objCheck.checked = "checked";
								}
								else{
									objCheck.checked = "";
								}
								objCheck.className = "MyAdvancedSearchCheckBoxClass2";
								objCheck.defaultChecked = true; 
							parentDiv.appendChild(objCheck);
						}						
						
						//inserting the subtree inside the main DOM
						dojo.dom.insertBefore(parentDiv, insertPosition);
						
						//creating the tooltip: must be executed AFTER its parent node has been inserted!
						var myHref = dojo.byId('add-term-tooltip').getAttribute("href");
						myHref = myHref.replace("addTermHelp.html","deleteTermHelp.html")
						var myTooltip = dojo.widget.createWidget('tooltip', 
						{
						connectId:'img-term-' + numberOfTerms, 
						href:myHref
						});
						myTooltip.domNode.className = "tooltip";
						parentDiv = dojo.byId("term-" + numberOfTerms); 
						parentDiv.appendChild(myTooltip.domNode);
						dojo.dom.insertBefore(parentDiv, insertPosition);
	
				
				}//end for


				var myArray = withoutTerms.split('|');
				
				//the first text input
				if (dojo.render.html.ie){
					/*
					tempNode = dojo.dom.getFirstChildElement(dojo.byId('without-term-1'));
					tempNode = dojo.dom.getFirstChildElement(tempNode);
					tempNode = dojo.dom.getNextSiblingElement(tempNode);
					tempNode = dojo.dom.getNextSiblingElement(tempNode);
					tempNode.value = myArray[0];
					dojo.widget.byId("text-without-term-1").setValue(myArray[0]);
					*/
					
					tempNode = dojo.dom.getFirstChildElement(dojo.byId('without-term-1'));
					tempNode2 = dojo.dom.getFirstChildElement(tempNode);
					tempNode = dojo.dom.getNextSiblingElement(tempNode2);
					tempNode = dojo.dom.getNextSiblingElement(tempNode);
					tempNode.value = myArray[0];
					tempNode2.value = myArray[0];
					dojo.widget.byId("text-without-term-1").setValue(myArray[0]);
					
				}
				else{
					dojo.widget.byId("text-without-term-1").setValue(myArray[0]);
				}
				
				
				/*
				var myFirstComboBox = dojo.widget.byId("text-term-1");
				if (dojo.render.html.ie){
					var tempNode = dojo.dom.getNextSiblingElement(dojo.byId('insert-term-radio'));
					tempNode2 = dojo.dom.getFirstChildElement(tempNode);
					tempNode = dojo.dom.getNextSiblingElement(tempNode2);
					tempNode = dojo.dom.getNextSiblingElement(tempNode);
					tempNode.value = myArray[0];
					tempNode2.value = myArray[0];
					myFirstComboBox.setValue(myArray[0]);
				}
				else{
					myFirstComboBox.setValue(myArray[0]);
				}
				*/
				
				
						
				for (count = 1; count < myArray.length; count++){
					//incrementing the number of terms
					numberOfWithoutTerms++;
					// where to insert
					var insertPosition = dojo.byId("insert-without-term"); 
									
						//1
						var parentDiv = document.createElement("div");
						parentDiv.id = "without-term-" + numberOfWithoutTerms;
						parentDiv.className = "form-elem";
						
						//2
						var childNode = document.createElement("span");
						childNode.id = "insert-term-radio";
						parentDiv.appendChild(childNode)
						
						//3
						//trying to create programaticaly the combobox widget
						var myComboBox = dojo.widget.createWidget("comboBox", { id: "text-without-term-" + numberOfWithoutTerms, name: "text-without-term-" + numberOfWithoutTerms, dataUrl: dojo.widget.byId('text-term-1').dataUrl, buttonSrc: "../../../fileadmin/dojo/combo_box_arrow.gif", style: "width:180px;", autoComplete: false, mode: "remote", maxListLength: "10", forceValidOption: false, searchDelay: "400"});
						//initialising the value with the read value
						myComboBox.setValue(myArray[count]);
						//appending it to the parentNode
						parentDiv.appendChild(myComboBox.domNode);
						
						//4
						childNode = document.createElement("span");
						childNode.id = "span-term-" + numberOfWithoutTerms;
						parentDiv.appendChild(childNode)
						
						//5 and 6
						if (dojo.render.html.ie){
						//if (BrowserDetect.browser == "Explorer"){
							childNode = document.createElement("<A id='deleteTermLink' HREF='javascript:void(0);' onclick='deleteTerm(this);'>");
							childImg = document.createElement("<IMG ID='img-without-term-" + numberOfWithoutTerms + "' NAME='img-without-term-" + numberOfWithoutTerms + "' SRC='typo3conf/ext/ifpma_webservice/res/moins.gif'>");
							childNode.appendChild(childImg);
							parentDiv.appendChild(childNode);		
						}
						else{
							childNode = document.createElement("a");
							childNode.href = "javascript:void(0);";	
							childNode.id ="deleteTermLink";
							childNode.setAttribute('onclick', 'deleteTerm(this);')
							childImg = document.createElement("img");
							childImg.id = "img-without-term-" + numberOfWithoutTerms;
							childImg.src = "typo3conf/ext/ifpma_webservice/res/moins.gif";
							childNode.appendChild(childImg);
							parentDiv.appendChild(childNode);
						}
						
						/*
						//7 (creating the tooltip)
						var myTooltip = dojo.widget.createWidget("tooltip", { id: "img-term-tooltip-" + numberOfTerms, name: "img-term-tooltip-" + numberOfTerms, href: "typo3conf/ext/ifpma_webservice/res/deleteTermHelp.html", connectId: "img-term-" + numberOfTerms});
						//appending it to the parentNode
						parentDiv.appendChild(myTooltip.domNode);
						*/	
						
						//inserting the subtree inside the main DOM
						dojo.dom.insertBefore(parentDiv, insertPosition);
						
						//creating the tooltip: must be executed AFTER its parent node has been inserted!
						var myHref = dojo.byId('add-without-term-tooltip').getAttribute("href");
						myHref = myHref.replace("addTermHelp.html","deleteTermHelp.html")				
						var myTooltip = dojo.widget.createWidget('tooltip', 
						{
						connectId:'img-without-term-' + numberOfWithoutTerms, 
						href:myHref
						});
						myTooltip.domNode.className = "tooltip";
						parentDiv = dojo.byId("without-term-" + numberOfWithoutTerms); 
						parentDiv.appendChild(myTooltip.domNode);
						dojo.dom.insertBefore(parentDiv, insertPosition);

	
				} //end for without
				

				var myArray = locationTerms.split('|');
				//the first text input
				dojo.byId("text-location-term-1").value = myArray[0];
				
				for (count = 1; count < myArray.length; count++){					
					numberOfLocationTerms++;
					var insertPosition = dojo.byId("insert-location-term"); 	// where to insert
							
					//1
					var parentDiv = document.createElement("div");
					parentDiv.id = "location-term-" + numberOfLocationTerms;
					parentDiv.className = "form-elem";
					
					//2
					var childNode = document.createElement("span");
					childNode.id = "insert-term-radio";
					parentDiv.appendChild(childNode)
					
					//3
					childNode = document.createElement("input");
					childNode.type = "text";
					childNode.id = "text-location-term-" + numberOfLocationTerms;
					childNode.name = "text-location-term-" + numberOfLocationTerms;
					childNode.className = "MyAdvancedSearchInputClass";
					childNode.value = myArray[count];
					parentDiv.appendChild(childNode)
					
					//4
					childNode = document.createElement("span");
					childNode.id = "span-term-" + numberOfLocationTerms;
					parentDiv.appendChild(childNode)
					
					//5 and 6
					if (dojo.render.html.ie){
						childNode = document.createElement("<A id='deleteTermLink' HREF='javascript:void(0);' onclick='deleteTerm(this);'>");
						childImg = document.createElement("<IMG ID='img-location-term-" + numberOfLocationTerms + "' NAME='img-location-term-" + numberOfLocationTerms + "' SRC='typo3conf/ext/ifpma_webservice/res/moins.gif'>");
						childNode.appendChild(childImg);
						parentDiv.appendChild(childNode);		
					}
					else{
						childNode = document.createElement("a");
						childNode.href = "javascript:void(0);";
						childNode.id = "deleteTermLink";
						childNode.setAttribute('onclick', 'deleteTerm(this);')
						childImg = document.createElement("img");
						childImg.id = "img-location-term-" + numberOfLocationTerms;
						childImg.src = "typo3conf/ext/ifpma_webservice/res/moins.gif";
						childNode.appendChild(childImg);
						parentDiv.appendChild(childNode);
					}
					
					//inserting the subtree inside the main DOM
					dojo.dom.insertBefore(parentDiv, insertPosition);
					
					//creating the tooltip: must be executed AFTER its parent node has been inserted!
					var myHref = dojo.byId('add-location-term-tooltip').getAttribute("href");
					myHref = myHref.replace("addTermHelp.html","deleteTermHelp.html")				
					var myTooltip = dojo.widget.createWidget('tooltip', 
					{
					connectId:'img-location-term-' + numberOfLocationTerms, 
					href:myHref
					});
					myTooltip.domNode.className = "tooltip";
					parentDiv = dojo.byId("location-term-" + numberOfLocationTerms); 
					parentDiv.appendChild(myTooltip.domNode);
					dojo.dom.insertBefore(parentDiv, insertPosition);

				} //end for
			} //end addTermWithParam
			
			
			
			function deleteTerm(ident) {
				
				//var deleteNode = ident.parentNode.parentNode;
				var deleteNode = ident.parentNode;
				if (deleteNode.id != 'term-1' && deleteNode.id != 'without-term-1' && deleteNode.id != 'location-term-1' )
				{
				dojo.lfx.html.wipeOut(deleteNode, 500).play(); // effect below				
				dojo.dom.removeChildren(deleteNode);
				}
				
				//dojo.dom.removeNode(dojo.byId("term-"+i), true);
				
				//adjusting the number of terms, withoutTerms and locationTerms
				strInput = deleteNode.id;
				if (strInput.search(/without-term-/) != -1){					
					//numberOfWithoutTerms--;
				}
				else if (strInput.search(/location-term-/) != -1){					
					//numberOfLocationTerms--;
				}
				else{
					
					//numberOfTerms--;
				}
				
				if (numberOfTerms == '1'){
					var nodeToHide = dojo.byId('andOrLabel');
					nodeToHide.style.display = 'none';
				}
				
			}
			
			
			function initSaveInAvailableSlotButton() {
				var myWidget = dojo.widget.byId('save');
				//dojo.event.connect(myWidget, "onClick", modifSaveAQuery);
				//myWidget.setCaption('Save in next available slot')
				
				myWidget.setCaption(tradArray[20]);
				
			}
			
	
	
			function initTerms() {
								
				//initSaveInAvailableSlotButton();
				dojo.addOnLoad(initSaveInAvailableSlotButton);		
				
				//reinitialising the counters
				numberOfTerms = 1;
				numberOfWithoutTerms = 1;
				numberOfLocationTerms = 1;
				
				var nodeToHide = dojo.byId('andOrLabel');
				nodeToHide.style.display = 'none';

				
				//deleting all the term-n divs
				var i = 2;
				while (dojo.byId("term-"+i) != null){	
						dojo.dom.removeNode(dojo.byId("term-"+i), true);
						dojo.widget.byId('text-term-'+i).setValue('');
						i++;
					}

					
				//deleting all the without-term-n divs
				i = 2;
				while (dojo.byId("without-term-"+i) != null){	
						dojo.dom.removeNode(dojo.byId("without-term-"+i), true);
						i++;
					}
				
				//deleting all the location-term-n divs
				i = 2;
				while (dojo.byId("location-term-"+i) != null){	
						dojo.dom.removeNode(dojo.byId("location-term-"+i), true);
						i++;
					}
				
				if (dojo.render.html.ie){
					var tempNode = dojo.dom.getNextSiblingElement(dojo.byId('insert-term-radio'));
					tempNode = dojo.dom.getFirstChildElement(tempNode);
					tempNode = dojo.dom.getNextSiblingElement(tempNode);
					tempNode = dojo.dom.getNextSiblingElement(tempNode);
					tempNode.value = '';
					
					tempNode = dojo.dom.getFirstChildElement(dojo.byId('without-term-1'));
					tempNode = dojo.dom.getFirstChildElement(tempNode);
					tempNode = dojo.dom.getNextSiblingElement(tempNode);
					tempNode = dojo.dom.getNextSiblingElement(tempNode);
					tempNode.value = '';	
				}
				else{
					dojo.widget.byId('text-term-1').setValue('');
					dojo.widget.byId('text-without-term-1').setValue('');
				}

				dojo.byId('text-location-term-1').value = '';
				
					
			} //end initTerms
			

			
			
			function addWithoutTerm() {
			
				var insertPosition = dojo.byId("insert-without-term");
				numberOfWithoutTerms++; // adding one more term			

										
				//1
				var parentDiv = document.createElement("div");
				parentDiv.id = "without-term-" + numberOfWithoutTerms;
				parentDiv.className = "form-elem";
				
				//2
				var childNode = document.createElement("span");
				childNode.id = "insert-term-radio";
				parentDiv.appendChild(childNode)
				
				//3
				//trying to create programaticaly the combobox widget
				var myComboBox = dojo.widget.createWidget("comboBox", { id: "text-without-term-" + numberOfWithoutTerms, name: "text-without-term-" + numberOfWithoutTerms, dataUrl: dojo.widget.byId('text-term-1').dataUrl, buttonSrc: "../../../fileadmin/dojo/combo_box_arrow.gif", style: "width:180px;", autoComplete: false, mode: "remote", maxListLength: "10", forceValidOption: false, searchDelay: "400"});
				//appending it to the parentNode
				parentDiv.appendChild(myComboBox.domNode);
				
				//4
				childNode = document.createElement("span");
				childNode.id = "span-term-" + numberOfWithoutTerms;
				parentDiv.appendChild(childNode)
				
				
				//5 and 6
				if (dojo.render.html.ie){
					childNode = document.createElement("<A id='deleteTermLink' HREF='javascript:void(0);' onclick='deleteTerm(this);'>");
					childImg = document.createElement("<IMG ID='img-without-term-" + numberOfWithoutTerms + "' NAME='img-without-term-" + numberOfWithoutTerms + "' SRC='typo3conf/ext/ifpma_webservice/res/moins.gif'>");
					childNode.appendChild(childImg);
					parentDiv.appendChild(childNode);		
				}
				else{
					childNode = document.createElement("a");
					childNode.href = "javascript:void(0);";
					childNode.id = "deleteTermLink";
					childNode.setAttribute('onclick', 'deleteTerm(this);')
					childImg = document.createElement("img");
					childImg.id = "img-without-term-" + numberOfWithoutTerms;
					childImg.src = "typo3conf/ext/ifpma_webservice/res/moins.gif";
					childNode.appendChild(childImg);
					parentDiv.appendChild(childNode);
				}
				
								
				//inserting the subtree inside the main DOM
				//dojo.lfx.html.wipeOut(parentDiv, 500).play(); // effect below	
				dojo.dom.insertBefore(parentDiv, insertPosition);
				
				var myHref = dojo.byId('add-without-term-tooltip').getAttribute("href");
				myHref = myHref.replace("addTermHelp.html","deleteTermHelp.html")				
				//creating the tooltip: must be executed AFTER its parent node has been inserted!
				var myTooltip = dojo.widget.createWidget('tooltip', 
				{
				connectId:'img-without-term-' + numberOfWithoutTerms, 
				href:myHref
				});
				myTooltip.domNode.className = "tooltip";
				parentDiv = dojo.byId("without-term-" + numberOfWithoutTerms); 
				parentDiv.appendChild(myTooltip.domNode);
				dojo.dom.insertBefore(parentDiv, insertPosition);


	
			} //end add without term

			

			
			function addLocationTerm() {
				var insertPosition = dojo.byId("insert-location-term");
				
				numberOfLocationTerms++; // adding one more term
						
				//1
				var parentDiv = document.createElement("div");
				parentDiv.id = "location-term-" + numberOfLocationTerms;
				parentDiv.className = "form-elem";
				
				//2
				var childNode = document.createElement("span");
				childNode.id = "insert-term-radio";
				parentDiv.appendChild(childNode)
				
				//3
				if (dojo.render.html.ie){
					childNode = document.createElement("<INPUT TYPE='TEXT' id='text-location-term-" + numberOfLocationTerms + "' NAME='text-location-term-" + numberOfLocationTerms + "' VALUE='' SIZE='40' CLASS='MyAdvancedSearchInputClass'>");
					parentDiv.appendChild(childNode);
				}
				else{
					childNode = document.createElement("input");
					childNode.type = "text";
					childNode.id = "text-location-term-" + numberOfLocationTerms;
					childNode.name = "text-location-term-" + numberOfLocationTerms;
					childNode.value = "";
					childNode.className = "MyAdvancedSearchInputClass";
					childNode.size="40";
					parentDiv.appendChild(childNode)
				}
				
				//4
				childNode = document.createElement("span");
				childNode.id = "span-term-" + numberOfLocationTerms;
				parentDiv.appendChild(childNode)
				
				//5 and 6
				if (dojo.render.html.ie){
					childNode = document.createElement("<A id='deleteTermLink' HREF='javascript:void(0);' onclick='deleteTerm(this);'>");
					childImg = document.createElement("<IMG ID='img-location-term-" + numberOfLocationTerms + "' NAME='img-location-term-" + numberOfLocationTerms + "' SRC='typo3conf/ext/ifpma_webservice/res/moins.gif'>");
					childNode.appendChild(childImg);
					parentDiv.appendChild(childNode);		
				}
				else{
					childNode = document.createElement("a");
					childNode.href = "javascript:void(0);";
					childNode.id ="deleteTermLink";
					childNode.setAttribute('onclick', 'deleteTerm(this);')
					childImg = document.createElement("img");
					childImg.id = "img-location-term-" + numberOfLocationTerms;
					childImg.src = "typo3conf/ext/ifpma_webservice/res/moins.gif";
					childNode.appendChild(childImg);
					parentDiv.appendChild(childNode);
				}
				
				
				//inserting the subtree inside the main DOM
				dojo.dom.insertBefore(parentDiv, insertPosition);
				
				var myHref = dojo.byId('add-location-term-tooltip').getAttribute("href");
				myHref = myHref.replace("addTermHelp.html","deleteTermHelp.html")				
				//creating the tooltip: must be executed AFTER its parent node has been inserted!
				var myTooltip = dojo.widget.createWidget('tooltip', 
				{
				connectId:'img-location-term-' + numberOfLocationTerms, 
				href:myHref
				});
				myTooltip.domNode.className = "tooltip";
				parentDiv = dojo.byId("location-term-" + numberOfLocationTerms); 
				parentDiv.appendChild(myTooltip.domNode);
				dojo.dom.insertBefore(parentDiv, insertPosition);

			}
			
			
			
			function dumpData( type, data, evt ) {
			    var msg = "Data dump:\n" + data;
			    alert( msg );
			}
			
			
			function SaveAQueryFormCallback( type, data, evt ) {
				//alert(data);
				//deleteInStandby();
				myArray = data.split("|");
				if (myArray[2].charAt(0) != '-'){
					myArray[2] = myArray[2].charAt(0);
				}
				else{
					myArray[2] = myArray[2].charAt(0) + myArray[2].charAt(1);
				}
				//alert(myArray[2]);
				
				if (myArray[2] == -1){
					dojo.widget.byId("dlg1").setContent(
					'<div class="boxInfoTop">'+tradArray[21]+'</div>'
					+'<div class="boxInfoBody">'
					+tradArray[6]+'<br/>'
					+'<div class="btGris">'
					+'<div class="btGrisLeft"></div>'
					+'<div class="btGrisRight"><a id="hiderA" style="cursor:pointer;" tabindex="1">'+tradArray[36]+'</a></div>'
					+'</div>'
					+'</div>'
					+'<div class="boxInfoBottom"/>'
					);
					
					btn1 = document.getElementById("hiderA");
					btn1 = dojo.byId("hiderA");
					dlg1.setCloseControl(btn1);
					dlg1.show();
					
				}
				if (myArray[2] == 1){
					
					//the query has been saved
					dojo.widget.byId("dlg1").setContent(
					'<div class="boxInfoTop">'+tradArray[22]+'</div>'
					+'<div class="boxInfoBody">'
					+tradArray[7]+' '+myArray[0]+' '+tradArray[8]+'<br/>'
					+'<div class="btGris">'
					+'<div class="btGrisLeft"></div>'
					+'<div class="btGrisRight"><a id="hiderB" style="cursor:pointer;" tabindex="1">'+tradArray[36]+'</a></div>'
					+'</div>'
					+'</div>'
					+'<div class="boxInfoBottom"/>'
					);
					
					//setting the right input box background color
					if (pageId == '42'){
						adjustBGColor('#B19D70');
					}
					else if(pageId == '44'){
						adjustBGColor('#B19D70');
					}
					else if(pageId == '76'){
						adjustBGColor('#A3C3EE');
					}
					else{
						adjustBGColor('#A3C3EE');
					}					

					dojo.byId('Input' + myArray[0]).value = myArray[1];
					
					//doit ?tre modifi? afin de mettre ? jour le label 'activate email alert'
					//document.getElementById('Input'+myArray[0]).style.background = boxColor;
					
					btn1 = document.getElementById("hiderB");
					dlg1.setCloseControl(btn1);
					dlg1.show();
				}
				if (myArray[2] == -2){		
					dojo.widget.byId("dlg1").setContent(
					'<div class="boxInfoTop">'+tradArray[23]+'</div>'
					+'<div class="boxInfoBody">'
					+tradArray[9]+' '+ myArray[0] +' '+ tradArray[10] +'<br/>'
					+'<div class="btGris">'
					+'<div class="btGrisLeft"></div>'
					+'<div class="btGrisRight"><a id="confirm" style="cursor:pointer;" onClick="asyncCallToSaveAQuery('+ myArray[0] +', 1, 0)">'+tradArray[36]+'</a></div>'
					+'<div class="btGrisLeft"></div>'
					+'<div class="btGrisRight"><a id="hiderC" style="cursor:pointer;">'+tradArray[37]+'</a></div>'
					+'</div>'
					+'</div>'
					+'<div class="boxInfoBottom"/>'
					);
					
					btn1 = document.getElementById("hiderC");
					dlg1.setCloseControl(btn1);
					dlg1.show();			
				}
				
				
				if (myArray[2] == -3){
					dojo.widget.byId("dlg1").setContent(
					'<div class="boxInfoTop">'+tradArray[24]+'</div>'
					+'<div class="boxInfoBody">'
					+tradArray[11]+'<br/>'
					+'<div class="btGris">'
					+'<div class="btGrisLeft"></div>'
					+'<div class="btGrisRight"><a id="hiderD" style="cursor:pointer;" tabindex="1">'+tradArray[36]+'</a></div>'
					+'</div>'
					+'</div>'
					+'<div class="boxInfoBottom"/>'
					);
					btn1 = document.getElementById("hiderD");
					dlg1.setCloseControl(btn1);
					dlg1.show();
				}
				
				//writing back the form action string and method
				dojo.byId('webServiceForm').action = dojo.byId('actionStrBuffer').value;
				dojo.byId('webServiceForm').method = 'post';
				
				//setting back the caption of the savebutton
				initSaveInAvailableSlotButton();				
				
			}
			
			
			function DeleteAQueryFormCallback( type, data, evt ) {				
				
				myArray = data.split("|");
				
				if (myArray[1] == -1){

					dojo.widget.byId("dlg1").setContent(
					'<div class="boxInfoTop">'+tradArray[25]+'</div>'
					+'<div class="boxInfoBody">'
					+tradArray[0]+' '+myArray[0]+' '+tradArray[12]+'<br/>'
					+'<div class="btGris">'
					+'<div class="btGrisLeft"></div>'
					+'<div class="btGrisRight"><a id="hiderE" style="cursor:pointer;" tabindex="1">'+tradArray[36]+'</a></div>'
					+'</div>'
					+'</div>'
					+'<div class="boxInfoBottom"/>'
					);

					btn1 = document.getElementById("hiderE");
					dlg1.setCloseControl(btn1);
					dlg1.show();
				}
				
				if (myArray[1] == 1){
					dojo.widget.byId("dlg1").setContent(
					'<div class="boxInfoTop">'+tradArray[26]+'</div>'
					+'<div class="boxInfoBody">'
					+ tradArray[13] + ' ' + myArray[0] + ' ' + tradArray[14] +'<br/>'
					+'<div class="btGris">'
					+'<div class="btGrisLeft"></div>'
					+'<div class="btGrisRight"><a id="hiderF" style="cursor:pointer;" tabindex="1">'+tradArray[36]+'</a></div>'
					+'</div>'
					+'</div>'
					+'<div class="boxInfoBottom"/>'
					);

					dojo.byId('Input' + myArray[0]).value = "";
					
					adjustBGColor('#FFFFFF');
					
					btn1 = document.getElementById("hiderF");
					dlg1.setCloseControl(btn1);
					dlg1.show();
				}
				
					if (myArray[1] == 2){
					
					dojo.widget.byId("dlg1").setContent(
					'<div class="boxInfoTop">'+tradArray[27]+'</div>'
					+'<div class="boxInfoBody">'
					+ tradArray[0] + ' ' + myArray[0] + ' ' + tradArray[15] +'<br/>'
					+'<div class="btGris">'
					+'<div class="btGrisLeft"></div>'
					+'<div class="btGrisRight"><a id="confirm" style="cursor:pointer;" onClick="asyncCallToDeleteAQuery('+ myArray[0] +', 1)">'+tradArray[36]+'</a></div>'
					+'<div class="btGrisLeft"></div>'
					+'<div class="btGrisRight"><a id="hiderXX" style="cursor:pointer;">'+tradArray[37]+'</a></div>'
					+'</div>'
					+'</div>'
					+'<div class="boxInfoBottom"/>'
					);

					btn1 = document.getElementById("hiderXX");
					dlg1.setCloseControl(btn1);
					dlg1.show();
				}	
				
				
				//writing back the form action string and method
				dojo.byId('webServiceForm_pi2').action = dojo.byId('actionStrBuffer').value;
				dojo.byId('webServiceForm_pi2').method = 'post';			
				
				//setting back the caption of the savebutton
				initSaveInAvailableSlotButton();
				//dojo.widget.byId('save').setCaption('Save in next available slot');
				
			}
			
			
			function AlertAQueryFormCallback( type, data, evt ) {
				myArray = data.split("|");
				if (myArray[2] == -1){
					dojo.widget.byId("dlg1").setContent(
					'<div class="boxInfoTop">'+tradArray[28]+'</div>'
					+'<div class="boxInfoBody">'
					+tradArray[0] +' '+ myArray[0] +' '+tradArray[1] + '<br/>'
					+'<div class="btGris">'
					+'<div class="btGrisLeft"></div>'
					+'<div class="btGrisRight"><a id="hiderG" style="cursor:pointer;" tabindex="1">'+tradArray[36]+'</a></div>'
					+'</div>'
					+'</div>'
					+'<div class="boxInfoBottom"/>'
					);
					
					btn1 = document.getElementById("hiderG");
					dlg1.setCloseControl(btn1);
					dlg1.show();		
				}
				else if (myArray[2] == 1){
					
					if (myArray[1] == 1){
						dojo.widget.byId("dlg1").setContent(
						'<div class="boxInfoTop">'+tradArray[29]+'</div>'
						+'<div class="boxInfoBody">'
						//+'The Alert systems has been ACTIVATED for the query stored in the slot ' + myArray[0] + '.<br/>'
						+ tradArray[2] +' '+ myArray[0] + '.<br/>'
						+'<div class="btGris">'
						+'<div class="btGrisLeft"></div>'
						+'<div class="btGrisRight"><a id="hiderH" style="cursor:pointer;" tabindex="1">'+tradArray[36]+'</a></div>'
						+'</div>'
						+'</div>'
						+'<div class="boxInfoBottom"/>'
						);
						dojo.widget.byId('query' + myArray[0] + 'Menu').children[2].caption.firstChild.nodeValue = tradArray[3];
									
						btn1 = document.getElementById("hiderH");
						dlg1.setCloseControl(btn1);
						dlg1.show();
					}
					
					if (myArray[1] == 0){
						dojo.widget.byId("dlg1").setContent(
						'<div class="boxInfoTop">'+tradArray[30]+'</div>'
						+'<div class="boxInfoBody">'
						+ tradArray[4] + ' ' + myArray[0] + '.<br/>'
						+'<div class="btGris">'
						+'<div class="btGrisLeft"></div>'
						+'<div class="btGrisRight"><a id="hiderI" style="cursor:pointer;" tabindex="1">'+tradArray[36]+'</a></div>'
						+'</div>'
						+'</div>'
						+'<div class="boxInfoBottom"/>'
						);		
						dojo.widget.byId('query' + myArray[0] + 'Menu').children[2].caption.firstChild.nodeValue = tradArray[5];
						
						btn1 = document.getElementById("hiderI");
						dlg1.setCloseControl(btn1);
						dlg1.show();
					}
				}
				//writing back the form action string and method
				dojo.byId('webServiceForm_pi2').action = dojo.byId('actionStrBuffer').value;
				dojo.byId('webServiceForm_pi2').method = 'post';
				
				//setting back the caption of the savebutton
			
				initSaveInAvailableSlotButton();					
			}
			
			
			
			function UseAQueryFormCallback( type, data, evt ) {		
				/*
				myArray[0] = $queryPos
				myArray[1] = $withTerms
				myArray[2] = $withoutTerms
				myArray[3] = $locationTerms
				myArray[4] = return code
				myArray[5] = scope
				myArray[6] = paramsAndOr
				myArray[7] = paramsSynonym
				myArray[8] = type
				*/
				
				myArray = data.split("&");

				if (myArray[4] == -1){
				
						dojo.widget.byId("dlg1").setContent(
						'<div class="boxInfoTop">'+tradArray[31]+'</div>'
						+'<div class="boxInfoBody">'
						//+'The slot ' + myArray[0] + ' does not contains any saved query. You must first save one before you can use it.<br/>'
						+ tradArray[0] + ' ' + myArray[0] + ' ' + tradArray[16] +'<br/>'
						+'<div class="btGris">'
						+'<div class="btGrisLeft"></div>'
						+'<div class="btGrisRight"><a id="hiderJ" style="cursor:pointer;" tabindex="1">'+tradArray[36]+'</a></div>'
						+'</div>'
						+'</div>'
						+'<div class="boxInfoBottom"/>'
						);					
						
					btn1 = document.getElementById("hiderJ");
					dlg1.setCloseControl(btn1);
					dlg1.show();
				}

				if (myArray[4] == 1){			
					if (pageId == 42){
						if (myArray[5] == 'TRIALS' || myArray[5] == 'ongoing'){
							if(myArray[8] == 'trials-pediatric'){
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-ongoing-trials/pediatric/index.htm?with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=no&redirectDisplay=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}
							else{
								addTermWithParam(myArray[1], myArray[2], myArray[3], myArray[6], myArray[7]);
								var myWidget = dojo.widget.byId('save');
								myWidget.setCaption(tradArray[17] +' '+ myArray[0]);				
							} 
						}

						else if (myArray[5] == 'RESULTS' || myArray[5] == 'completed'){				
							if(myArray[8] == 'results-pediatric'){
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-trials-results/pediatric/index.htm?with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=no&redirectDisplay=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}
							
							else {
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-trials-results/search/index.htm?with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=no&redirectDisplay=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}						
						}
					}
					
					if (pageId == 77){
						if (myArray[5] == 'TRIALS' || myArray[5] == 'ongoing'){
							if(myArray[8] == 'trials-pediatric'){
								addTermWithParam(myArray[1], myArray[2], myArray[3], myArray[6], myArray[7]);
								var myWidget = dojo.widget.byId('save');
								myWidget.setCaption(tradArray[17] +' '+ myArray[0]);				
							}
							else{
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-ongoing-trials/search/index.htm?with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=no&redirectDisplay=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}
						}
	
						else if (myArray[5] == 'RESULTS' || myArray[5] == 'completed'){						
							if(myArray[8] == 'results-pediatric'){
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-trials-results/pediatric/index.htm?with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=no&redirectDisplay=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}
							
							else{
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-trials-results/search/index.htm?with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=no&redirectDisplay=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}						
						}					
					}
					
					if (pageId == 44){
						if (myArray[5] == 'TRIALS' || myArray[5] == 'ongoing'){
							if(myArray[8] == 'trials-pediatric'){
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-ongoing-trials/pediatric/index.htm?with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=no&redirectDisplay=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}
							else {
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-ongoing-trials/search/index.htm?with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=no&redirectDisplay=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}
						}

						else if (myArray[5] == 'RESULTS' || myArray[5] == 'completed'){							
							if(myArray[8] == 'results-pediatric'){
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-trials-results/pediatric/index.htm?with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=no&redirectDisplay=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}
							else{
								addTermWithParam(myArray[1], myArray[2], myArray[3], myArray[6], myArray[7]);
								var myWidget = dojo.widget.byId('save');
								myWidget.setCaption(tradArray[17] +' '+ myArray[0]);				
							}						
						}
					}
					
					if (pageId == 76){
						if (myArray[5] == 'TRIALS' || myArray[5] == 'ongoing'){
							if(myArray[8] == 'trials-pediatric'){
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-ongoing-trials/pediatric/index.htm?with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=no&redirectDisplay=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}
							else {
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-ongoing-trials/search/index.htm?with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=no&redirectDisplay=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}
						}
						
						else if (myArray[5] == 'RESULTS' || myArray[5] == 'completed'){							
							if(myArray[8] == 'results-pediatric'){
								addTermWithParam(myArray[1], myArray[2], myArray[3], myArray[6], myArray[7]);
								var myWidget = dojo.widget.byId('save');
								myWidget.setCaption(tradArray[17] +' '+ myArray[0]);				
							} 
							
							else{
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-trials-results/search/index.htm?with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=no&redirectDisplay=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}						
						}
					}
				}
				
				
				//writing back the form action string and method
				dojo.byId('webServiceForm_pi2').action = dojo.byId('actionStrBuffer').value;
				dojo.byId('webServiceForm_pi2').method = 'post';	
				
			}
			
			
			function checkIfFirstSearchTermEmpty(data){
				
			}
			
			
			function ExecuteAQueryFormCallback( type, data, evt ) {						
				/*
				myArray[0] = $queryPos
				myArray[1] = $withTerms
				myArray[2] = $withoutTerms
				myArray[3] = $locationTerms
				myArray[4] = return code
				*/
				myArray = data.split("&");
				if (myArray[4] == -1){
				
					dojo.widget.byId("dlg1").setContent(
					'<div class="boxInfoTop">'+tradArray[32]+'</div>'
					+'<div class="boxInfoBody">'
					+ tradArray[0] + ' ' + myArray[0] + ' ' + tradArray[16] +'<br/>'
					+'<div class="btGris">'
					+'<div class="btGrisLeft"></div>'
					+'<div class="btGrisRight"><a id="hiderK" style="cursor:pointer;" tabindex="1">'+tradArray[36]+'</a></div>'
					+'</div>'
					+'</div>'
					+'<div class="boxInfoBottom"/>'
					);	
	
					btn1 = document.getElementById("hiderK");
					dlg1.setCloseControl(btn1);
					dlg1.show();
				}
				
				//executing the search...
				//TODO Laurent: reprendre la structure du useAQueryCallback !! FIXED  !!
				
				if (myArray[4] == 1){			
					if (pageId == 42){
						if (myArray[5] == 'TRIALS'|| myArray[5] == 'ongoing'){
							if(myArray[8] == 'trials-pediatric'){
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-ongoing-trials/pediatric/index.htm?pos='+myArray[0]+'&with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}
							else{
								//adding the terms
								addTermWithParam(myArray[1], myArray[2], myArray[3], myArray[6], myArray[7]);
								//submitting the form
								dojo.byId("webServiceForm").submit();		
							} 
						}
						
						else if (myArray[5] == 'RESULTS'|| myArray[5] == 'completed'){
							if(myArray[8] == 'results-pediatric'){						
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-trials-results/pediatric/index.htm?pos='+myArray[0]+'&with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}
							
							else {
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-trials-results/search/index.htm?pos='+myArray[0]+'&with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}						
						}
					}
					
					if (pageId == 77){
						if (myArray[5] == 'TRIALS'|| myArray[5] == 'ongoing'){
							if(myArray[8] == 'trials-pediatric'){
								//adding the terms
								addTermWithParam(myArray[1], myArray[2], myArray[3], myArray[6], myArray[7]);
								//submitting the form
								dojo.byId("webServiceForm").submit();			
							} 
							
							else {
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-ongoing-trials/search/index.htm?pos='+myArray[0]+'&with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}							
						}
						
						else if (myArray[5] == 'RESULTS'|| myArray[5] == 'completed'){
							if(myArray[8] == 'results-pediatric'){
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-trials-results/pediatric/index.htm?pos='+myArray[0]+'&with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}
							
							else{
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-trials-results/search/index.htm?pos='+myArray[0]+'&with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}							
						}					
					}
					
					if (pageId == 44){
						if (myArray[5] == 'TRIALS'|| myArray[5] == 'ongoing'){
							if(myArray[8] == 'trials-pediatric'){
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-ongoing-trials/pediatric/index.htm?pos='+myArray[0]+'&with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}
							else {
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-ongoing-trials/search/index.htm?pos='+myArray[0]+'&with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}
						}
						else if (myArray[5] == 'RESULTS'|| myArray[5] == 'completed'){							
							if(myArray[8] == 'results-pediatric'){
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-trials-results/pediatric/index.htm?pos='+myArray[0]+'&with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}
							else{
								//adding the terms
								addTermWithParam(myArray[1], myArray[2], myArray[3], myArray[6], myArray[7]);
								//submitting the form
								dojo.byId("webServiceForm").submit();
								
							} 						
						}
					}
					
					if (pageId == 76){
						if (myArray[5] == 'TRIALS'|| myArray[5] == 'ongoing'){
							if(myArray[8] == 'trials-pediatric'){
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-ongoing-trials/pediatric/index.htm?pos='+myArray[0]+'&with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}
							else {
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-ongoing-trials/search/index.htm?pos='+myArray[0]+'&with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}
						}
						
						else if (myArray[5] == 'RESULTS'|| myArray[5] == 'completed'){							
							if(myArray[8] == 'results-pediatric'){
								//adding the terms
								addTermWithParam(myArray[1], myArray[2], myArray[3], myArray[6], myArray[7]);
								//submitting the form
								dojo.byId("webServiceForm").submit();								
							} 
							
							else{ 
								document.location.href=document.getElementsByTagName('base')[0].href + langISO + '/search-trials-results/search/index.htm?pos='+myArray[0]+'&with='+myArray[1]+'&without='+myArray[2]+'&location='+myArray[3]+'&getSearch=yes&AndOr='+myArray[6]+'&synonymList='+myArray[7];
							}						
						}
					}
				}	
				
				//writing back the form action string and method
				dojo.byId('webServiceForm_pi2').action = dojo.byId('actionStrBuffer').value;
				dojo.byId('webServiceForm_pi2').method = 'post';	
				
				//setting back the caption of the savebutton
				initSaveInAvailableSlotButton();				
			}
			
			function showReturnValue( type, evaldObj ) {
				alert( "The script returned\n" + evaldObj );
			}
					
			function SaveQueryLabelCallback( type, data, evt ) {
				myArray = data.split("|");
				//You must enter a value in the input box before clicking on OK.
				if (myArray[0] == -1){
				
					dojo.widget.byId("dlg1").setContent(
					'<div class="boxInfoTop">'+tradArray[33]+'</div>'
					+'<div class="boxInfoBody">'
					+ tradArray[18] +'<br/>'
					+'<div class="btGris">'
					+'<div class="btGrisLeft"></div>'
					+'<div class="btGrisRight"><a id="hiderL" style="cursor:pointer;" tabindex="1">'+tradArray[36]+'</a></div>'
					+'</div>'
					+'</div>'
					+'<div class="boxInfoBottom"/>'
					);
					
					btn1 = document.getElementById("hiderL");
					dlg1.setCloseControl(btn1);
					dlg1.show();	
										
				}
				
				else{
					dojo.byId('Input' + myArray[0]).value = myArray[1];
				}
			}
			

			function errorHandler( type, error ) {
			    var msg = "Something went wrong ...\n" +
		        error.message;
			    alert( msg );
			}
			
			
			function JSCallback( type, evaldObj ) {
				alert( "The script returned\n" + evaldObj );
			}

			
	
			function asyncCallToDeleteAQuery(queryPos, forceDelete){	
				
				
				//saving the actual action string
				dojo.byId('actionStrBuffer').value = dojo.byId('webServiceForm_pi2').action
				
				//setting the web form action attribute
				dojo.byId('webServiceForm_pi2').method = 'get';
				dojo.byId('webServiceForm_pi2').action = '/typo3conf/callWS/deleteAQueryForm.php?forceDelete='+forceDelete+'&dummy=' + new Date().getTime();
				
				//setting the slot id
				dojo.byId('slotIdBuffer').value = queryPos;
								
				//call to the advanced search web form
				dojo.io.bind({
			    load: DeleteAQueryFormCallback,
			    error: errorHandler,
			    formNode: document.getElementById( "webServiceForm_pi2" ),
			    mimetype: "text/plain"
				});	
			}
	
			
			function asyncCallToSaveAQuery(queryPos, forceSave, bypassCaptionCheck){	
				
				//testing the main search button caption 
				var myCaption = dojo.widget.byId('save').caption;
				myCaption = myCaption.toString();				
				//checking the regEx
				if(myCaption.search(/[0-9]/) != -1 && bypassCaptionCheck != 1){
					if (myCaption.search(/2/) != -1){
					queryPos = 2;
					forceSave = 1;
					}
					if (myCaption.search(/3/) != -1){
					queryPos = 3;
					forceSave = 1;
					}
					if (myCaption.search(/4/) != -1){
					queryPos = 4;
					forceSave = 1;
					}
					if (myCaption.search(/5/) != -1){
					queryPos = 5;	
					forceSave = 1;
					}
					if (myCaption.search(/6/) != -1){
					queryPos = 6;	
					forceSave = 1;
					}
					if (myCaption.search(/1/) != -1){
					queryPos = 1;
					forceSave = 1;
					}
				}

					//saving the actual action string
					if (dojo.byId('webServiceForm').method != 'get'){
						dojo.byId('actionStrBuffer').value = dojo.byId('webServiceForm').action
					}
					
					//setting the web form action attribute
					dojo.byId('webServiceForm').method = 'get';
					//dojo.byId('webServiceForm').action = 'typo3conf/callWS/saveAQueryForm.php?dummy=' + new Date().getTime();
					dojo.byId('webServiceForm').action = '?type=200&dummy=' + new Date().getTime();
					
					//setting the slot id
					dojo.byId('saveSlotIdBuffer').value = queryPos;
					
					//setting the forceSave buffer
					dojo.byId('forceSave').value = forceSave;
					
					//displaying the wait animated gift
					//createInStandby();			
					
					//call to the advanced search web form
					dojo.io.bind({
				    load: SaveAQueryFormCallback,
				    error: errorHandler,
				    formNode: document.getElementById( "webServiceForm" ),
				    mimetype: "text/plain"
					});	
			}
			
			
		
			
			function asyncCallToAlertAQuery(queryPos){		
				
				//saving the actual action string
				dojo.byId('actionStrBuffer').value = dojo.byId('webServiceForm_pi2').action
				
				//setting the web form action attribute
				dojo.byId('webServiceForm_pi2').method = 'get';
				dojo.byId('webServiceForm_pi2').action = 'typo3conf/callWS/alertAQueryForm.php?dummy=' + new Date().getTime();
				
				//setting the slot id
				dojo.byId('slotIdBuffer').value = queryPos;
								
				//call to the advanced search web form
				dojo.io.bind({
			    load: AlertAQueryFormCallback,
			    error: errorHandler,
			    formNode: document.getElementById( "webServiceForm_pi2" ),
			    mimetype: "text/plain"
				});	
			}
			
			
			function asyncCallToUseAQuery(queryPos){				
				
				//saving the actual action string
				dojo.byId('actionStrBuffer').value = dojo.byId('webServiceForm_pi2').action
				
				//setting the web form action attribute
				dojo.byId('webServiceForm_pi2').method = 'get';
				dojo.byId('webServiceForm_pi2').action = 'typo3conf/callWS/useAQueryForm.php?dummy=' + new Date().getTime();
				
				//setting the slot id
				dojo.byId('slotIdBuffer').value = queryPos;
								
				//call to the advanced search web form
				dojo.io.bind({
			    load: UseAQueryFormCallback,
			    error: errorHandler,
			    formNode: document.getElementById( "webServiceForm_pi2" ),
			    mimetype: "text/plain"
				});	
			}
			
			
			function asyncCallToExecuteAQuery(queryPos){			
				
				//saving the actual action string
				dojo.byId('actionStrBuffer').value = dojo.byId('webServiceForm_pi2').action
				
				//setting the web form action attribute
				dojo.byId('webServiceForm_pi2').method = 'get';
				dojo.byId('webServiceForm_pi2').action = 'typo3conf/callWS/useAQueryForm.php?dummy=' + new Date().getTime();
				
				//setting the slot id
				dojo.byId('slotIdBuffer').value = queryPos;
				
				dojo.byId('asyncSearch').value = 'yes';
								
				//call to the advanced search web form
				dojo.io.bind({
			    load: ExecuteAQueryFormCallback,
			    error: errorHandler,
			    formNode: document.getElementById( "webServiceForm_pi2" ),
			    mimetype: "text/plain"
				});	
				
			}
			
			function asyncCallToSaveQueryLabel(){				
				
				if (dojo.byId('Input'+labelPos).value != ""){
					//setting the web form action attribute
					dojo.byId('newQueryLabelForm').method = 'get';
					dojo.byId('newQueryLabelForm').action = 'typo3conf/callWS/saveQueryLabel.php?dummy=' + new Date().getTime();
					
					//setting the slot id
					dojo.byId('saveSlotIdBufferLabel').value = labelPos;
					
									
					//call to the advanced search web form
					dojo.io.bind({
				    load: SaveQueryLabelCallback,
				    error: errorHandler,
				    formNode: document.getElementById( "newQueryLabelForm" ),
				    mimetype: "text/plain"
					});
				}
				else{
				
					//alert('No query is saved in this slot');
					dojo.widget.byId("dlg1").setContent(
					'<div class="boxInfoTop">'+tradArray[34]+'</div>'
					+'<div class="boxInfoBody">'
					+ tradArray[0] + ' ' + labelPos + ' ' + tradArray[19] +'<br/>'
					+'<div class="btGris">'
					+'<div class="btGrisLeft"></div>'
					+'<div class="btGrisRight"><a id="hiderM" style="cursor:pointer;" tabindex="1">'+tradArray[36]+'</a></div>'
					+'</div>'
					+'</div>'
					+'<div class="boxInfoBottom"/>'
					);
					
					btn1 = document.getElementById("hiderM");
					dlg1.setCloseControl(btn1);
					dlg1.show();	
				}
				
						
			}
			
			function displayLabelForm(labelPosFunc){

				if (dojo.byId("Input"+labelPosFunc).value == ""){				
					//if there is nothing saved in the slot labelPosFunc
					dojo.widget.byId("dlg1").setContent(
					'<div class="boxInfoTop">'+tradArray[35]+'</div>'
					+'<div class="boxInfoBody">'
					+ tradArray[0] + ' ' + labelPosFunc + ' ' + tradArray[19] +'<br/>'
					+'<div class="btGris">'
					+'<div class="btGrisLeft"></div>'
					+'<div class="btGrisRight"><a id="hiderM" style="cursor:pointer;" tabindex="1">'+tradArray[36]+'</a></div>'
					+'</div>'
					+'</div>'
					+'<div class="boxInfoBottom"/>'
					);
					
					btn1 = document.getElementById("hiderM");
					dlg1.setCloseControl(btn1);
					dlg1.show();	
				}
				else{
					//we display the form 
					labelPos = labelPosFunc;				
					btn1 = document.getElementById("hiderVV");
					dlgForm123.setCloseControl(btn1);
					dlgForm123.show();
				}
			}
			
			function adjustBGColor(boxColor){
					document.getElementById('Input'+myArray[0]).style.background = boxColor;										document.getElementById('Input'+myArray[0]).style.background = boxColor;
			}
			

			function trim(str, chars) {
				return ltrim(rtrim(str, chars), chars);
			}
			
			function ltrim(str, chars) {
				chars = chars || "\\s";
			return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

			function rtrim(str, chars) {
			    chars = chars || "\\s";
			    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
			}
			
			function createInStandby ()
			{
				//alert(createInStandby.caller);
				dlg1 = dojo.widget.byId("dlg1");
				dojo.widget.byId("dlg1").setContent(
				'<div class="boxInfoTop">'+tradArray[39]+'</div>'
				+'<div class="boxInfoBody">'
				+tradArray[38]
				+'<div id="pngContainer"></div>'
				+'</div>'
				+'<div class="boxInfoBottom"/>'
				);
				
				dlg1.show();	

				var params = {src: "typo3conf/ext/ifpma_webservice/res/animatedpng_static.gif", aniSrc: "typo3conf/ext/ifpma_webservice/res/animatedpng_frames.gif", width: 20, height: 20, interval: 100};
				var widget = dojo.widget.createWidget("AnimatedPng", params, document.getElementById("pngContainer"));	
			};
			

			function iprint(ptarget)
			{
			ptarget.focus();
			ptarget.print();
			} 
			
			
			function displayResultDialog(url, realUrl){
				dojo.byId('webServiceForm_bidon').method = 'get';
				dojo.byId('webServiceForm_bidon').action = url + '&dummy=' + new Date().getTime();
								
				//call to the advanced search web form
				dojo.io.bind({
			    load: displayResultDialogCallBack,
			    error: errorHandler,
			    formNode: document.getElementById( "webServiceForm_bidon" ),
			    mimetype: "text/plain"
				});	
				
				function displayResultDialogCallBack(type, data, evt){
					//alert(data);
					//alert(data.indexOf('no_static_xyz123'));
					if (data.indexOf('no_static_xyz123') != -1){
					displayResultDialogSuite (url, realUrl, 0)
					}
					else{
					displayResultDialogSuite (url, realUrl, 1)
					}
				}
			}			
			
			function windowHeight() {
				  var myHeight = 0;
				  if( typeof( window.innerWidth ) == 'number' ) {
				    //Non-IE
				    myHeight = window.innerHeight;
				  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
				    //IE 6+ in 'standards compliant mode'
				    myHeight = document.documentElement.clientHeight;
				  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
				    //IE 4 compatible
				    myHeight = document.body.clientHeight;
				  }
				  return myHeight;
			}
			
			function windowWidth() {
				  var myWidth = 0;
				  if( typeof( window.innerWidth ) == 'number' ) {
				    //Non-IE
				    myWidth = window.innerWidth;
				  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
				    //IE 6+ in 'standards compliant mode'
				    myWidth = document.documentElement.clientWidth;
				  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
				    //IE 4 compatible
				    myWidth = document.body.clientWidth;
				  }
				  return myWidth;
			}
			
			function getElementsByClass(maClass) 
			{
				var tabRetour = new Array();
				var tabTmp = new Array();
				tabTmp = document.getElementsByTagName("*");
				j=0;
				for (i=0; i<tabTmp.length; i++) 
				{
					if (tabTmp[i].className==maClass) 
					{
						tabRetour[j]=tabTmp[i];
						j++;
					}
				}
				return tabRetour;
			} 
			
			function positionResultDialogSuite(){
				document.documentElement.scrollTop+=1;
				var boxInfoResultBody_width = windowWidth() - 80;
				var boxInfoResultBody_height = windowHeight() - 160;			
				if (boxInfoResultBody_height<400)
				{
					boxInfoResultBody_height = 400;
				}
				var boxInfoResultBody_heightIframe = boxInfoResultBody_height - 90;
				//alert (boxInfoResultBody_width+"---"+boxInfoResultBody_height);
				var divToResize= document.getElementById("myDiv");
				divToResize.style.width=boxInfoResultBody_width+'px';
				divToResize.style.height=boxInfoResultBody_height+'px';
				var iframeToResize = document.getElementById("resultIframe");
				iframeToResize.style.height=boxInfoResultBody_heightIframe+'px';				
				
				for(var i=0;i<getElementsByClass("dialogUnderlay").length;i++){
					getElementsByClass("dialogUnderlay")[i].style.width=windowWidth()+'px';					
					getElementsByClass("dialogUnderlay")[i].style.height= windowHeight()+'px';
					//alert("Bonjour"+getElementsByClass("dialogUnderlay")[i].style.height);
				}
				document.documentElement.scrollTop+=1;
				//var dialogUnderlayToResize =document.getElementsByClass('dialogUnderlay');
				//alert(divToResize.style.width);
			}
			
			
			function displayResultDialogSuite (url, realUrl, displayPrint)
			{				
				window.onresize = positionResultDialogSuite;
				
				var boxInfoResultBody_width = windowWidth() - 80;
				var boxInfoResultBody_height = windowHeight() - 160;
				if (boxInfoResultBody_height<400)
				{
					boxInfoResultBody_height = 400;
				}
								
				//alert (displayPrint);
				dlgX = dojo.widget.byId("dlg1");
				//if realUrl is internal source, the print button is deleted
				if (displayPrint == 1){
					dojo.widget.byId("dlg1").setContent(
					'<!--div class="boxInfoTop">'+'a title'+'</div-->'
					+'<div id="myDiv" class="boxInfoResultBody" style="width:'+boxInfoResultBody_width+'px">'
					+'<div style="height:44px;">'
					+'<div style="float: right;margin-right:14px;height:37px;margin-top:7px">'
					+'<a id="hiderAAA" style="cursor:pointer;"><img SRC="typo3conf/ext/ifpma_webservice/res/pict_delete_page.png" /></a>'
					+'</div>'				
					+'<div style="float: right;margin-right:10px;height:37px;margin-top:7px">'
					+'<a id="hiderAAB" href="'+url+'" target="_blank" style="cursor:pointer;"><img SRC="typo3conf/ext/ifpma_webservice/res/pict_add_page.png" /></a>'
					+'</div>'				
					+'<div style="float: right;margin-right:10px;height:37px;margin-top:7px">'
					+'<a href="javascript:iprint(resultIframe)" style="cursor:pointer;"><img SRC="typo3conf/ext/ifpma_webservice/res/pict_print_page.png" /></a>'
					+'</div>'			
					+ '<div style="float:left;height:37px;">'
					+ '<img alt="logo IFPMA" src="/typo3conf/ext/ifpma_webservice/res/logo_IFPMA_RETRIEVAL.gif" />'
					+ '</div>'
					+ '</div>'	
					+ '<iframe name="resultIframe" id="resultIframe" src="'+url+'" height="'+boxInfoResultBody_height+'"px" width="98%"></iframe>'
					+'<div>'
					//+'<p>'+tradArray[40]+'</p>'
					+'<p>'+tradArray[41]+'<a href="' + realUrl + '" style="cursor:pointer;" target="_blank">'+realUrl+'</a></p>'
					+'<p>'+tradArray[42]+'<a href="http://www.ifpma.org/privacy_policy.aspx" style="cursor:pointer;" target="_blank">'+tradArray[43]+'</a></p>'
					+'</div>'
					+'</div>'
					+'<!--div class="boxInfoBottom"/-->'
					);
				}
				//if realUrl is internal source, the print button is implemented
				else{

				var boxInfoResultBody_width = windowWidth() - 80;
				var boxInfoResultBody_height = windowHeight() - 160;
				
					if (boxInfoResultBody_height<400)
					{
						boxInfoResultBody_height = 400;
					}
									
					dojo.widget.byId("dlg1").setContent(
					'<!--div class="boxInfoTop">'+'a title'+'</div-->'
					+'<div id="myDiv" class="boxInfoResultBody" style="width:'+boxInfoResultBody_width+'px">'			
					+'<div style="height:44px;">'
					+'<div style="float: right;margin-right:14px;height:37px;margin-top:7px">'
					+'<a id="hiderAAA" style="cursor:pointer;"><img SRC="typo3conf/ext/ifpma_webservice/res/pict_delete_page.png" /></a>'
					+'</div>'				
					+'<div style="float: right;margin-right:10px;height:37px;margin-top:7px;">'
					+'<a id="hiderAAB" href="'+url+'" target="_blank" style="cursor:pointer;"><img SRC="typo3conf/ext/ifpma_webservice/res/pict_add_page.png" /></a>'
					+'</div>'					
					+ '<div style="float: left;height:37px;">'
					+ '<img alt="logo IFPMA" src="/typo3conf/ext/ifpma_webservice/res/logo_IFPMA_RETRIEVAL.gif" />'
					+ '</div>'
					+ '</div>'	
					+ '<iframe name="resultIframe" id="resultIframe" src="'+url+'" height="'+boxInfoResultBody_height+'"px" width="98%"></iframe>'
					+'<div style="overflow: hidden;">'
					//+'<p>'+tradArray[40]+'</p>'
					+'<p>'+tradArray[41]+'<a href="' + realUrl + '" style="cursor:pointer;" target="_blank">'+realUrl+'</a></p>'
					+'<p>'+tradArray[42]+'<a href="http://www.ifpma.org/privacy_policy.aspx" style="cursor:pointer;" target="_blank">'+tradArray[43]+'</a></p>'
					+'</div>'
					+'</div>'
					+'<!--div class="boxInfoBottom"/-->'
					);						
				}
				
				
				settings = {
			          tl: { radius: 15 },
			          tr: { radius: 15 },
			          bl: { radius: 15 },
			          br: { radius: 15 },
			          antiAlias: true,
			          autoPad: true,
			          validTags: ["div"]
			    }
				
				var divObj = document.getElementById("myDiv");
					//ATTENTION SI IE6 LA FONCTION CACHE l'IFRAME 
					var cornersObj = new curvyCorners(settings, divObj);
					cornersObj.applyCornersToAll();
					//END ATTENTION SI IE6 LA FONCTION CACHE l'IFRAME 
				//both buttons close the dialog
				btn1 = document.getElementById("hiderAAA");
				dlgX.setCloseControl(btn1);
				btn2 = document.getElementById("hiderAAB");
				dlgX.setCloseControl(btn2);				
				dlgX.show();
			}
			
			
			
			function init() {
				
				dlg1 = dojo.widget.byId("dlg1");
				dlgForm123 = dojo.widget.byId("dlgForm");
				
				lang = dojo.byId('languageBuffer').value;
				
				switch(lang){
				case '1':
					langISO = 'jp';
					break;
				case '2':
					langISO = 'de';
					break;
				case '3':
					langISO = 'es';
					break;
				case '4':
					langISO = 'fr';
					break;
				default:
					langISO = 'en';
				}
				
				pageId = dojo.byId('pageIdBuffer').value;
				
				searchPageMode = dojo.byId('searchPage').value;
				if(searchPageMode=='searchPage')
				{
					dojo.event.connect(dojo.byId('add-term'), "onclick", "addTerm");
					dojo.event.connect(dojo.byId('add-without-term'), "onclick", "addWithoutTerm");
					dojo.event.connect(dojo.byId('add-location-term'), "onclick", "addLocationTerm");
					dojo.event.connect(dojo.byId('initTerms'), "onclick", "initTerms");
				}
			}
			//everything in the dojo.addOnload is being loaded AFTER the DOM construction
			dojo.addOnLoad(init);
		
