

function nextfref(id)
{
	next_frame_object = myGetDomObject("view_next_frame"+id);
}

function previousfref(id)
{
	previous_frame_object = myGetDomObject("view_previous_frame"+id);
}

function toggle(pobject)
{
	object = myGetDomObject('post_' + pobject);

	if( !object.style )
	{
		return false;
	}

	if( object.style.display == 'none' )
	{
		object.style.display = '';
	}
	else
	{
		object.style.display = 'none';
	}
}

ponce = false;
nonce = false;

tpl_img = "/templates/subVereor/images/";
tpl_img_lang = "/templates/subVereor/images/lang_english/";
space_row = "<tr><td class='spaceRow' colspan='2' height='1'><img src='templates/subVereor/images/spacer.gif' alt='' width=1 height=1 /></td></tr>";

tad_text = "<script type=\"text/javascript\">tyroo_pub = \"10101\";tyroo_ad_width = \"728\";tyroo_ad_height  = \"90\";tyroo_adtype = \"728x90_both\";tyroo_chnl =\"1003\";tyroo_ads_frame = \"tyrooads\";tyroo_ad_output = \"html\";</script>";
tad_text += "<script type=\"text/javascript\" src=\"http://Ads1.tyroo.com/js/Tyrooads.js\"></script>\n";

function b_f(url, til, img, alt, title)
{
	til = til ? tpl_img_lang : tpl_img;
 	return "<td valign='absbottom' nowrap='nowrap'><span class='gensmall'><a href='" + url + "'><img src='" + til + img +"' border=0 align='absbottom' alt='" + alt + "' title='" + title + "' /></a>&nbsp;</span></td>";
}

function quick_view_open(start,direction)
{
	var url;
	var xmlHttp;
	var expiryTimer;
	var xmlResp;
	xmlHttp=GetXmlHttpObject();

	if (xmlHttp!=null)
	{
		url = "/quick_view.php?t="+ topic_id + "&start=" + start + "&direction=" + direction;

		if(direction==0)
		{
			if(!ponce)
			{
				ponce = true;
				previous_link_object = myGetDomObject('prev_link');
				previous_frame_object = myGetDomObject('view_previous_frame');
				previous_loading_object = myGetDomObject('view_previous_loading');
			}

			previous_loading_object.style.display = '';
			previous_loading_object.style.visibility = 'visible';
		}

		if(direction==1)
		{
			if(!nonce)
			{
				nonce = true;
				next_link_object = myGetDomObject('next_link');
				next_frame_object = myGetDomObject('view_next_frame');
				next_loading_object = myGetDomObject('view_next_loading');
			}

			next_loading_object.style.display = '';
			next_loading_object.style.visibility = 'visible';
		}

			xmlHttp.onreadystatechange = function()
			{
				if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
				{
					if(xmlHttp.status == 200 || xmlHttp.status == 304)
					{
						xmlResp = xmlHttp.responseXML;
						var num_posts = GXE(xmlResp,'n',0);
						var newstart = GXE(xmlResp,'ns',0);
						if(direction==1)
						{
							spos = Number(start) + Number(num_posts);
						}

						var showlink = GXE(xmlResp,'sl',0);
						var user_logged_in = GXE(xmlResp,'logged',0);

						var i;
						var rowclass;
						var poster;
						var message;
						var date;
						var	post_id;
						var user_id;
						var uname_class;


						var user_posts;
						var online_img;
						var rank_img;
						var avatar_img;
						var regdate;
						var user_from;
						var user_age;
						var birthday;
						var zodiac;
						var user_gender;
						var user_points;
						var user_score;
						var user_gold;
						var user_stones;
						var exchange;
						var donate;
						var modify;
						var profile_img;
						var birthday_img;
						var my_friend_img;
						var my_ignore_img;
						var pm_img;
						var email_img;
						var website_img;
						var yahoo_img;
						var aim_img;
						var msn_img;
						var icq_img;


						var	post_subject;
						var	user_sig;
						var	edited_by;
						var	mini_post_img;
						var	edit_img;
						var	quickquote_img;
						var	quote_img;
						var	ip_img;
						var	delpost_img;
						var	mini_post_alt;
						var	mini_post_url;

						var	user_my_ignore;
						var SID;
						var SSID;

						var post_tbl;




						post_tbl = "<table class='forumline' border=0 cellpadding=1 cellspacing=1 width=100%>";

						if(direction == 0)
						{
							post_tbl +=	"<tr><td id='view_previous_frame"+ newstart + "' style='display:none;visibility:hidden' colspan=2></td></tr>";
						}

						for(i=0; i<num_posts; i++)
						{
							poster = GXE(xmlResp,'po',i);
							message = GXE(xmlResp,'m',i);
							postdate = GXE(xmlResp,'d',i);
							attach = GXE(xmlResp,'at',i);
							post_id = GXE(xmlResp,'pi',i);
							post_subject = GXE(xmlResp,'ps',i);
							user_sig =  GXE(xmlResp,'sig',i);
							edited_by = GXE(xmlResp,'ed',i);
							mini_post_img =  GXE(xmlResp,'mpi',i);
							edit_img = GXE(xmlResp,'edi',i);
							quickquote_img = GXE(xmlResp,'qkt',i);
							quote_img = GXE(xmlResp,'qti',i);
							ip_img = GXE(xmlResp,'ip',i);
							delpost_img = GXE(xmlResp,'del',i);
							user_my_ignore =  GXE(xmlResp,'ig',i);
							SID = GXE(xmlResp,'sid',i);
							SSID = GXE(xmlResp,'ssid',i);
							poster_id = GXE(xmlResp,'uid',i);
							uname_class = GXE(xmlResp,'ucl',i);
							user_posts = GXE(xmlResp,'upo',i);

							if(user_logged_in==1)
							{
								online_img = GXE(xmlResp,'oimg',i);
								rank_img = GXE(xmlResp,'rimg',i);
								avatar_img = GXE(xmlResp,'aimg',i);
								regdate = GXE(xmlResp,'reg',i);
								user_from = GXE(xmlResp,'from',i);
								user_age = GXE(xmlResp,'uage',i);
								birthday = GXE(xmlResp,'bday',i);
								zodiac = GXE(xmlResp,'zod',i);
								user_gender = GXE(xmlResp,'ugen',i);
								user_points = GXE(xmlResp,'poin',i);
								user_score = GXE(xmlResp,'scor',i);
								user_gold = GXE(xmlResp,'gold',i);
								user_stones = GXE(xmlResp,'ston',i);
								exchange = GXE(xmlResp,'exch',i);
								donate = GXE(xmlResp,'dona',i);
								modify = GXE(xmlResp,'modi',i);
								profile_img = GXE(xmlResp,'pimg',i);
								birthday_img = GXE(xmlResp,'bimg',i);
								my_friend_img = GXE(xmlResp,'mfimg',i);
								my_ignore_img = GXE(xmlResp,'migmg',i);
								pm_img = GXE(xmlResp,'pmimg',i);
								email_img = GXE(xmlResp,'eimg',i);
								website_img = GXE(xmlResp,'wimg',i);
								yahoo_img = GXE(xmlResp,'yimg',i);
								aim_img = GXE(xmlResp,'aim',i);
								msn_img = GXE(xmlResp,'msn',i);
								icq_img = GXE(xmlResp,'icq',i);
							}

							SID = SID != '' ? '&sid=' + SID : '';
							SSID = SSID != '' ? '&sid=' + SSID : '';


							row_class = ( !(i % 2) ) ? "row1" : "row2";

							if(mini_post_img == "new")
							{
								mini_post_img = icon_minipost_new;
								mini_post_alt = "New Post";
							}
							else
							{
								mini_post_img = icon_minipost;
								mini_post_alt = "Post";
							}
							mini_post_url = "viewtopic.php?p=" + post_id + '#' + post_id + SID;


							if(edit_img == 'active')
							{
								edit_img = '<a href=\"' + "posting.php?mode=editpost&p=" + post_id + SID + '\"><img src=\"' + icon_edit + '\" alt=\"Edit post\" title=\"Edit post\" border=0 /></a>';
							}

							if(quickquote_img == 'active')
							{
								quickquote_img = '<a href=\"javascript:void(0)\" onclick=\"quick_quote(' + post_id + ')\"><img src=\"' + icon_quick + '\" alt=\"Quick Reply with quote\" title=\"Quick Reply with quote\" border=0 /></a>';
							}

							if(quote_img == 'active')
							{
								quote_img = '<a href=\"' + "posting.php?mode=quote&p=" + post_id + SID + '\"><img src=\"' + icon_quote + '\" alt=\"Reply with quote\" title=\"Reply with quote\" border=0 /></a>';
							}

							if(ip_img == 'active')
							{
								ip_img = '<a href=\"' + "modcp.php?mode=ip&p=" + post_id + "&t=" + topic_id +  SSID + '\"><img src=\"' + icon_ip + '\" alt=\"View IP\" title=\"View IP\" border=0 /></a>';
							}

							if(delpost_img == 'active')
							{
								delpost_img = '<a href=\"' + "posting.php?mode=delete&p=" + post_id + SSID + '\"><img src="' + icon_delpost + '" alt=\"Delete post\" title=\"Delete post\" border=0 /></a>';
							}



							if ( user_sig != '' )
							{
								user_sig = "<br /><img border=0 src='line.gif' width=414 height=1><br />" + user_sig;
							}
							user_sig = "<br /><br /><a href='http://www.malluforum.com/m/" + poster + "/' class=gensmall style='color:red'><B><U>http://www.malluforum.com/m/" + poster + "/</U></B></a>" + user_sig;


							if(user_my_ignore == "yes")
							{
								post_tbl += "<tbody id='post_" + post_id + "' style='display:none'>";
							}

							post_tbl += "<tr><td width=300 style='width:300px' height=100  align=left valign=top class='" + row_class + "'><a name='" + post_id + "'></a><span class='name'><a class='"+ uname_class + "' href='/m/"+poster+"/'>"+poster+"</a></span>";

							if(user_logged_in==1)
							{
								if(online_img == "")
								{
									post_tbl += "<img src='" + tpl_img + "icon_offline.gif' border=0 align='absbottom' alt='Offline' title='Offline' />";
								}
								else if(online_img == "online")
								{
									post_tbl += "<img src='" + tpl_img + "icon_online.gif' border=0 align='absbottom' alt='Online' title='Online' />";
								}
								else if(online_img == "hidden")
								{
									post_tbl += "<img src='" + tpl_img + "icon_hidden.gif' border=0 align='absbottom' alt='Hidden' title='Hidden' />";
								}

								if(rank_img != "")
								{
									post_tbl += "<div class='gensmall'>" + rank_img + "</div>";
								}

								if(avatar_img != "")
								{
									post_tbl += "<div align='center'>" + avatar_img + "</div><br />";
								}

								if(regdate != "")
								{
									post_tbl += "<div align='left' class='gensmall'>Joined: "+ regdate + "</div>";
								}
							}

							if(user_posts != "")
							{
								post_tbl += "<div align='left' class='gensmall'>Total posts: "+ user_posts + "</div>";
							}

							if(user_logged_in==1)
							{
								if(user_from != "")
								{
									post_tbl += "<div align='left' class='gensmall'>Location: "+ user_from + "</div>";
								}

								if(user_age != "")
								{
									post_tbl += "<div align='left' class='gensmall'>Age: "+ user_age + "</div>";
								}

								if(birthday != "")
								{
									post_tbl += "<div align='left' class='gensmall'>Birthday: " + birthday ;

									if(birthday_img == "active")
									{
										post_tbl += "<a href='" + "./privmsg.php?mode=post&u=" + poster_id + SID + "'><img src='" + tpl_img +  "icon_birthday.gif' border=0 align=absbottom alt='Happy Birthday' title='Happy Birthday' /></a>";

									}

									post_tbl += "</div>";
								}

								if(zodiac != "")
								{
									post_tbl += "<div align='left' class='gensmall'>Zodiac: "+ zodiac + "</div>";
								}

								if(user_gender != "")
								{
									post_tbl += "<div align='left' class='gensmall'>Gender: "+ user_gender + "</div>";
								}

								if(user_points != "")
								{
									post_tbl += "<br /><span class='postdetails'>";
									post_tbl += "<span class='gensmall'><img src='./images/cash_blue.gif' alt='points' title='points'>"+ user_points + "</span><br />";
									if(exchange == "active")
									{
										post_tbl += "[ <a href='cash.php' class='gensmall'>Exchange</a> ]<br>";
									}

									if(donate == "active")
									{
										post_tbl += "[ <a href='cash.php?mode=donate&ref=viewtopic&u=" + poster_id + "&p=" + post_id + SID + "' class='gensmall'>Donate</a> ]<br>";
									}

									if(modify == "active")
									{
										post_tbl += "[ <a href='cash.php?mode=modedit&ref=viewtopic&u=" + poster_id + "&p=" + post_id + SID + "' class='gensmall'>Modify " + poster +"'s Cash</a> ]<br>";
									}


									post_tbl += "</span>";

								}

							}


							post_tbl += "<br/><img src='/images/spacer.gif' height=1 width=300 border=0 /></td>";
							post_tbl += "<td class='" + row_class + "' width='100%' height=28 valign=top><table width=100% border=0 cellspacing=0 cellpadding=0>";
							post_tbl += "<tr><td width=100%><a href='" + mini_post_url + "'><img src='" + mini_post_img + "' width=12 height=9 alt='" + mini_post_alt + "' title='" + mini_post_alt + "' border=0 /></a><span class='postdetails'>Posted: "+postdate+"<span class='gen'>&nbsp;</span>&nbsp; &nbsp;Subject: " + post_subject + "</span></td>";
							post_tbl += "<td valign=top align=right nowrap=nowrap>"+quickquote_img+" "+quote_img+" "+edit_img+" "+delpost_img+" "+ip_img+"</td></tr><tr><td colspan=2><hr /></td></tr>";
							post_tbl += "<tr><td colspan=2><span class='postbody'>" + message + "</span>"+attach+"<span class='postbody'>"+user_sig+"</span><span class='gensmall'>"+edited_by+"</span></td></tr></table></td></tr>";
							if(user_my_ignore == "no")
							{
								post_tbl += "<tr><td class="+row_class+" width=300 align='left' valign='middle'><span class='nav'><a href='#top' class='nav'>Back to top</a></span></td>";
								post_tbl += "<td class="+row_class+" width=100% height=28 valign='bottom' nowrap='nowrap'><table cellspacing=0 cellpadding=0 border=0 height=18 width=18><tr>";

								if(profile_img == "active")
								{
									post_tbl += b_f("./profile.php?mode=viewprofile&u=" + poster_id + SID, 1, "icon_profile.gif", 'View Profile', 'View Profile');
								}
								if(birthday_img == "active")
								{
									post_tbl += b_f("./privmsg.php?mode=post&u=" + poster_id + SID, 0 , 'icon_birthday.gif', 'Happy Birthday', 'Happy Birthday');
								}
								from = '&from=topic&p=' + post_id;

								if(my_friend_img == "add")
								{
									post_tbl += b_f("./profile.php?mode=buddy&sub=friend&b=" + poster_id + "&set=add" + from + SID, 1, 'icon_friend_add.gif', 'Add to friend list', 'Add to friend list');
								}
								else if(my_friend_img == "remove")
								{
									post_tbl += b_f("./profile.php?mode=buddy&sub=friend&b=" + poster_id + "&set=remove" + from + SID , 1, 'icon_friend_remove.gif', 'Remove from friend list', 'Remove from friend list');
								}

								if(my_ignore_img == "add")
								{
									post_tbl += b_f("./profile.php?mode=buddy&sub=ignore&b=" + poster_id + "&set=add" + from + SID, 1, 'icon_ignore_add.gif', 'Add to ignore list', 'Add to ignore list');
								}
								else if(my_ignore_img == "remove")
								{
									post_tbl += b_f("./profile.php?mode=buddy&sub=ignore&b=" + poster_id + "&set=remove" + from + SID, 1, 'icon_ignore_remove.gif', 'Remove from ignore list', 'Remove from ignore list');
								}

								if(pm_img == "active")
								{
									post_tbl += b_f("./privmsg.php?mode=post&u=" + poster_id + SID, 1, 'icon_pm.gif', 'Send Private Message', 'Send Private Message');
								}

								if(email_img != "")
								{

									post_tbl += b_f("mailto:" + email_img , 1, 'icon_email.gif', 'Send Email', email_img);
								}

								if(website_img != "")
								{
									post_tbl += b_f(website_img,1, 'icon_www.gif', 'Visit website', website_img);
								}

								if(aim_img != "")
								{
									post_tbl += b_f('aim:goim?screenname=' + aim_img + '&message=Hello+Are+you+there?', 1, 'icon_aim.gif', 'AIM', aim_img);
								}

								if(yahoo_img != "")
								{
									post_tbl += b_f('http://edit.yahoo.com/config/send_webmesg?.target=' + yahoo_img + '&.src=pg', 1, 'icon_yim.gif', 'Yahoo messenger', yahoo_img );
								}

								if(msn_img != "")
								{
									post_tbl += b_f('mailto:' + msn_img, 1, 'icon_msnm.gif', 'MSN Messenger', msn_img);
								}





								post_tbl += "</tr></table></td></tr>";
							}
							if(user_my_ignore == "yes")
							{
								post_tbl += "</tbody>";

								post_tbl += "<tr><td class='"+row_class+"' width=300 align='left' valign='middle'><span class='nav'><a href='#top' class='nav'>Back to top</a></span></td>";
								post_tbl += "<td class='"+row_class+"' width=100%><table width=100% cellpadding=0 cellspacing=0 border=0>";
								post_tbl += "<tr><td width=100%><a href='#' onClick=\"toggle('{postrow.POST_ID}'); return false;\" class='postdetails'>You have choosen to ignore this user </a></td>";
								post_tbl += "<td align='right'>"+ignore_buttons+"</td></tr></table></td></tr>";

							}
							post_tbl += space_row;

							if(i==0)
							{
								post_tbl += "<tr><td colspan=2 align=center class='bodyline' width=100% valign='top'>";

								post_tbl += tad_text;

								post_tbl += "</td></tr>";

								post_tbl += space_row;
							}




						}

						if(direction == 1)
						{
							post_tbl +="<tr><td id='view_next_frame" + newstart + "' style='display:none;visibility:hidden' colspan=2></td></tr>";
						}

						post_tbl += "</table>";

						if(direction==0)
						{
							previous_frame_object.style.display = '';
							previous_frame_object.style.visibility = 'visible';
							previous_frame_object.innerHTML = post_tbl;
							previousfref(newstart);

							if(showlink==1)
							{
								previous_link_object.innerHTML = "<a onclick='quick_view_open(" + newstart + ", 0)' href=\"javascript:void(0)\">Previous Page</a>";
							}
							else
							{
								previous_link_object.style.visibility = "hidden";
								previous_link_object.style.dispaly = "none";
							}
							previous_loading_object.style.display = 'none';
							previous_loading_object.style.visibility = 'hidden';
						}

						if(direction==1)
						{
							next_frame_object.style.display = '';
							next_frame_object.style.visibility = 'visible';
							next_frame_object.innerHTML = post_tbl;
							nextfref(newstart);

							if(showlink==1)
							{
								next_link_object.innerHTML = "<a onclick='quick_view_open(" + newstart + ",1)' href=\"javascript:void(0)\">Next Page</a>";
							}
							else
							{
								next_link_object.style.visibility = "hidden";
								next_link_object.style.dispaly = "none";
							}
							next_loading_object.style.display = 'none';
							next_loading_object.style.visibility = 'hidden';
						}

						clearTimeout(expiryTimer);
					}
					else
					{
						qpout(direction,false);
					}
				}
			}
			expiryTimer = setTimeout("qpout("+direction+",true)", 60000);
			xmlHttp.open("GET",url,true);
			xmlHttp.send(null);

	}
	return false;
}

function qpout(direction,timeout)
{

	if(direction==0)
	{
		previous_loading_object.style.display = 'none';
		previous_loading_object.style.visibility = 'hidden';

	}
	else if(direction==1)
	{
		next_loading_object.style.display = 'none';
		next_loading_object.style.visibility = 'hidden';
	}
	if(timeout)
	{
		alert("Sorry!! Request timed out!!!");
	}

}

function quick_quote(p)
{
	var xmlHttp;
	xmlHttp=GetXmlHttpObject()

	if (xmlHttp!=null)
	{

		url = "/quick_quote.php?p=" + p;
		xmlHttp.onreadystatechange = function()
		{
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{
				if(xmlHttp.status == 200 || xmlHttp.status == 304)
				{
					document.forms['post'].message.value = xmlHttp.responseText + "\r\n" + document.forms['post'].message.value;
					document.forms['post'].message.focus();
				}
			}
		}
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);

	}
}


