// JavaScript Document/** *	Partie concernant la construction dynamique du HTML */// Titles, Tags, Categoriesfunction getTitleHTML(Title,color){	var	textNode = document.createTextNode( Utf8.decode(Title.subject) );	var	link = document.createElement("a");		link.appendChild(textNode);		link.setAttribute('href','#');		if (color == 1) {link.style.color = "black";}		//document.addEvent(link,'click',loadTopic(Title.id));		if (color == 2) {link.className = "title_link2";}		if (color == 3) {link.className = "title_link3";}			link.onclick = function(){ checkTopic(Title.id);	}		//var	li = document.createElement("LI");	//	li.appendChild(link);		//cellTitle.appendChild(li);			return link;}function getTagHTML(Tag){		var	textNode = document.createTextNode( Utf8.decode(Tag.subject)+"("+Tag.entries+")" );	var	link = document.createElement("a");		link.appendChild(textNode);		link.setAttribute('href','#');		//document.addEvent(link,'click',loadTopic(Title.id));		if (category == 3) {link.onclick = function(){ window.open("./admin/tagEdit.php?tagId="+Tag.id, this.target, 'toolbar=no,location=yes,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=500,height=600');}}		else{link.onclick = function(){ searchTag(Tag);	}	}		return link;}function getTopTagHTML(Tag,color){		var	textNode = document.createTextNode( Utf8.decode(Tag.subject)+" " );	var	link = document.createElement("a");		link.appendChild(textNode);		link.setAttribute('href','#');		if (color==1) {link.className = "tag_link";}		if (color == 2) {link.className = "tag_link2"; }		if (color == 3) {link.className = "tag_link3";}		if (color == 4) {link.className = "tag_link4";}		link.onclick = function(){ searchTag(Tag);	}			return link;}function getCatRankHTML(Cat){		var	textNode = document.createTextNode( Utf8.decode(Cat.subject)+" " );	var	link = document.createElement("a");		link.appendChild(textNode);		link.setAttribute('href','#');		link.className = "tag_link4";		link.onclick = function(){ searchCat(Cat);	}			return link;}function getCategoryHTML(Cat){		var	textNode = document.createTextNode( Utf8.decode(Cat.subject)+" " );	// alert (Utf8.decode(Cat.subject))	var	link = document.createElement("a");		link.appendChild(textNode);		link.setAttribute('href','#');		link.className = "cat_link";		if (category == 3) {link.onclick = function(){ window.open("./admin/catEdit.php?categoryId="+Cat.id, this.target, 'toolbar=no,location=yes,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=500,height=600');}}		else{link.onclick = function(){ searchCat(Cat);	}	}						return link;}function getRelatedHTML(topic){		processRemoveAllTopicItems(topic.id);		var information = document.createElement("img");	information.src = rootImage+"cerrar_comments"+extension;	information.className = "link";	information.onclick = function(){	 rolloverMyItem2(topic);}//alert("no hay ningun comentario!!")	}			// Création du tableau composant l'item	var itemTable = document.createElement("table");    var itemTablebody = document.createElement("tbody");	var itemTable_row = document.createElement("tr");				Item_AddCellInRow( itemTable_row, "RANKINGS RELACIONADOS", null, "item_name2" );	Item_AddCellInRow( itemTable_row, null, information, "item_up" );	itemTablebody.appendChild(itemTable_row);	itemTable.appendChild(itemTablebody);						var itemHTML = document.createElement("div");	itemHTML.className = "itemComments";	itemHTML.appendChild( itemTable );		getRelated(topic.id);			return itemHTML;}//Topicsfunction getTopicHTML(Topic){//creacio del topic	var topicHTML = document.createElement("div");	topicHTML.id = "topic_"+Topic.id;	topicHTML.className = "topic_max";			var TableMax = createTableMax(Topic);	//var TableMin = createTableMin(Topic);			topicHTML.appendChild( TableMax );			return topicHTML;}function getTopic2HTML(Topic){//creacio del topic	var topicHTML = document.createElement("div");	topicHTML.id = "topic_"+Topic.id;	topicHTML.className = "topic_min";			//var TableMax = createTableMax(Topic);	var TableMin = createTableMin(Topic);			topicHTML.appendChild( TableMin );			return topicHTML;}function getTopicTitleHTML(topic,min){	var t = document.createElement("table")    var tbody = document.createElement("tbody");	var tr = document.createElement("tr");	var cellFavorits = document.createElement("td");		cellFavorits.className = "topic_title_delete";		var favBtn = document.createElement("img");			favBtn.id = "estrella_"+topic.id;			favBtn.setAttribute('title',"Agregar a Favoritos");			favBtn.onmouseover = function(){ linkShow(this);}			favBtn.onmouseout = function(){linkHide(this);}			favBtn.src = rootImage+"estrellaOff"+extension;			favBtn.className = "link";			if (category < 2){				favBtn.onclick = function(){	alert1("Hay que estar registrado para añadir un ranking a Favoritos")	}			}else{				favBtn.onclick = function(){	getFavorit(topic.id);	}				}		cellFavorits.appendChild(favBtn);		tr.appendChild(cellFavorits);				var cellTitle = document.createElement("td");		cellTitle.className = "topic_title_subject";		if (min == 1) {cellTitle.style.color = '#0044AA';}		cellTitle.onclick = function(){ expanding(topic);}		//alert (topic.subject+"  "+Utf8.decode(topic.subject) )		var talla = tamany(topic.subject);				switch (talla){			case 0:				cellTitle.style.fontSize=12				break;							case 1:				cellTitle.style.fontSize=10;				//alert ("10")				break;			case 2:				//alert ("8")				cellTitle.style.fontSize=9;				break;		}				textNode = document.createTextNode(Utf8.decode(topic.subject) );	    cellTitle.appendChild(textNode);		tr.appendChild(cellTitle);	var cellDelete = document.createElement("td");		cellDelete.className = "topic_title_delete";		var delBtn = document.createElement("img");			delBtn.src = rootImage+"cerrar_ranking"+extension;			delBtn.className = "link";			if (category < 3){				delBtn.onclick = function(){	processRemoveTopic(topic.id);	}//alert ("hauria de funcionar!!!")}			}else{				delBtn.onclick = function(){	removeTopic(topic.id,topic.subject);	}				}	    cellDelete.appendChild(delBtn);		tr.appendChild(cellDelete);	tbody.appendChild(tr);    t.appendChild(tbody);	return t;	}function tamany(string){	//alert (string.length)	if (string.length<35) {		return 0;	}if((string.length>35)&&(string.length<60)){		return 1;	}if(string.length>60){		return 2;	}}// Creation Buttons Tablesfunction createTableMax(Topic){	var TableMax = document.createElement("table");	TableMax.id = "topic_table_max_"+Topic.id;	TableMax.border= 0;	TableMax.setAttribute('cellSpacing',"0"); 	TableMax.setAttribute('cellPadding',"0"); 	var absolut = "";		var TablebodyMax = document.createElement("tbody");	if (Topic.absolut == 1) {absolut = "_abs"};	// Création du titre...	var Top_row = document.createElement("tr");		var topLeft = document.createElement("td");		topLeft.className = "tdtopleft"+absolut;  		topLeft.style.width  = 15;	 	 topLeft.style.height = 37;		 		 Top_row.appendChild(topLeft);		var topCenter = document.createElement("td");		 topCenter.className = "tdtop"+absolut;		 topCenter.style.width  = 228;		 topCenter.style.height = 37;		 //topCenter.onclick = function(){ impanding(Topic);}		 topCenter.id = "topic_title_"+Topic.id;		 topCenter.appendChild( getTopicTitleHTML(Topic,0));		 Top_row.appendChild(topCenter);				var topRight = document.createElement("td");		 topRight.className = "tdtopright"+absolut; 		topRight.style.width  = 15;		 topRight.style.height = 37;		//topRight.appendChild(cornerTopRight)		Top_row.appendChild(topRight);	TablebodyMax.appendChild(Top_row);		var Center_row = document.createElement("tr");		var centerLeft = document.createElement("td");		 centerLeft.className = "tdcenter"+absolut;		 centerLeft.style.width  = 15;	 	 centerLeft.style.height = 250;		 Center_row.appendChild(centerLeft);		var centerCenter = document.createElement("td");		 centerCenter.className = "tdcenter"+absolut;		 centerCenter.style.width  = 228;		 centerCenter.style.height = 250;				var content = document.createElement("div");		content.className="content";		content.id = "topic_content_"+Topic.id;	//	content.onclick = function(){/* rolloverMyItem("Content");*/ } //mirar com es posen els items			centerCenter.appendChild(content);				 Center_row.appendChild(centerCenter);				var centerRight = document.createElement("td");		 centerRight.className = "tdright"+absolut;		 centerRight.style.width  = 15;		 centerRight.style.height = 250;		 centerRight.id = "right_"+Topic.id;		Center_row.appendChild(centerRight);	TablebodyMax.appendChild(Center_row);		var Bottom_row = document.createElement("tr");		var bottomLeft = document.createElement("td");		 bottomLeft.className = "tdbottomleft"+absolut; 		bottomLeft.style.width  = 15;	 	 bottomLeft.style.height = 95;		 //bottomLeft.appendChild(cornerBottomLeft)		Bottom_row.appendChild(bottomLeft);					var tagTable = document.createElement("table");			tagTable.setAttribute('cellSpacing',"0"); 			tagTable.setAttribute('cellPadding',"0");	    	var tagTablebody = document.createElement("tbody");			var tagTable_row1 = document.createElement("tr");			var tagTable_row2 = document.createElement("tr");			var tagTable_td1 = document.createElement("td");			tagTable_td1.id = "catXtopic_"+Topic.id;			tagTable_td1.style.align = "top";			tagTable_td1.style.width  = 228;			tagTable_td1.style.height = 10;			var tagTable_td2 = document.createElement("td");			tagTable_td2.id = "tagXtopic_"+Topic.id;			tagTable_td2.style.align = "top";			tagTable_td2.style.width  = 228;			tagTable_td2.style.height = 20;			tagTable_row1.appendChild(tagTable_td1);			tagTable_row2.appendChild(tagTable_td2);			tagTablebody.appendChild(tagTable_row1);			tagTablebody.appendChild(tagTable_row2);	    	tagTable.appendChild(tagTablebody);						var commentTable = document.createElement("table");	    	var commentTablebody = document.createElement("tbody");			var commentTable_row = document.createElement("tr");			var commentTable_row2 = document.createElement("tr");			var commentTable_td = document.createElement("td");			commentTable_td.id = "commentsXtopic_"+Topic.id;			commentTable.setAttribute('cellSpacing',"3"); 			commentTable.setAttribute('cellPadding',"0");							var	Tag = document.createTextNode( "Mandar a un amigo" );			var	tags = document.createElement("a");					tags.appendChild(Tag);					tags.setAttribute('href','#');					tags.className = 'SendAfriend';					tags.onclick = function() {window.open("./sendAfriend.php?topicId="+Topic.id, this.target, 'toolbar=no,location=yes,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=500,height=600');}			var	rank = document.createTextNode( "Rankings Relacionados" );			var	related = document.createElement("a");					related.appendChild(rank);					related.setAttribute('href','#');					related.className = 'SendAfriend';					related.onclick = function(){rolloverRelated(Topic);}		 		/*allComments = document.createElement("img");		 		allComments.src = rootImage+"AllComments"+extension;   		 		allComments.className = "link";		 		allComments.style.align = "center";*/		 					//alert(Topic.author)			// Item_AddCellInRow( commentTable_row, null, allComments, "item_down" );			Item_AddCellInRow( commentTable_row, null, related, "topic_author" );			Item_AddCellInRow( commentTable_row, null, tags, "topic_author2" );			commentTable_row2.appendChild(commentTable_td);			//Item_AddCellInRow( commentTable_row2, null, comments, "topic_author" );			if (Topic.author != "") {								if (Topic.toconfirm == 1) {Item_AddCellInRow( commentTable_row2, "Por Confirmar", null, "toconfirm2" );}				else{Item_AddCellInRow( commentTable_row2, "by "+Topic.author, null, "topic_author2" );}			}							commentTablebody.appendChild(commentTable_row);			commentTablebody.appendChild(commentTable_row2);	    	commentTable.appendChild(commentTablebody);		var bottomCenter = document.createElement("td");		 bottomCenter.className = "tdbottom"+absolut;		 bottomCenter.style.width  = 228;		 bottomCenter.style.height = 95;		bottomCenter.appendChild(tagTable);		 bottomCenter.appendChild(commentTable);				Bottom_row.appendChild(bottomCenter);						var bottomRight = document.createElement("td");		bottomRight.className = "tdbottomright"+absolut;		bottomRight.id = "corner_bottom_right_"+Topic.id;  		bottomRight.style.width  = 15;		bottomRight.style.height = 95;		bottomRight.id = "bottom_right_"+Topic.id;		//bottomRight.appendChild(cornerBottomRight)		Bottom_row.appendChild(bottomRight);	TablebodyMax.appendChild(Bottom_row);	TableMax.appendChild(TablebodyMax);		return TableMax;}function createTableMin(Topic){		var TableMin = document.createElement("table");	TableMin.id = "topic_table_min_"+Topic.id;	TableMin.border= 0;	TableMin.setAttribute('cellSpacing',"0"); 	TableMin.setAttribute('cellPadding',"0");	var absolut = "";		if (Topic.absolut == 1) {absolut = "_abs"};		var TablebodyMin = document.createElement("tbody");	var Top_row = document.createElement("tr");		var topLeft = document.createElement("td");		topLeft.className = "tdleftlittle"+absolut;  		topLeft.style.width  = 20;	 	 topLeft.style.height = 52;		 //topLeft.appendChild(cornerTopLeft)		 Top_row.appendChild(topLeft);		var topCenter = document.createElement("td");		 topCenter.className = "tdcenterlittle"+absolut;		 topCenter.style.width  = 200;		 topCenter.style.height = 52;		//topCenter.onclick = function(){ expanding(Topic);}		 topCenter.appendChild(getTopicTitleHTML(Topic,1));		 Top_row.appendChild(topCenter);				var topRight = document.createElement("td");		 topRight.className = "tdrightlittle"+absolut; 		topRight.style.width  = 20;		 topRight.style.height = 52;		//topRight.appendChild(cornerTopRight)		Top_row.appendChild(topRight);	TablebodyMin.appendChild(Top_row);	TableMin.appendChild(TablebodyMin);			return TableMin;}function createTableNew(){	var Table = document.createElement("table");	//Table.id = "topic_table_max_"+Topic.id;	Table.border= 0;	Table.setAttribute('cellSpacing',"0"); 	Table.setAttribute('cellPadding',"0"); 		var TablebodyMax = document.createElement("tbody");		//creacio del element select	var categories = document.createElement('select');	//categories.setAttribute('multiple','multiple');	var vuit =  document.createElement('option');	vuit.appendChild(document.createTextNode("-"));	categories.appendChild(vuit);	for (var i=0; i < cats.length; i++) {		var op = document.createElement('option');		op.appendChild(document.createTextNode(Utf8.decode(cats[i].subject)));		op.setAttribute('value',cats[i].subject);		categories.appendChild(op);	}		var categories2 = document.createElement('select');	//categories.setAttribute('multiple','multiple');	var vuit2 =  document.createElement('option');	vuit2.appendChild(document.createTextNode("-"));	categories2.appendChild(vuit2);	for (var j=0; j < cats.length; j++) {		var op2 = document.createElement('option');		op2.appendChild(document.createTextNode(Utf8.decode(cats[j].subject)));		op2.setAttribute('value',cats[j].subject);		categories2.appendChild(op2);	}			// Création du titre...	var Top_row = document.createElement("tr");		var topLeft = document.createElement("td");		topLeft.className = "tdtopleft";  		topLeft.style.width  = 15;	 	 topLeft.style.height = 37;		 		 Top_row.appendChild(topLeft);		var topCenter = document.createElement("td");		 topCenter.className = "tdtop";		 topCenter.style.width  = 228;		 topCenter.style.height = 37;		 //topCenter.onclick = function(){ impanding(Topic);}		 //topCenter.id = "topic_title_"+Topic.id;		var t = document.createElement("table")		var tbody = document.createElement("tbody");		var tr = document.createElement("tr");		var td1 = document.createElement("td");		var td2 = document.createElement("td");		var textTitle = document.createTextNode("TITULO:");		var topicText = document.createElement("input");	  	topicText.setAttribute('type','text');	  	topicText.setAttribute('name','title');	 	td1.appendChild( textTitle);		td2.appendChild( topicText);		var cellDelete = document.createElement("td");			cellDelete.className = "topic_title_delete";			var delBtn = document.createElement("img");				delBtn.src = rootImage+"cerrar_ranking"+extension;				delBtn.className = "link";				delBtn.onclick = function(){	processRemoveTopic(0);	}//alert ("hauria de funcionar!!!")}		    cellDelete.appendChild(delBtn);			tr.appendChild(td1);			tr.appendChild(td2);			tr.appendChild(cellDelete);		tbody.appendChild(tr);		t.appendChild(tbody);			 topCenter.appendChild( t);		Top_row.appendChild(topCenter);				var topRight = document.createElement("td");		 topRight.className = "tdtopright"; 		 topRight.style.width  = 15;		 topRight.style.height = 37;		Top_row.appendChild(topRight);	TablebodyMax.appendChild(Top_row);		var Center_row = document.createElement("tr");		var centerLeft = document.createElement("td");		 centerLeft.className = "tdcenter";		 centerLeft.style.width  = 15;	 	 centerLeft.style.height = 250;		 Center_row.appendChild(centerLeft);		var centerCenter = document.createElement("td");		 centerCenter.className = "tdcenter";		 centerCenter.style.width  = 228;		 centerCenter.style.height = 250;		var tagTitle = document.createTextNode("TAGS:");		var catTitle = document.createTextNode("CATEGORIA: ");		var catTitle2 = document.createTextNode("Categoria Adicional (Opcional): ");		var tagText = document.createElement("input");		  tagText.setAttribute('type','text');		  tagText.setAttribute('name','tags');		  tagText.style.width = 220;		  tagText.style.height = 40;		var tagExp = document.createTextNode("Cuantas más palabras clave o TAGS associes a tu ranking, más fácil será que los otros usuarios participen en él.");		var tagEj = document.createTextNode("EJEMPLO: Fútbol, Tecnología, Cantante, Barcelona, Madrid, Motos etc.");		//tagExp = Utf8.encode(				centerCenter.appendChild(catTitle);			centerCenter.appendChild(document.createElement('br'));		centerCenter.appendChild(categories);		centerCenter.appendChild(document.createElement('br'));		centerCenter.appendChild(document.createElement('br'));		centerCenter.appendChild(catTitle2);			centerCenter.appendChild(categories2);		centerCenter.appendChild(document.createElement('br'));		centerCenter.appendChild(document.createElement('br'));		centerCenter.appendChild(document.createElement('br'));		centerCenter.appendChild(tagTitle);			centerCenter.appendChild(document.createElement('br'));		centerCenter.appendChild(tagText);		centerCenter.appendChild(document.createElement('br'));		centerCenter.appendChild(document.createElement('br'));		centerCenter.appendChild(tagExp);		centerCenter.appendChild(document.createElement('br'));				centerCenter.appendChild(tagEj);		Center_row.appendChild(centerCenter);				var centerRight = document.createElement("td");		 centerRight.className = "tdcenter";		 centerRight.style.width  = 15;		 centerRight.style.height = 250;		Center_row.appendChild(centerRight);	TablebodyMax.appendChild(Center_row);		var Bottom_row = document.createElement("tr");	    Bottom_row.align = "center";		var bottomLeft = document.createElement("td");		 bottomLeft.className = "tdbottomleft"; 		bottomLeft.style.width  = 15;	 	 bottomLeft.style.height = 95;		 //bottomLeft.appendChild(cornerBottomLeft)		Bottom_row.appendChild(bottomLeft);		var bottomCenter = document.createElement("td");		 bottomCenter.className = "tdbottom";		 bottomCenter.style.width  = 228;		 bottomCenter.style.height = 95;		var b=document.createElement('input');		  b.setAttribute('type','image'); 		  b.setAttribute('src',rootImage+'crear'+extension);		 		//alert (canterbury);		  b.onclick = function() {			var canterbury;			if ((categories2.value == "-")||(categories2.value == "")){canterbury = categories.value;}			else{canterbury = categories.value+";"+categories2.value;}			//alert (canterbury); 			addTopic(topicText.value,tagText.value, canterbury);}//alert(categories.value+"@"+categories2.value);}////alert(categories.value)}		bottomCenter.appendChild(b);	    Bottom_row.appendChild(bottomCenter);				var bottomRight = document.createElement("td");		bottomRight.className = "tdbottomright";  		bottomRight.style.width  = 15;		 bottomRight.style.height = 95;		//bottomRight.appendChild(cornerBottomRight)		Bottom_row.appendChild(bottomRight);	TablebodyMax.appendChild(Bottom_row);	Table.appendChild(TablebodyMax);		return Table;}function expanding(Topic){	var TableMin = $("topic_table_min_"+Topic.id);	var TableMax = $("topic_table_max_"+Topic.id);	var TopicDiv = $("topic_"+Topic.id);		if ((TableMin)&&(!TableMax)){		//alert ("tableMin a la hoguera!")		TopicDiv.removeChild(TableMin);		TopicDiv.className = "topic_max";		TopicDiv.appendChild(createTableMax(Topic));		loadItems(Topic);		getCatsXTopic(Topic.id);		getTagsXTopic(Topic.id);		commentsNum(Topic.id);		checkFavorit(Topic.id);		//getCounter(Topic.id);	}	if ((!TableMin)&&(TableMax)){		//alert ("tableMax a la hoguera!")		TopicDiv.removeChild(TableMax);		TopicDiv.className = "topic_min";		TopicDiv.appendChild(createTableMin(Topic));		checkFavorit(Topic.id);		//getCounter(Topic.id);	}		}//Itemsfunction getItemHTML(item,topic){		var information = document.createElement("img");	information.className = "link";	if (item.toconfirm < 2) {		information.src = rootImage+"information2"+extension;		information.setAttribute('title',"Información y Comentarios sobre este Item");	}	else {		information.src = rootImage+"information3"+extension;		information.setAttribute('title',"Contiene Información y Comentarios");	}		information.onmouseover = function(){ linkShow(this);}	information.onmouseout = function(){linkHide(this);}	if (category<3) {		information.onclick = function(){	 rolloverMyItem(topic,item); linkHide(this);}	}else{		information.onclick = function(){window.open("./admin/itemEdit.php?itemId="+item.id, this.target, 'width=300','height=400');}	}	/*var decreaseButton = document.createElement("img");	decreaseButton.src = "./images/nav_down_red.png";	decreaseButton.className = "link";	decreaseButton.onclick = function(){	decreaseItemValue(topic, item.id);	}*/			var increaseButton = document.createElement("img");	increaseButton.src = "./images/nav_up_green.png";	increaseButton.className = "link";	increaseButton.onclick = function(){	increaseItemValue(topic, item.id);	}		// Création du tableau composant l'item	var itemTable = document.createElement("table");		//itemTable.setAttribute('cellSpacing',"0"); 	//itemTable.setAttribute('cellPadding',"0"); 		    var itemTablebody = document.createElement("tbody");	var itemTable_row = document.createElement("tr");	var string = llargada(Utf8.decode(item.subject),item,topic);		if (item.link == "") {				var title = document.createElement("div");		title.appendChild(string);		title.setAttribute('title',"Sin enlace");		title.onmouseover = function(){ linkShow(this);}		title.onmouseout = function(){linkHide(this);}		Item_AddCellInRow( itemTable_row, null, title, "item_name" );			}else{		//var name = document.createTextNode(string);		var link = document.createElement("a");		link.setAttribute('href',item.link);		link.setAttribute('target','_blank');		link.setAttribute('title',item.link);			link.appendChild(string);		link.onmouseover = function(){ linkShow(this);}		link.onmouseout = function(){linkHide(this);}		Item_AddCellInRow( itemTable_row, null, link,"item_name" );	}		Item_AddCellInRow( itemTable_row, null, information, "item_up" );	//Item_AddCellInRow( itemTable_row, null, decreaseButton, "item_up" );	Item_AddCellInRow( itemTable_row, null, increaseButton, "item_down" );	if (item.id == currentItem) {Item_AddCellInRow( itemTable_row, item.value, null, "item_value2" );}	else{Item_AddCellInRow( itemTable_row, item.value, null, "item_value" );}		itemTablebody.appendChild(itemTable_row);    itemTable.appendChild(itemTablebody);		var itemHTML = document.createElement("div");	if (item.id == currentItem) {		itemHTML.className = "current_item";		//alert(currentItem+"iep")	}else{		itemHTML.className = "item";	}	itemHTML.id = "item_"+ item.id;	itemHTML.appendChild( itemTable );			return itemHTML;}function getItemHTMLAbs(item,topic){		//alert ("Im in")	var information = document.createElement("img");	information.className = "link";	information.onmouseover = function(){ linkShow(this);}	information.onmouseout = function(){linkHide(this);}		if (item.toconfirm < 2) {		information.src = rootImage+"information2"+extension;		information.setAttribute('title',"Información y Comentarios sobre este Item");	}	else {		information.src = rootImage+"information3"+extension;		information.setAttribute('title',"Contiene Información y Comentarios");	}	if (category<3) {		information.onclick = function(){	 rolloverMyItem(topic,item); linkHide(this);}	}else{		information.onclick = function(){window.open("./admin/itemEdit.php?itemId="+item.id, this.target, 'toolbar=no,location=yes,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=500,height=600');}	}			// Création du tableau composant l'item	var itemTable = document.createElement("table");    var itemTablebody = document.createElement("tbody");	var itemTable_row = document.createElement("tr");	var string = llargada(Utf8.decode(item.subject),item,topic.id);		if (item.link == "") {				var title = document.createElement("div");		title.appendChild(string);		title.setAttribute('title',"Sin enlace");		title.onmouseover = function(){ linkShow(this);}		title.onmouseout = function(){linkHide(this);}		Item_AddCellInRow( itemTable_row, null, title, "item_name2" );			}else{		//var name = document.createTextNode(string);		var link = document.createElement("a");		link.setAttribute('href',item.link);		link.setAttribute('target','_blank');		link.setAttribute('title',item.link);			link.appendChild(string);		link.onmouseover = function(){ linkShow(this);}		link.onmouseout = function(){linkHide(this);}		Item_AddCellInRow( itemTable_row, null, link,"item_name2" );	}		Item_AddCellInRow( itemTable_row, null, information, "item_up" );			itemTablebody.appendChild(itemTable_row);    itemTable.appendChild(itemTablebody);		var itemHTML = document.createElement("div");	itemHTML.className = "item";	itemHTML.id = "item_"+ item.id;	itemHTML.appendChild( itemTable );			return itemHTML;}function getItemCommentsHTML(item,topic){		processRemoveAllTopicItems(topic.id);		var information = document.createElement("img");	information.src = rootImage+"cerrar_comments"+extension;	information.className = "link";	information.onclick = function(){	 rolloverMyItem2(topic);}//alert("no hay ningun comentario!!")	}			// Création du tableau composant l'item	var itemTable = document.createElement("table");    var itemTablebody = document.createElement("tbody");	var itemTable_row = document.createElement("tr");			var link = document.createElement("A");	//link.setAttribute('href',item.link);	//link.setAttribute('target','_blank');	var name = document.createTextNode("Crear enlace");	link.appendChild(name);	if (category == 1){		link.onclick = function() {alert ("Sólo los usuarios registrados pueden crear un enlace. Regístrate!!");}	}else{		link.onclick = function() {window.open("./itemLink.php?itemId="+item.id, this.target, 'toolbar=no,location=yes,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=500,height=600');}	}		Item_AddCellInRow( itemTable_row, Utf8.decode(item.subject), null, "item_name2" );	if (item.link == "") { Item_AddCellInRow( itemTable_row, null, link, "item_down" );}		Item_AddCellInRow( itemTable_row, null, information, "item_up" );	itemTablebody.appendChild(itemTable_row);	itemTable.appendChild(itemTablebody);		/*var resultTable = document.createElement("table");    var resultTablebody = document.createElement("tbody");	var resultTable_row = document.createElement("tr");		Item_AddCellInRow( resultTable_row, item.positive+" A FAVOR", null, "positive" );	Item_AddCellInRow( resultTable_row, item.negative+" EN CONTRA", null, "negative" );	Item_AddCellInRow( resultTable_row, item.value, null, "item_value" );		resultTablebody.appendChild(resultTable_row);	resultTable.appendChild(resultTablebody);*/		var commentTable = document.createElement("table");    var commentTablebody = document.createElement("tbody");	var commentTable_row = document.createElement("tr");	var commentTable_row2 = document.createElement("tr");		if (item.comment != "") {	Item_AddCellInRow( commentTable_row, Utf8.decode(item.comment), null, "comment_content" );  }	if (item.toconfirm == 1) {Item_AddCellInRow( commentTable_row2, "Por Confirmar", null, "toconfirm" );}	else{Item_AddCellInRow( commentTable_row2, item.author, null, "comment_author" );}		commentTablebody.appendChild(commentTable_row);	commentTablebody.appendChild(commentTable_row2);	commentTable.appendChild(commentTablebody);				var itemHTML = document.createElement("div");	itemHTML.className = "itemComments";	itemHTML.id = "item_"+ item.id;	itemHTML.appendChild( itemTable );	//itemHTML.appendChild( resultTable );	itemHTML.appendChild( commentTable );	/*if (item.comment != "") {				itemHTML.style.height = 93;	}else{		itemHTML.style.height = 70;			}*/		loadComments(item.id, topic.id);			return itemHTML;}function getAddItemHTML(topic){		var addItemButton = document.createElement("img");	addItemButton.src = rootImage+"plusItem"+extension;	addItemButton.className = "link";		if (category == 1){		addItemButton.onclick = function(){	alert ("Sólo los usuarios registrados pueden añadir un item. Regístrate!!!");	}	}else{		addItemButton.onclick = function(){	AddItemHTML(topic);	}	}			var itemTable = document.createElement("table");    var itemTablebody = document.createElement("tbody");	var itemTable_row = document.createElement("tr");	Item_AddCellInRow( itemTable_row, null, addItemButton, "item_down" );		Item_AddCellInRow( itemTable_row, "Añade un item!!", null, "item_name" );			itemTablebody.appendChild(itemTable_row);    itemTable.appendChild(itemTablebody);		var itemHTML = document.createElement("div");	itemHTML.className = "item";	itemHTML.appendChild( itemTable );			return itemHTML;}function AddItemHTML(topic){	var itemText = document.createElement("input");	  itemText.setAttribute('type','text');	  itemText.setAttribute('name','item');	/*var b=document.createElement('input');	  b.setAttribute('type','submit');	  b.setAttribute('value','Añadir');	  b.onclick = function() {addItem(topicId, itemText.value);}*/	  		var itemTable = document.createElement("table");    var itemTablebody = document.createElement("tbody");	var itemTable_row = document.createElement("tr");	itemTable_row.className = "item";	var itemTable_row2 = document.createElement("tr");		//Item_AddCellInRow( itemTable_row, "ITEM: ", null, "item_name" );	Item_AddCellInRow( itemTable_row, null, itemText, "item_down" );		var commentText = document.createElement("textarea");	  commentText.setAttribute('rows','3');	  commentText.setAttribute('cols','23');	  commentText.setAttribute('name','comment');	  commentText.setAttribute('wrap','hard');	  	var b=document.createElement('input');	  b.setAttribute('type','submit');	  b.setAttribute('value','Añadir');	  b.onclick = function() {addItem(topic, itemText.value, commentText.value);}		var commentTable_row = document.createElement("tr");	//commentTable_row.className = "additem";	var commentTable_row2 = document.createElement("tr");		Item_AddCellInRow( itemTable_row2, "INFORMACION ADICIONAL O COMENTARIO (opcional)", null, "item_down" );	Item_AddCellInRow( commentTable_row, null, commentText, "item_down" );	Item_AddCellInRow( commentTable_row2, null, b, "item_down" );		itemTablebody.appendChild(itemTable_row);	itemTablebody.appendChild(itemTable_row2);		itemTablebody.appendChild(commentTable_row);	itemTablebody.appendChild(commentTable_row2);		    itemTable.appendChild(itemTablebody);		var itemHTML = document.createElement("div");	  //itemHTML.className = "additem";	  itemHTML.appendChild( itemTable );		processRemoveLastTopicItem(topic.id);	//processRemoveAlmostAllTopicItems(topicId);	$("topic_content_"+topic.id).appendChild( itemHTML );}function Item_AddCellInRow( row, text, obj, className ){	var cell = document.createElement("td");	cell.className = className;	if( ! obj && text ){	    textNode = document.createTextNode( text );	    cell.appendChild(textNode);	}	if( obj && ! text ){		cell.appendChild(obj);	}	row.appendChild(cell);}function linkShow(title){	 tooltip.show(title);}function linkHide(title){	 tooltip.hide(title);}function llargada(string,item,topic){	if (string.length>40){		var	substring = string.substring(0,39);		var result = document.createElement("div");				var cont = document.createTextNode("(...)");		var	link = document.createElement("a");			link.appendChild(cont);			link.setAttribute('href','#');							link.onclick = function(){ rolloverMyItem(topic,item); $("tooltip").style.visibility = "hidden";	}				// alert (result)		result.appendChild(document.createTextNode(substring));		result.appendChild(link);		return result;	}else{ 		var substring = document.createTextNode(string)		return substring;}}//Commentsfunction getCommentHTML(comment){	var commentTable = document.createElement("table");    var commentTablebody = document.createElement("tbody");	var commentTable_row = document.createElement("tr");	var commentTable_row2 = document.createElement("tr");	Item_AddCellInRow( commentTable_row, Utf8.decode(comment.comment), null, "comment_content" );	Item_AddCellInRow( commentTable_row2, comment.author+" ("+comment.date+")", null, "comment_author" );		commentTablebody.appendChild(commentTable_row);	commentTablebody.appendChild(commentTable_row2);    commentTable.appendChild(commentTablebody);		var commentHTML = document.createElement("div");	commentHTML.className = "comment";	commentHTML.id = "comment_"+ comment.id;	commentHTML.appendChild( commentTable );			return commentHTML;}function getAddCommentHTML(itemId,topicId){		var addCommentButton = document.createElement("img");	addCommentButton.src = rootImage+"plusItem"+extension;	addCommentButton.className = "link";		if (category == 1){		addCommentButton.onclick = function(){	alert ("Sólo los usuarios registrados pueden añadir un comentario. Regístrate!!!");	}	}else{		addCommentButton.onclick = function(){	AddCommentHTML(itemId,topicId);	}	}			var commentTable = document.createElement("table");    var commentTablebody = document.createElement("tbody");	var commentTable_row = document.createElement("tr");		Item_AddCellInRow( commentTable_row, "COMENTARIOS: ", null, "item_name" );	Item_AddCellInRow( commentTable_row, null, addCommentButton, "item_down" );	Item_AddCellInRow( commentTable_row, "Opina!", null, "item_down" );				commentTablebody.appendChild(commentTable_row);    commentTable.appendChild(commentTablebody);		var commentHTML = document.createElement("div");	commentHTML.className = "comment";	commentHTML.appendChild( commentTable );			return commentHTML;}function AddCommentHTML(itemId,topicId){	var commentText = document.createElement("textarea");	  commentText.setAttribute('rows','4');	  commentText.setAttribute('cols','25');	  commentText.setAttribute('name','comment');	var b=document.createElement('input');	  b.setAttribute('type','submit');	  b.setAttribute('value','Añadir');	  b.onclick = function() {addComment(itemId,topicId, commentText.value);}		  		var commentTable = document.createElement("table");    var commentTablebody = document.createElement("tbody");	var commentTable_row = document.createElement("tr");	var commentTable_row2 = document.createElement("tr");		/*Comment_AddCellInRow( f, null, commentText, "comment_down" );	Comment_AddCellInRow( f, null, b, "comment_down" );	Comment_AddCellInRow( commentTable_row, null, f, "comment_down" );		*/	Item_AddCellInRow( commentTable_row, null, commentText, "item_down" );	Item_AddCellInRow( commentTable_row2, null, b, "item_down" );		commentTablebody.appendChild(commentTable_row);	commentTablebody.appendChild(commentTable_row2);    commentTable.appendChild(commentTablebody);		var commentHTML = document.createElement("div");	  commentHTML.className = "comment";	  commentHTML.appendChild( commentTable );		processRemoveAllItemComments(topicId);	$("topic_content_"+topicId).appendChild( commentHTML );}
