﻿/*
	This class will handle the Message Design for titles
	01/06/03 Shay Lapid
*/
document.domain = "nana10.co.il";
 
var bDisplayMemberLink=true;
var sPrefix='';

/*
var sHierarchyImage;
function drawHierarchy(sString)
{
	var sHTML='';
	for (var i=0;i<=sString.length;i++)
	{
		var sChar=sString.substring(i,1);
		if (sChar=='T')
			sHTML+='<img src="http://localhost/forum/talkback-dot-T.gif">';
		else if (sChar=='L')
			sHTML+='<img src="http://localhost/forum/talkback-dot-T.gif">';
		else if (sChar==' ')
			sHTML+='<span style="Padding-Right:10px;"></span>';
	}
	return sHTML;
}
*/
/************************************************************
*	This function display one forum message					*
*************************************************************/
new Div(document.getElementById("Bodies"));
var oBodieDefaultLook=document.getElementById("Bodies");
var ggg = 3;
function DisplayTitleNode(oNode )
{	

//alert(iMsgArlength);	

//debugger;

	
	nIndex=oNode["ThreadNo"]+ 1 + (18*(nFSCurrentPage-1));
	var oParent=oNode["ParentNode"];
	var sCurrentTag;
		
	if( ggg == 1 )
	{
		ggg = 2;
		debugger;
	}
	
	
	//alert(nIndex);
	var sHTML='';	
	
	sHTML +=
	'<div id="Msg' + oNode["ID"] + '" class="Forum_MessageContent_DIV" style="margin:0px 5px 0px 5px;width:auto;overflow-x:hidden;';

	if (oNode["ParentID"]==0)		
		sHTML+=	'  margin-bottom:0px;';
	if (oNode["isLast"] )
		//sHTML+=	' padding-bottom: 5px ; ';
		sHTML+=	' margin-bottom:3px;border-bottom:solid 1px #CECECE;';	

	sHTML+= '">';
	sHTML+=	'<table border="0" cellpadding="0"  cellspacing="0" id="BackGround" bgcolor="';
			sHTML+="#ffffff";
			
	sHTML+= '" style="width:100%;height:21px;';
	if (oNode["ParentID"]==0)		
		sHTML+=	' padding-top:0px;';
	if (oNode["isLast"])
		sHTML+=	' padding-bottom:0px;';
	
	sHTML+=		
			'vertical-align:bottom; " ><tr>'; 
	//check if needed to display forumname and if so its display it
	if (oNode["ForumName"])
	{
		sHTML+= 
				'<td width="100" id="ForumName" class="tdForumData"><a '

				if (sKeyword!='')			
				{ sHTML+=''; }
				
		sHTML+= ' href="/Forum/?ForumID=' + oNode["ForumID"] + '" class="ForumSearchStatistics MessageActionsLine_dotted" target="_top">' + oNode["ForumName"] + '</td>';
	}			
				
				
				//display the depth for the message hierarchy
	sHTML+=
				'<td id="Depth' + oNode["ID"] +  '" style="background-color"#ffffff;" width="' + oNode["Depth"]*10 + '">' +  
				/*drawHierarchy(sHierarchyImage + sCurrentTag) +*/
				/*sHierarchyImage + sCurrentTag +*/
				'</td>'+

				//display the expand image
				'<td valign="top" width="9" ';
	sHTML+=		' style="padding-right: 4px;';
				sHTML+=oNode["Depth"]==1?'Padding-Top:5px;':'Padding-Top:5px;';
	sHTML+=		'">' + '<span id="Expand'+ oNode["ID"]+'">' + 
							'<a href="javascript:OpenThread(' + (iMsgAr.length-1) + ', ' + oNode["ID"] + ')">'+
							'<img src="'+
								fnLinkType(oNode["Depth"])+
							'" id="expandIMG'+oNode["ID"]+'" value="' + oNode["Depth"] + '" border="0"></img>'+
					'</span>'+
				'</td>';
				
				if (oNode["Depth"]>1) 
					sHTML+='<td width="*" class="tdForumAuthorData" style="direction:rtl;" align="right">';
				else
					sHTML+='<td width="*" class="tdForumMsgHeader" style="direction:rtl;" align="right">';
			//display the message Title --tdForumMsgHeader
			

			if(oNode["IsHospitalityGuest"]==1)
				sHTML+='<img src="' + sImgPath + '/Guest.gif" alt=""></img>&nbsp;&nbsp;&nbsp;';

				sHTML+='<span id="Title" class="Forum_MSG_Title" >';
	

	sHTML+=			'<a onclick="'
		
	sHTML+=				'bGoBack=true;openmsg(' + oNode["ID"] + ',false,false);ClickStat(' + oNode["ID"] + ');';
	
	if (!$.browser.msie){
		sHTML += 		'return false;"';
	}
	
	sHTML+=				'" id="lnk' + oNode["ID"] + '" href="\/Message\/blank.htm?msgid=' +  oNode["ID"] + '" target="msgtarget" class="'; //' + oNode["ID"] + '

				
					
					/*if (oNode["Depth"]>1) 
						sHTML+='Forum_HText'; // Forum_MSG_color
					else
						sHTML+='Forum_HText'; //Forum_MSG_Title_color
					*/	
				
					sHTML+='forum_link'; // Forum_MSG_color					
						
						
					
						
	sHTML+=			'"';
	
	if (oNode["IsHospitalityGuest"]==1)
		sHTML+=' style="color:' + sCommunityBG + ';" ';
	
	sHTML+=			'>'+
						oNode["Title"] +
					'</a>&nbsp;&nbsp;';	
					//attchment is inside the message
					if(oNode["AttachFile"]||oNode["AttachImg"])	
						sHTML+='<img src="' + sImgPath + 'Attachment.gif" alt="קובץ מצורף"></img>';
					//new message
					if(oNode["IsNew"])			
						sHTML+='<img src="' + sImgPath + 'starNew.gif" alt="הודעה חדשה"></img>';
					//message has content
					if(!oNode["HasContent"])	
						sHTML+='<img src="' + sImgPath + 'NoContent.gif" alt="ללא תוכן"></img>';
					//Message is Selected
					if(oNode["Selected"])		
						sHTML+='<img src="' + sImgPath + 'Selected.gif" alt="הודעה נבחרת"></img>';
					
					if(oNode["Survey"]>0){			
						sHTML+='<img src="' + sImgPath + 'Survey.gif" alt="משאל מצורף" ></img>';							
					}	
	
	sHTML+=			'</span>'+
					'<span id="Here' + oNode["ID"] + '" style="padding-right:0px;padding-left:0px;"></span>'+
				'</td>'+				
				'<td width="50" align="CENTER" dir="ltr" id="Karma' + oNode["ID"] +'">' + getKarmaRate(oNode["KarmaRate"]) + '</td>'+
				//author name
				'<td width="110" class="tdForumData">';
				
				if (oNode["Author"])
				{
				sHTML+=
					'<a ';

				if (oNode["Member"]==1 && bDisplayMemberLink)
				{
				window.location 
					sHTML+=
						'style="cursor:pointer;text-decoration:underline;" ONCLICK="javascript:window.location = sServer+\'/Users/UserInfo.asp?pid=48&MsgID=' + oNode["ID"] + '\'; "';
				}else{
					sHTML+=
						' style="text-decoration:none;" '
				}
				//debugger;
				sHTML+='class="'
				if(oNode["TypeID"]==2)
						sHTML+='forum_administrator ';
				else if (sMyNickName==oNode["Author"])
						sHTML+='forum_active_me ';
				else if(oNode["TypeID"]==1)
							sHTML+='forum_active_user ';
				else if(oNode["TypeID"]==3)
							sHTML+='forums_admin '

					if (oNode["Member"]==1 && bDisplayMemberLink)
						sHTML+=' MessageActionsLine_dotted';// style="COLOR: ' + sCommunityBG + ' ;"';				
				sHTML+='"'
				
				sHTML+=		'>'+
							oNode["Author"] +
					'</a>';
				}
				else
				sHTML+=
					oNode["Author"];
	sHTML+=				
				'</td>' +							
				//published date
				'<td width="100" align="LEFT" class="tdForumData" style="Padding-Left:3px;direction:ltr;">'+
					'<span id="Date'+oNode["ID"]+'" class="Regular_text">'+
						oNode["Date"] +
					'</span>'+
				'</td>'+
			'</tr>'+
		'</table>'+
		//body part
		'<table width="620px" border="0" cellpadding="0" cellspacing="0" id="BodyTable" style="display:none" bgcolor="';
			sHTML+="#ffffff";						
	sHTML+=
		
		'">'+
			'<tr>'+
				'<td id="DepthBody" width="' + oNode["Depth"]*10 + '"></td>'+
				'<td width="12"></td>'+
				'<td style="padding-top:8px;padding-bottom:12px;text-align:right;"><span id="Body" ></span></td>'+
			'</tr>'+
		'</table>'+
	'</div>';

	sHTML += DisplayTitleNodeAdditional(oNode);
	
	oBodieDefaultLook.insertAdjacentHTML("beforeEnd", sHTML);	
	
}