function randOrd(){
	return (Math.round(Math.random())-0.5); 
}
function CargarAviso(texto, articulo){
	getById('TextoAviso').innerHTML = texto;
	getById('LinkAviso').href = articulo;
}

function CrearCarpeta(Form){

	Elementos = getInnerHtml('Carpetas-Elementos');

	new Ajax.Request('Ajax/Source/ProcCrearCarpeta.php', {
		method:'post',
		parameters:'Tipo='+Form.Tipo.value+'&IdPadre='+Form.IdPadre.value+'&Nombre='+Form.Nombre.value,
		onSuccess: function(back){
			setInnerHtml('Carpetas-Elementos', Elementos+back.responseText)
			Carpeta.Destroy()
		}
	})

	return false;
}

function EliminarPagina(Form){
	if(Confirmar('¿Realmente desea eliminar esta pagina?')){
		document[Form].submit()
	}
}

function EliminarCarpeta(Form){
	if(Confirmar('Si elimina esta carpeta se perderan todos los contenidos en ella ¿Realmente desea continuar?')){
		document[Form].submit()
	}
}

function EliminarImagen(Form){
	if(Confirmar('¿Realmente desea eliminar esta imagen?')){
		document[Form].submit()
	}
}

function EliminarVideo(Form){
	if(Confirmar('¿Realmente desea eliminar este Video?')){
		document[Form].submit()
	}
}

function EliminarTabla(Form){
	if(Confirmar('¿Realmente desea eliminar esta Tabla?')){
		document[Form].submit()
	}
}

function EliminarFormulario(Form){
	if(Confirmar('¿Realmente desea eliminar esta formulario?')){
		document[Form].submit()
	}
}

function CancelAddFolder(){
	Carpeta.Destroy()
}

function CampoVideo(Opcion){
	
	setInnerHtml('LoaderField', '')
	
	switch(Opcion){
	
		case '1':
			Objeto 				= document.createElement('input')
			Objeto.type 		= 'file'
			Objeto.name 		= 'Video'
			Objeto.className 	= 'Input'
			getById('LoaderField').appendChild(Objeto)
			
		break;
		
		
		case '2':
			Objeto 				= document.createElement('input')
			Objeto.type 		= 'text'
			Objeto.name 		= 'Video'
			Objeto.className 	= 'Input'
			Objeto.size	 		= '40'
			setInnerHtml('LoaderField', 'Pagina del video:')
			getById('LoaderField').appendChild(Objeto)
		break;
	}
}
