
	var Ajour = new Ajour401();  
	var ContextMenuObject = null;
		
	function Ajour401(){
		
		myCookieModule = new CookieModule();
		myWindowModule = new WindowModule();
		myPanelModule = new PanelModule();
		myFormModule = new FormModule();
		myBrowserModule	= new BrowserModule();	
		
		if (!myBrowserModule.firefox) {
			myShortCutModule = new ShortCutModule();
		}

		myContextMenuModule = new ContextMenuModule();
		myFileFolderModule = new FileFolderModule();
		myPageSelectorModule = new PageSelectorModule();

		
		this.Cookies = myCookieModule;
		this.Window = myWindowModule;
		this.Panel = myPanelModule;
		this.Form = myFormModule;
		this.Browser = myBrowserModule;

		if (!myBrowserModule.firefox) {
			this.Shortcut = myShortCutModule;
		}
		
		this.ContextMenu = myContextMenuModule;
		this.FileFolder = myFileFolderModule;
		this.PageSelector = myPageSelectorModule;
		
		this.Select = new SelectModule();
		this.Console = new ConsoleModule();
		this.Ajax = new AjaxModule();

		this.Initialize = Ajour401Initialize;
		
		this.ScriptName = document.location.toString().split('?')[0]
		this.LCID = myCookieModule.getValueByCookieAndKey("Client", "LcId");
		this.version = "4.01"
		
	}	
	
	function Ajour401Initialize(){
		
		if(document.getElementById("ContextMenuContainer")!=null){
			document.oncontextmenu = Ajour.ContextMenu.DisableBrowserMenu;
			document.onclick = Ajour.ContextMenu.Hide;
		}
		
		if (!Ajour.Browser.firefox){
			document.onkeypress = Ajour.Shortcut.trigger;
		}
		
	
		
	}

	function PageSelectorModule(){
		
		this.select = fncPageSelectorSelect;
	
	}

	function fncPageSelectorSelect(){
		var prefix = "";
		if(arguments.length > 0) prefix = arguments[0];
		if(arguments.length > 1) document.forms[0].elements[prefix+'Type'].value = arguments[1];
		
		
		if(arguments.length > 2) 
		{
			if(document.forms[0].elements[prefix+'Id'] != null)	
			{
				document.forms[0].elements[prefix+'Id'].value = arguments[2];
			} 
			else 
			{
				document.forms[0].elements[prefix].value = arguments[2];
			}
		}
		
		if(arguments.length > 3) document.forms[0].elements[prefix+'Name'].value = arguments[3];
	}
	
	
	var index = 0;
	function designScriptBrowse(){

		if(arguments.length>0){
			index = index + arguments[0];
		} else {
			index = index + 1;
		}
		
		
		if(Ajour.Browser.firefox){

			//XMLItems = xyz.documentElement.selectNodes("designscript");

			var XMLItems = window.document.getElementsByTagName("designscript");
			
			upperBound = XMLItems.length-1;
			lowerBound = 0;
		
			if(index>upperBound) index=0;
			if(index<lowerBound) index=upperBound;

			var i =0;
			while(XMLItems[i]){
		
				XMLChildNode = XMLItems[i]; 

				if(XMLChildNode.nodeType==1 && i==index){
						
					if (XMLChildNode.getAttribute("img")=='') {
						document.getElementById("designscriptImg").src = '/4.0/clientside/files/designscripts/2.gif';
					} else {
						document.getElementById("designscriptImg").src = XMLChildNode.getAttribute("img");
						document.all['designscriptImg'].value = XMLChildNode.getAttribute("img");
					}
					document.getElementById("fDesignscript").value = XMLChildNode.getAttribute("file");
					document.getElementById("fDesignscriptName").value = XMLChildNode.getAttribute("name");
					document.getElementById("fDesignscriptTitle").textContent = XMLChildNode.getAttribute("name");
					
				}
				i++;	

			}

		} else {
		
			XMLItems = xyz.documentElement.selectNodes("designscript");
	
			upperBound = XMLItems.length-1;
			lowerBound = 0;
		
			if(index>upperBound) index=0;
			if(index<lowerBound) index=upperBound;
		
			var i =0;
			while(XMLItems[i]){
		
				XMLChildNode = XMLItems[i]; 

				if(XMLChildNode.nodeType==1 && i==index){
						
					if (XMLChildNode.getAttribute("img")=='') {
						document.all['designscriptImg'].src = '/4.0/clientside/files/designscripts/2.gif';
					} else {
						document.all['designscriptImg'].src = XMLChildNode.getAttribute("img");
						document.all['designscriptImg'].value = XMLChildNode.getAttribute("img");
					}
					document.all['fDesignscript'].value = XMLChildNode.getAttribute("file");
					document.all['fDesignscriptName'].value = XMLChildNode.getAttribute("name");
					document.all['fDesignscriptTitle'].innerText = XMLChildNode.getAttribute("name");
					
					}
				i++;	
		
			}

		}	

	
	}	



		//*** SELECT CONTROL MANIPULATOR
		
		     
   
	function SelectModule(){
		this.add = fncSelectModuleAdd;
		this.sort = fncSelectModuleSort;
		this.removeIndex = fncSelectModuleRemoveByIndex;
		this.removeText = fncSelectModuleRemoveByText;
		this.removeValue = fncSelectModuleRemoveByValue;
		this.index = fncSelectModuleIndex;
		this.text = fncSelectModuleText;
		this.value = fncSelectModuleValue;
		this.moveUp = fncSelectModuleMoveUp;
		this.moveDown = fncSelectModuleMoveDown;
		this.move = fncSelectModuleMove;

		this.selectAll = fncSelectModuleSelectAll;
		this.allIsSelected = fncSelectModuleAllIsSelected;
		
     }

	function fncSelectModuleAllIsSelected(me){
		for (i = 0; i < me.options.length; i++){
			if(!me.options[i].selected){
				return false;
			}
		}
		return true;
	}

	function fncSelectModuleSelectAll(me){
		for (i = 0; i < me.options.length; i++){
			me.options[i].selected = true;
		}
	}
	
	function fncSelectModuleMoveUp(me){
		this.move(me, 1);
	}

	function fncSelectModuleMoveDown(me){
		this.move(me, -1);
	}

	function fncSelectModuleMove(me, direction){
	
		var tmpSelect = document.createElement("SELECT")
	
		if (me.options.selectedIndex + direction < me.options.length && me.options.selectedIndex + direction >= 0) {
			// Reset options in tmp select
			tmpSelect.options.length = 0;
			// Set index values
			var initIndex = me.options.selectedIndex;
			var swapIndex = me.options.selectedIndex;
			if(direction!=1){
				swapIndex = swapIndex + direction
			}
			// Copy options to tmpSelect in the right order 	
			for (i = 0; i < me.options.length; i++){
				if (i==swapIndex){
					var oOption = new Option(me.options[i+1].innerText,me.options[i+1].value);
					tmpSelect.options.add(oOption);
					var oOption = new Option(me.options[i].innerText,me.options[i].value);
					tmpSelect.options.add(oOption);
					i++;
				} else {
				var oOption = new Option(me.options[i].innerText,me.options[i].value);
				tmpSelect.options.add(oOption);
				}
			}
			// Reset options in select
			me.options.length = 0;
			// Copy options from tmpSelect to select  	
			for (i = 0; i < tmpSelect.options.length; i++){
				var oOption = new Option(tmpSelect.options[i].innerText,tmpSelect.options[i].value);
				me.options.add(oOption);
			}
			// Select the right item
			me.options.selectedIndex = initIndex + direction
		}
	}
	
	function fncSelectModuleIndex(me){
		return me.selectedIndex;
	}

	function fncSelectModuleText(me){
		return me.options[me.selectedIndex].text;
	}

	function fncSelectModuleValue(me){
		return me.options[me.selectedIndex].value;
	}
	
	function fncSelectModuleRemoveByValue(me, value){
		for ( var j = 0; j < me.options.length; j++ )
		{
			if (me.options[j].value==value)
			{
				me.options[j] = null;
			}
		}
	}

	function fncSelectModuleRemoveByText(me, text){
		for ( var j = 0; j < me.options.length; j++ )
		{
			if (me.options[j].text==text)
			{
				me.options[j] = null;
			}
		}
	}

	function fncSelectModuleRemoveByIndex(me, index){
		if (me.options[index]!=null)
		{
			me.options[index] = null;
		}
	}

    function fncSelectModuleSort(me){
    
		for ( var j = me.options.length-1; j > 0; j-- )
		{
			for ( var i = 0; i < j; i++ )
			{
				if( me.options[i+1].text < me.options[i].text )
				{
					var a = new Option(me.options[i+1].text, me.options[i+1].value);;
					var b = new Option(me.options[i].text, me.options[i].value);;
					me.options[i+1] = b;
					me.options[i] = a;
				
				}
			}
		}
    }
    
    function fncSelectModuleAdd(me, text, value)
    {
	    me.options[me.options.length] = new Option(text, value); 
        me.selectedIndex = me.options.length-1;
    }
		
//************************************************************************//
//************************************************************************//
//** CONSOLE MODULE START 

	function ConsoleModule()
	{
		this.field = null;
		this.initialize = fncConsoleModuleInit;
		this.write = fncConsoleModuleWrite;
		this.clear = fncConsoleModuleClear;
	
	}

	function fncConsoleModuleClear(str)
	{
		if (this.field == null) this.initialize();
		
		this.field.innerText = ""; 
	}
	
	function fncConsoleModuleWrite(str)
	{
		if (this.field == null) this.initialize();
		
		this.field.innerText =  str + "\n" + this.field.innerText; 
	}
	
	function fncConsoleModuleInit()
	{
		d = document.createElement("DIV");
		d.innerText = ""; 
		d.style.paddingTop = "5px";
		d.style.paddingBottom = "5px";
		d.style.paddingLeft = "5px";
		d.style.paddingRight = "5px";
		d.style.height = "80px";
		d.style.borderTop = "inset";
		d.style.borderBottom = "inset";
		d.style.borderLeft = "inset";
		d.style.borderRight = "inset";
		d.style.overflow = "auto";
		d.style.fontFamily = "Courier New";
		d.style.fontSize = "12px";
		
		document.body.insertBefore(d, document.body.firstChild);

		this.field = d;
		
	}


//** CONSOLE MODULE STOP 
//************************************************************************//
//************************************************************************//
