		var partValue = 'divApuntes';
		function getFiles(value){
			if (partValue != '')
				$('#' + partValue).hide('fast');
			$('#' + value).show('fast');

			partValue = value;
		}; 		

		function loadVideo(url){
			document.getElementById("videoLink").innerHTML = '<iframe src="../cursos/getYouTube.php?url=' + url + '"  frameBorder="0" width="465" height="374"></iframe>';

		}


		
		function saveMsj(id){
			comm	= document.getElementById('comText').value;
			comm	= comm.replace(/\"/g, '\'');

			if (comm != ''){
				var AJ = new Ajax();
				try{
					AJ.setUrl("viewClass.php");
					AJ.setVar("classId", id);
					AJ.setVar("saveComment", 1);
					AJ.setVar("comment", comm);
					AJ.setMethod("POST");
					AJ.setOnLoading(sendingComment);
					AJ.setOnComplete(completeComment);
					AJ.connect();
					AJ.getData();
				}catch(e){
				}
			}
		}


		function sendingComment(){
			document.getElementById("spanLoad").innerHTML = "<img src='../common/images/ajax-loader.gif' style='vertical-align: middle'> Enviando...";
		}

		function completeComment(httpRequest,AJ){
			photo	= document.getElementById("userPhoto").value;
			name	= document.getElementById("userName").value;
			comm	= document.getElementById('comText').value;

			var resp = httpRequest.responseText;

			if ((resp == "1") || (resp == 1)){
				document.getElementById("spanComment").innerHTML = '<table class="tableMsjComplete"><tr><td class="tdMessage" align="center" width="90"><img src="../common/images/fotos/' + photo + '" class="photoMessage"></td><td class="tdMessage"><div style="font-size: 9px"><b>De:</b> ' + name + '<br></div><br>' + comm + '</td></tr></table>' + document.getElementById("spanComment").innerHTML;

				document.getElementById("inCant").value = parseInt(document.getElementById("inCant").value) + 1;
				document.getElementById("spanCant").innerHTML = document.getElementById("inCant").value;
				
				document.getElementById("spanLoad").innerHTML = "";
				document.getElementById('comText').value = "";
			}
			else{
				blockDefaultErrorMsg();
			}
		}


		function makeComm(){
			comm	= document.getElementById('trComment');
			insComm = document.getElementById('trMakeComm');

			comm.style.display		= 'block';
			insComm.style.display	= 'none';
		}


		//--------- SAVE CLASS EDITOR --------------
		function showClassEditor(){
			document.getElementById('classDataEdit').style.display = 'block';
			document.getElementById('classData').style.display = 'none';
		}

		function cancelClassEditor(){
			document.getElementById('classDataEdit').style.display = 'none';
			document.getElementById('classData').style.display = 'block';
		}


		//--------- NEW FILE --------------
		function changeApunteClase(value){
			var AJ = new Ajax();
			try{
				AJ.setUrl("newClassFileAjax.php");
				AJ.setVar("changeApunteClase", 1);
				AJ.setVar("apunteId", document.getElementById("selApunteClase").value);
				AJ.setVar("classId", document.getElementById("classId").value);
				AJ.setMethod("POST");
				AJ.setOnLoading(changeApunteClaseLoading);
				AJ.setOnComplete(changeApunteClaseComplete);
				AJ.connect();
				AJ.getData();
			}catch(e){
			}
		}

		function changeApunteClaseLoading(){
			blockLoadingMsg('Enviando...');
		}

		function changeApunteClaseComplete(httpRequest,AJ){
			var resp = httpRequest.responseText;

			if ((resp == "1") || (resp == 1)){
				blockOkMsg('Apunte de clase cambiado correctamente.', 1);
				openClass(document.getElementById("classId").value);
			}
			else{
				blockDefaultErrorMsg(resp);
			}
		}


		//--------- NEW FILE --------------
		function newFile(value){
			var AJ = new Ajax();
			try{
				AJ.setUrl("newClassFileAjax.php");
				AJ.setVar("addFile", 1);
				AJ.setVar("typeFile", value);
				AJ.setMethod("POST");
				AJ.setOnLoading(newFileLoading);
				AJ.setOnComplete(newFileComplete);
				AJ.connect();
				AJ.getData();
			}catch(e){
			}
		}

		function newFileLoading(){
			blockLoadingMsg('Cargando...');
		}

		function newFileComplete(httpRequest,AJ){
			blockCustomMsg(httpRequest.responseText, 260, 360);
		}

		function saveFile(value){
			var name		= document.getElementById("fileNameUpload").value;
			var desc		= document.getElementById("fileDescUpload").value;

			if (value == 'apunte')
				var apunteClase = document.getElementById("checkApunteClase").checked;

			if ((name == '') || (desc == ''))
				document.getElementById("spanError").innerHTML = 'Complete los campos obligatorios. Si está subiendo un apunte, presione el botón "Subir Archivo".';
			else{
				var AJ = new Ajax();
				try{
					AJ.setUrl("newClassFileAjax.php");
					AJ.setVar("saveFile", 1);
					AJ.setVar("classId", document.getElementById("classId").value);
					AJ.setVar("typeFile", value);
					AJ.setVar("fileName", name);
					AJ.setVar("fileDesc", desc);
					AJ.setVar("apunteClase", apunteClase);
					AJ.setMethod("POST");
					AJ.setOnLoading(newFileLoading);
					AJ.setOnComplete(saveFileComplete);
					AJ.connect();
					AJ.getData();
				}catch(e){
				}
			}
		}

		function saveFileComplete(httpRequest,AJ){
			var resp = httpRequest.responseText;
			resp = resp.replace(/^\s*|\s*$/g,"");

			switch(resp){
				case 'apunte':
					blockOkMsg('Apunte agregado correctamente.', 1);
					openClass(document.getElementById("classId").value);
					break;
				case 'webcast':
					blockOkMsg('Webcast agregado correctamente.', 1);
					openClass(document.getElementById("classId").value);
					break;
				case 'link':
					blockOkMsg('Link agregado correctamente.', 1);
					openClass(document.getElementById("classId").value);
					break;
				default:
					blockDefaultErrorMsg(resp);
			}
		}

		
		// ------------- DELETE FILE -----------------------
		function deleteFileMsg(type, id){
			blockInfoMsg('Está seguro que desea eliminar éste ' + type + '?<br><br><input type="button" value="Aceptar" class="inputButton" onclick="deleteFile(\'' + type + '\',' + id + ')">&nbsp;&nbsp;<input type="button" value="Cancelar" class="inputButton" onclick="myUnblockUI()">',0);
		}


		function deleteFile(type, id){
			var AJ = new Ajax();
			try{
				AJ.setUrl("newClassFileAjax.php");
				AJ.setVar("deleteFile", 1);
				AJ.setVar("fileId", id);
				AJ.setVar("typeFile", type);
				AJ.setMethod("POST");
				AJ.setOnLoading(deleteFileLoading);
				AJ.setOnComplete(deleteFileComplete);
				AJ.connect();
				AJ.getData();
			}catch(e){
			}
		}

		function deleteFileLoading(){
			blockLoadingMsg('Eliminando...');
		}

		function deleteFileComplete(httpRequest,AJ){
			var resp = httpRequest.responseText;
			resp = resp.replace(/^\s*|\s*$/g,"");

			switch(resp){
				case 'apunte':
					blockOkMsg('Apunte eliminado correctamente.', 1);
					openClass(document.getElementById("classId").value);
					break;
				case 'webcast':
					blockOkMsg('Webcast eliminado correctamente.', 1);
					openClass(document.getElementById("classId").value);
					break;
				case 'link':
					blockOkMsg('Link eliminado correctamente.', 1);
					openClass(document.getElementById("classId").value);
					break;
				default:
					blockErrorMsg(resp,1);
				//	blockDefaultErrorMsg(resp);
			}
		}

