function cms() {

	arrArgs = cms.arguments;

	boolPopup = true;

	switch (arrArgs[0]) {

		

		case 'add':

			switch (arrArgs[1]) {

				case 'blocks':

					strFile = '/cms/blocks.php?intPage='+arrArgs[2]; strWindowName = 'cms_blocks'; intWidth = 600; intHeight = 600;

					break;

				case 'forum.sections':

					strFile = '/cms/forum.sections.php'; strWindowName = 'cms_blocks'; intWidth = 600; intHeight = 250;

					break;

				case 'pages':

					strFile = '/cms/pages.php?intSection='+arrArgs[2]+'&intPage='+arrArgs[3]; strWindowName = 'cms_pages'; intWidth = 500; intHeight = 400;

					break;

				case 'partners':

					strFile = '/cms/partners.php?intCategory='+arrArgs[2]; strWindowName = 'cms_partners'; intWidth = 500; intHeight = 350;

					break;

				default:

					boolPopup = false;

					break;

			}

			break;

		

		case 'modify':

			switch (arrArgs[1]) {

				case 'archive':

					strFile = '/cms/blocks.php?id='+arrArgs[2]+'&intDocument='+arrArgs[3]; strWindowName = 'cms_blocks'; intWidth = 500; intHeight = 600;

					break;

				case 'blocks':

					strFile = '/cms/blocks.php?id='+arrArgs[2]; strWindowName = 'cms_blocks'; intWidth = 600; intHeight = 600;

					break;

				case 'files':

					strFile = '/cms/blocks.php?id='+arrArgs[2]+'&intFile='+arrArgs[3]; strWindowName = 'cms_blocks'; intWidth = 500; intHeight = 600;

					break;

				case 'forum.sections':

				case 'forum.subjects':

					strFile = '/cms/'+arrArgs[1]+'.php?id='+arrArgs[2]; strWindowName = 'cms_forum'; intWidth = 500; intHeight = 250;

					break;
				
				case 'formations.event':
					strFile = '/cms/'+arrArgs[1]+'.php?id='+arrArgs[2]; strWindowName = 'cms_blocks'; intWidth = 500; intHeight = 600;
					break;
				
				case 'news':

					strFile = '/cms/blocks.php?id='+arrArgs[2]+'&intNews='+arrArgs[3]; strWindowName = 'cms_blocks'; intWidth = 500; intHeight = 600;

					break;

				case 'pages':

					strFile = '/cms/pages.php?id='+arrArgs[2]; strWindowName = 'cms_pages'; intWidth = 500; intHeight = 400;

					break;

				case 'partners':

					strFile = '/cms/partners.php?id='+arrArgs[2]; strWindowName = 'cms_partners'; intWidth = 500; intHeight = 350;

					break;

				case 'text':

					strFile = '/cms/text.php?id='+arrArgs[2]; strWindowName = 'cms_text'; intWidth = 500; intHeight = 600;

					break;

				case 'team':

					strFile = '/cms/blocks.php?id='+arrArgs[2]+'&intTeam='+arrArgs[3]; strWindowName = 'cms_blocks'; intWidth = 500; intHeight = 600;

					break;

				default:

					boolPopup = false;

					break;

			}

			break

		

		case 'down':

		case 'up':

			switch (arrArgs[1]) {

				case 'blocks':

				case 'blocks.files':

				case 'blocks.team':

				case 'partners':

					xmlHttp = GetXmlHttpObject()

					if (xmlHttp == null) return;

					var strUrl = "/cms/"+arrArgs[1]+".php?strAction="+arrArgs[0]+"&id="+arrArgs[2];

					xmlHttp.onreadystatechange = function() {

						if (xmlHttp.readyState == 4) {

							var strResponseText = xmlHttp.responseText;

							document.getElementById('cms_content').innerHTML = strResponseText;

						}

					}

					xmlHttp.open("GET",strUrl,true);

					xmlHttp.send(null);

					boolPopup = false;

					break;

				default:

					boolPopup = false;

					break;

			}

			break;

		

		case 'delete':

			var boolConfirm = confirm("Voulez-vous vraiment supprimer cet item ?");

			if (boolConfirm == true) {

				switch (arrArgs[1]) {

					case 'ads':

						strFile = '/cms/ads.php?strAction=delete&id='+arrArgs[2]; strWindowName = 'cms_ads'; intWidth = 50; intHeight = 50;

						break;

					case 'blocks':

						xmlHttp = GetXmlHttpObject()

						if (xmlHttp == null) return;

						var strUrl = "/cms/blocks.php?strAction=delete&id="+arrArgs[2];

						xmlHttp.onreadystatechange = function() {

							if (xmlHttp.readyState == 4) {

								var strResponseText = xmlHttp.responseText;

								document.getElementById('cms_content').innerHTML = strResponseText;

							}

						}

						xmlHttp.open("GET",strUrl,true);

						xmlHttp.send(null);

						boolPopup = false;

						break;

					case 'archive':

					case 'files':

					case 'team':

						xmlHttp = GetXmlHttpObject()

						if (xmlHttp == null) return;

						var strUrl = "/cms/blocks."+arrArgs[1]+".php?strAction=delete&id="+arrArgs[2];

						xmlHttp.onreadystatechange = function() {

							if (xmlHttp.readyState == 4) {

								var strResponseText = xmlHttp.responseText;

								document.getElementById('cms_content').innerHTML = strResponseText;

							}

						}

						xmlHttp.open("GET",strUrl,true);

						xmlHttp.send(null);

						boolPopup = false;

						break;
					
					case 'formations.event':

					case 'forum.posts':

					case 'forum.sections':

					case 'forum.subjects':

					case 'pages':

					case 'partners':

					case 'users':

						strFile = '/cms/'+arrArgs[1]+'.php?strAction=delete&id='+arrArgs[2]; strWindowName = 'cms_delete'; intWidth = 50; intHeight = 50;

						break;

					case 'news':

						strFile = '/cms/blocks.news.php?strAction=delete&id='+arrArgs[2]; strWindowName = 'cms_news'; intWidth = 50; intHeight = 50;

						break;

				}

			} else {

				boolPopup = false;

			}

			break

		

		case 'activate':

		case 'desactivate':

			xmlHttp = GetXmlHttpObject()

			if (xmlHttp == null) return;

			var strUrl = "/cms/?strAction="+arrArgs[0];

			xmlHttp.onreadystatechange = function() {

				if (xmlHttp.readyState == 4) {

					document.location.reload();

				}

			}

			xmlHttp.open("GET",strUrl,true);

			xmlHttp.send(null);

			boolPopup = false;

			break;

		

		default:

			boolPopup = false;

			break;



	}

	if (boolPopup) {

		var intTop = (screen.height - intHeight) / 2;

		var intLeft = (screen.width - intWidth) / 2;

		wndwPopup = window.open(strFile,strWindowName,'width='+intWidth+', height='+intHeight+', top='+intTop+', left='+intLeft+', scrollbars=yes, resizable');

		if (arrArgs[0] != 'delete') {

			wndwPopup.focus();

		}

	}

}



function ajaxTableOptions() {

	xmlHttp = GetXmlHttpObject()

	if (xmlHttp == null) {

		return;

	}

	var strUrl = "/cms/blocks.table.php?strAction="+document.getElementById('slt_table_action').value+"&strLine="+document.getElementById('slt_table_line').value+"&intRows="+document.getElementById('ipt_table_rows').value+"&intCols="+document.getElementById('ipt_table_cols').value+"&intOffset="+document.getElementById('slt_table_offset').value;

	xmlHttp.onreadystatechange = function() {

		if (xmlHttp.readyState == 4) {

			var strResponseText = xmlHttp.responseText;

			document.getElementById('div_slt_offset').innerHTML = strResponseText;

		}

	}

	xmlHttp.open("GET",strUrl,true);

	xmlHttp.send(null);

}



function checkall(strForm,strName,boolChecked) {

	for (var i = 0; i < strForm.elements.length; i++) {

		while (strForm.elements[i].name != strName && strForm.elements[i].name != strName+"[]") {

			i++;

			if (!strForm.elements[i]) {

				return;

			}

		}

		strForm.elements[i].checked = boolChecked;

	}

}


