﻿/* created by Holysavior of ZBCode!
v1.5  Foward Full PM conversation
Do Not Edit! */
if(location.href.match(/c=1&folder=/i)) {
$(".c_foot").append("<a href='javascript:void(0)' id='sendfullconv'>Send Full Converstion</a>").css({"text-align":"center","padding":"5px"});

$("#sendfullconv").click(function() {
$("body").append("<div id='fullconv' style='display:none'></div><div style='position:fixed;top:15%;left:40%;width:30%;' id='fullconvname'><div class='category'><h2 id='pmtitle'>Who Do you want to send it too?</h2></div><table class='forums'><tr><td><form><div id='pmbody' style='text-align:center;font-size:14px;'><div style='padding:5px' class='c_forum'>User Name : <input type='text' id='nametosend' value=''/><div style='text-align:center;margin-left:10px'><img src='http://z1.ifrm.com/0/2/0/p401382/unchecked.png' alt='' id='addpost'> Add Comment</div></div><div style='padding:5px;'><button type='submit' id='sendtheconv'>Send Conversation </button>  <button type='button' id='closeme'>Close </button></div></div></form></td></tr></table></div>")

$("#addpost").toggle(function() {
$(this).attr("src","http://z1.ifrm.com/0/2/0/p401383/checked.png");
$("#pmbody").children(".c_forum").after("<textarea rows='5' cols='5' style='margin:5px:width:95%' id='addmessage'></textarea>");
},function () {
$(this).attr("src","http://z1.ifrm.com/0/2/0/p401382/unchecked.png");
$("#addmessage").remove();
});

$("#closeme").click(function(d) { d.preventDefault();
$("#fullconvname").fadeOut(1000,function() {
$("#fullconvname").remove() });
 });
 
 $("#sendtheconv").parents('form').submit(function(event) {
 event.preventDefault();
$("#sendtheconv").parents('form').unbind('submit');
$("#sendtheconv").html("<img src='http://z3.ifrm.com/104/14/0/f360957/retrieving_data.gif' alt='Sending...' />");
if($("#addmessage").length) {
additionalmess = $("#addmessage").val();
$("#fullconv").append(additionalmess)
}
$("td.c_postinfo").each(function() {
var username = $(this).children("span.left").find("a").eq(0).text();
var userdate = $(this).children("span.left").text().split("·")[1].split(",")[0];
var thepost = $(this).parent().next().children("td.c_post").text().split("<br />").join("\n");
trimpost = jQuery.trim(thepost);
$("#fullconv").append("[quote="+username+","+userdate+"]"+trimpost+"[/quote]");
});

$.get(main_url + 'msg/?c=2', function(d) {
			function gd(name) {
				return $('input[name=' + name + ']',d).val();
			}
			var xc = gd('xc'), msg = gd('msg'), fwd = gd('fwd'), convo = gd('convo'), draft_edit = gd('draft_edit'), secure = gd('secure'), track = gd('track');
			name = $("#nametosend").val();
			title = "fwd:"+$("title").text();
			post = $("#fullconv").html();
			$.post(main_url+'msg/?c=3&sd=1', {xc:xc,msg:msg,fwd:fwd,convo:convo,draft_edit:draft_edit,secure:secure,name:name,title:title,track:track,post:post}, function(r) {
				
	$("#pmtitle").html("PM has been Sent");
	$("#pmbody").html("<button type='button' id='closeme'>Close </button>");
	$("#closeme").click(function() {$("#fullconvname").fadeOut(1000,function() {
$("#fullconvname").remove(); $("#fullconv").html(" "); }); });

			});
			})
			});
 
});
}
