/* 
  Copyright 2007-2010 hkrn <hikarin@users.sourceforge.jp>
   */var Zeromin2;if(!Zeromin2)Zeromin2={};Zeromin2.ResPreview=function(property){var formId=property.formID;var staticURI=property.staticURI;var typeTheme=property.typeTheme;var isTypeTheme=property.isTypeTheme;var formContainer=jQuery("#"+formId);var formContainerWidth=formContainer.width();var formContainerHeight=formContainer.height();formArea=jQuery("textarea[name='MESSAGE']").width(Math.round((formContainerWidth*9.5)/10)).height(Math.round(formContainerHeight/2));var previewFrame=jQuery("#previewFrame").show();var frameElement=jQuery("iframe",previewFrame).show().width(Math.round((formContainerWidth*9.5)/10)).height(Math.round(formContainerHeight/2)).css({"border":"1px solid #666"}).get(0);var frame=jQuery.browser.msie?frameElement.contentWindow.document:frameElement.contentDocument;if(!property.noHeader){var url;if(isTypeTheme){url=staticURI+"/tdiary/"
+typeTheme+"/"+typeTheme+".css";}
else{url=staticURI+"/css/bbs.css";}
var css=frame.createElement("link");css.rel="stylesheet";css.type="text/css";css.href=url;jQuery("head",frame).append(css);}
var frameBody=frame.body;frameBody.innerHTML="<div class='day'><div class='body thread_body'>"
+"<div class='thread_reses'><div class='section'>"
+"</div><div class='caption res_header'>"
+"名前：<span class='commentator' id='preview_FROM'></span>："
+"<span class='commenttime' id='preview_date'>"
+property.date+"</span></div>"
+"<p class='res_body' id='preview_MESSAGE'>"
+property.text+"</p></div></div></div>";var previewFROM=jQuery("#preview_FROM",frameBody).get(0);var previewDATE=jQuery("#preview_date",frameBody).get(0);var previewMESSAGE=jQuery("p#preview_MESSAGE",frameBody).get(0);var fromForm=jQuery("input[name='FROM']");var mailForm=jQuery("input[name='mail']");var dateForm=jQuery("input[name='date']");var feedback=function(){var unescapeHTML=function(string){if(!string)return;return string.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,"\"").replace(/&#39;/g,"'").replace(/&amp;/g,"&").replace(/\n/g,"<br>");};try{var from=fromForm.attr("value");var mail=mailForm.attr("value");if(mail){previewFROM.innerHTML="<a href='mailto:"+mail
+"' rel='nofollow'><b>"+from+"</b></a>";}
else{previewFROM.innerHTML=from;}
previewDATE.innerHTML=dateForm.attr("value");previewMESSAGE.innerHTML=formArea.attr("value").replace(/\r\n/g,"<br>").replace(/\r/g,"<br>").replace(/\n/g,"<br>");}catch(e){Zeromin2.sendError(e);}};formArea.blur(feedback);fromForm.blur(feedback);mailForm.blur(feedback);dateForm.blur(feedback);feedback();};