function SelectFirstBook(){
	GlOrigen = 1;
	GetUsersBooks();
}
function OnLoadGetBooksPics(){
	//GlOrigen = 1;
	xOptions = String(window.location.search).split("&");
	xData = xOptions[0].split("="); //Opciones: showbook, showphoto
	switch(xData[1])
	{
		case 'showbook':
			xBook = xOptions[1].split("=");
		break;
		case 'showphoto':
			xPhoto = xOptions[1].split("=");
			xBook = xOptions[2].split("=");
			GlOrigen = xPhoto[1];
		break;
	}
	GetBook(xBook[1]);
}
function testproperties(){
	alert(document.FrmConf.BtnPublic[0].checked); //¿Seleccionado el boton 0?
	alert(document.FrmConf.SelGroup.value); //¿Valor seleccionado?
}
function Getfunc(xFunc){
	GlFunc = xFunc;
	xString = 'op=GetFunction&Func=' + xFunc;
	var AjaxShowfunc = new req('AjaxShowfunc');
	var xShowFunc = new ShowFunc();
	AjaxShowfunc.xmlhttpPost('ops.php', xShowFunc,xString);
}
function ShowFunc(){
	this.callBackFunction = function(xTxt) 
	{
		document.getElementById('ActionBookPnl').innerHTML = xTxt;
		if(GlFunc == 2)
		{
			document.getElementById('xBook').value = GlCurrentBook;
			GlFileBox = 0;
		}
	}
}
function AddFileBox(){
	GlFileBox++;
	xFunction='this.select()';
	xFile = document.createElement("input");
	xFile.setAttribute("type","file");
	xFile.setAttribute("name","uploadedfile_" + GlFileBox);
	xName = document.createElement("input");
	xName.setAttribute("type","text");
	xName.setAttribute("value","Nombre");
	xName.setAttribute("name","Namefile_" + GlFileBox);
	xName.id = "Namefile_" + GlFileBox;
	xName.setAttribute("size","30" + GlFileBox);
	xName.onfocus = selectcontent;
	xDesc = document.createElement("textarea");
	xDesc.name = "Desc_" + GlFileBox;
	xDesc.rows ="3";
	xDesc.cols ="31";
	xDesc.value ='Descripción de la Imagen';
	xDesc.onfocus = selectcontent;
	document.getElementById('ImagesForm').appendChild(xFile);
	document.getElementById('ImagesForm').appendChild(xName);
	document.getElementById('ImagesForm').appendChild(xDesc);
	
	document.getElementById('xFiles').value = GlFileBox;
}
function selectcontent(){
	this.select();
}
function ChangeDivColor(xBookID){
	if (GlCurrentBook != 0)
	{
		document.getElementById('book_'+ GlCurrentBook).style.backgroundColor = '#ffffff';
	}
	GlCurrentBook = xBookID;
	document.getElementById('book_'+ GlCurrentBook).style.backgroundColor = 'orange';
}
function ChangeDivPicColor(xDiv){
	document.getElementById('ShowPic_'+ GlCurrentPhoto).style.backgroundColor = '#ffffff';
	document.getElementById('ShowPic_'+ xDiv).style.backgroundColor = 'orange';
}
function EnableAplicar(xAction){
	if(xAction)
	{
		document.getElementById('BtnAplicar').disabled = false;
	}
	else
	{
		document.getElementById('BtnAplicar').disabled = true;
	}
}
function BringToFront(xResPannel){
	switch(xResPannel)
	{
		case 1:
			document.getElementById('SelResPhotos').style.backgroundColor = '#FFA500';
			document.getElementById('SelResBooks').style.backgroundColor = '#eeeeee';
			document.getElementById('SelResUsers').style.backgroundColor = '#eeeeee';
			document.getElementById('ResPhotos').style.zIndex = 1;
			document.getElementById('ResBooks').style.zIndex = -1;
			document.getElementById('ResUsers').style.zIndex = -2;
		break;
		case 2:
			document.getElementById('SelResPhotos').style.backgroundColor = '#eeeeee';
			document.getElementById('SelResBooks').style.backgroundColor = '#FFA500';
			document.getElementById('SelResUsers').style.backgroundColor = '#eeeeee';
			document.getElementById('ResPhotos').style.zIndex = -1;
			document.getElementById('ResBooks').style.zIndex = 1;
			document.getElementById('ResUsers').style.zIndex = -2;
		break;
		case 3:
			document.getElementById('SelResPhotos').style.backgroundColor = '#eeeeee';
			document.getElementById('SelResBooks').style.backgroundColor = '#eeeeee';
			document.getElementById('SelResUsers').style.backgroundColor = '#FFA500';
			document.getElementById('ResPhotos').style.zIndex = -1;
			document.getElementById('ResBooks').style.zIndex = -2;
			document.getElementById('ResUsers').style.zIndex = 1;
		break;
	}
}
/*
function EnableSelectGroup(xAction){
	if(xAction)
	{
		document.getElementById('SelGroup').disabled = false;
	}
	else
	{
		document.getElementById('SelGroup').disabled = true;
	}
}
*/
