var poem_OP=navigator.userAgent.indexOf("Opera")!=-1?true:false,poem_URL=window.location.href.substr(0,window.location.href.lastIndexOf("/")+1);document.write('<pre id="poemMeasure" style="visibility:hidden;position:absolute"></pre>');function poem_getValue(d,b){var e=new RegExp("([ ']|^)"+d+"[ ]*=[ ]*'[^']*'","i");e=b.match(e);if(!e){e=new RegExp("([ ']|^)"+d+"[ ]*=[ ]*[^' ]*([ ]|$)","i");e=b.match(e);if(!e)return""}e=e[0];for(d="";e!=d;){d=e;e=e.replace(/[\'\";]/g,"");e=e.replace(/&#/g,"&^#")}e=e.replace(/^[ ]/,"");e=e.replace(/[ ]$/,"");d=e.search("=");return e.substring(d+1).replace(/[\(\)\&\[\]\;]/g,"")}function poem_toNumber(d){d=parseInt(d);if(isNaN(d))d=0;return d}function poem_setArg(d){var b,e=new Array(8,10,12,14,16,18,20);b=poem_getValue("font",d)+",,,,,,,";b=b.split(",");poem_FontName=b[0];b[1]=poem_toNumber(b[1]);if(b[1]>=1&&b[1]<=7)b[1]=e[b[1]-1];poem_FontSize=b[1]+"pt";poem_FontColor=b[2];poem_FontBold=poem_toNumber(b[3])?"bold":"normal";poem_FontItalic=poem_toNumber(b[4])?"italic":"normal";poem_FontUnderline=poem_toNumber(b[5])?"underline":"none";b=poem_getValue("border",d)+",,,";b=b.split(",");poem_BorderStyle=b[0];poem_BorderSize=poem_toNumber(b[1]);poem_BorderColor=b[2];poem_Shadow=b[3]==""||b[3]!=0?poem_BorderStyle!="none"&&poem_BorderStyle!="":0;b=poem_getValue("shadow",d);b=poem_toNumber(b);poem_Shadow=poem_Shadow&&b;b=poem_getValue("num",d)+",,";b=b.split(",");poem_Serial=poem_toNumber(b[0]);poem_SerialColor=b[1];poem_SerialSize=poem_toNumber(b[2]);b=poem_getValue("type",d);b=poem_toNumber(b);if(b<1||b>3)b=0;poem_Type=b;if(poem_BreakImage=b=poem_getValue("brimage",d)){if(poem_BreakImage.search(/^http:\/\//i)==-1)poem_BreakImage=poem_URL+poem_BreakImage;poem_BreakImage='<img border=0 src="'+poem_BreakImage+'">'}else poem_BreakImage="-";poem_BackColor=b=poem_getValue("bkcolor",d);b=poem_getValue("width",d);poem_BorderWidth=poem_toNumber(b);b=poem_getValue("marginlr",d);poem_MarginLR=poem_toNumber(b);if(poem_MarginLR<=0)poem_MarginLR=15;b=poem_getValue("margintb",d);poem_MarginTB=poem_toNumber(b);if(poem_MarginTB<=0)poem_MarginTB=15;poem_BackImage=b=poem_getValue("bkimage",d);if(poem_BackImage.search(/^http:\/\//i)==-1)poem_BackImage=poem_URL+poem_BackImage}function doPoem(d){function b(q,v){for(var r=0,o=0;o<q.length;o++)q.substr(o,1)==v&&r++;return r}function e(){return h?'<table border=0 cellpadding=0 cellspacing=0 style="border-collapse:collapse;margin-left:'+(k-h)+";height:"+s+";width:"+h+"px;position:absolute;"+t+'"><tr><td align=left>'+p+"   </td></tr></table>":""}function u(){m=i/4;n=i/2;k=poem_Type==1?i+n+h:poem_Type==2?2*i+h:poem_Type==3?i+h:2*i+m+h}var k,c,s,i,h,j,a,g,f,p,m,n,t;j="";var l=5;f=fetch_object("poemMeasure");j=window.document.getElementsByTagName("PRE");j=j[j.length-1];a=j.innerHTML;j.innerHTML="";j.style.display="none";poem_setArg(d);d="background-position:top right;border:"+poem_BorderSize+"px "+poem_BorderStyle+" "+poem_BorderColor;t="font-family:Arial;font-weight:bold;font-size:"+poem_SerialSize+";color:"+poem_SerialColor+";font-weight:"+poem_FontBold;g="font-family:"+poem_FontName+";font-size:"+poem_FontSize+";color:"+poem_FontColor+";font-weight:"+poem_FontBold+";font-style:"+poem_FontItalic+";text-decoration:"+poem_FontUnderline;a=a.replace(/\n/g,"\r");a=a.replace(/[\u2019\u2018]/g,"");a=a.replace(/<@/g,"<");a=a.replace(/<br \/>|<br>/gi,"\r");a=a.replace(/\[[a-z]+[^\]]*\]/gi,"");a=a.replace(/\[\/[a-z]+\]/gi,"");a=a.replace(/<@/i,"<");if(!poem_OP){a=a.replace(/<font[ ]+style=[\"\']background-color:[ ]*([^> ]+)[\"\']>/gi,"<@font style\u2019background-color:$1>");a=a.replace(/<font[ ]+style=[\"\']background-color:[ ]*([^ ]+)[\"\'][ ]+color=[ ]*([^> ]+)>/gi,"<@font style\u2019background-color:$1 color\u2019$2>");a=a.replace(/<font[ ]+color=[ ]*([^ ]+)[ ]+style=[\"\']background-color:[ ]*([^ ]+)[\"\']>/gi,"<@font style\u2019background-color:$1 color\u2019$2>")}a=a.replace(/<font[ ]+color=[ ]*([^> ]+)>/gi,"<@font color\u2019$1>");a=a.replace(/<\/font>/gi,"<@/font>");a=a.replace(/<(s|b|strong|em|i|u|sup|sub|br)>/gi,"<@$1>");a=a.replace(/<\/(s|b|strong|em|i|u|sup|sub|br)>/gi,"<@/$1>");a=a.replace(/<[a-z]+[^>]*>/gi,"");a=a.replace(/<\/[a-z]+>/gi,"");a=a.replace(/<@/g,"<");a=a.replace(/=/g,"\u2018");a=a.replace(/\u2019/g,"=");a=a.replace(/\u0640/g,"");a=a.replace(/[\t\v]/g,"");a=a.replace(/[ ]+/g," ");a=a.replace(/\r\r/g,"\r");a=a.replace(/[ ]*\u2018[ ]*/g,"\u2018");a=a.replace(/[ ]\r/g,"\r");a=a.replace(/\r[ ]/g,"\r");f.style.display="block";if(poem_Serial==0)h=0;else{f.style.fontFamily="Arial";f.style.fontSize=poem_SerialSize;f.style.fontWeight=poem_FontBold;c=b(a,"\r")+poem_Serial;c+="";c=c.length+1;c="999999".substr(0,c);f.innerHTML="   "+c;h=f.clientWidth}f.style.fontFamily=poem_FontName;f.style.fontSize=poem_FontSize;f.style.color=poem_FontColor;f.style.fontWeight=poem_FontBold;f.style.fontStyle=poem_FontItalic;f.style.textDecoration=poem_FontUnderline;c=a;c=c.replace(/\u2018/g," <br>");c=c.replace(/\r/g," <br>");f.innerHTML=c;i=f.clientWidth;f.innerHTML=" ";s=f.clientHeight;u();c=poem_BorderWidth-2*poem_MarginLR-2*poem_BorderSize-poem_Shadow*l+3;if(c>k){i=poem_Type==1?2*(c-h)/3:poem_Type==2?(c-h)/2:poem_Type==3?c-h:4*(c-h)/9;u()}else{poem_MagrinLR=(poem_BorderWidth-k)/2;if(poem_MarginLR<0)poem_MarginLR=0}f.style.display="none";f.innerHTML="";f=' <img border=0 src="space.gif" height=1px width="'+i+'px">';window.document.write("<div align=center>");if(poem_Shadow){window.document.write('<table border=0 cellpadding=0 cellspacing=0 bordercolor=#111111 style="border-collapse:collapse"><tr>');window.document.write('<td height=100% style="padding-top:'+2*l+'px"><div style="height:100%;width:'+l+'px;background-color:black;font-size:1pt;filter:alpha(opacity=15);-moz-opacity:0.15;opacity:0.15"></div></td>');window.document.write("<td valign=top>")}window.document.write('<table border=0 bgcolor="'+poem_BackColor+'" background="'+poem_BackImage+'" cellpadding=0 cellspacing=0 style="'+d+";"+g+'">');window.document.write('<td style="padding-left:'+poem_MarginLR+"px;padding-right:"+poem_MarginLR+"px;padding-top:"+poem_MarginTB+"px;padding-bottom:"+poem_MarginTB+'px">');p=poem_Serial-1;a=a.split("\r");for(d=0;d<a.length;d++){c=a[d];g="";c&&c!="-"&&p++;if(c.indexOf("\u2018")!=-1){c=c.split("\u2018");if(poem_Type==1){g+='<div style="width:'+k+'px">';g+=e();g+='<div style="padding-right:5px;text-align:justify;padding-right:'+h+"px;padding-left:"+n+'px">'+c[0]+f+"</div>";g+='<div style="padding-right:5px;text-align:justify;padding-right:'+(n+h)+'px">'+c[1]+f+"</div>"}else if(poem_Type==2){g+='<div style="width:'+k+'px">';g+=e();g+='<div style="padding-right:5px;text-align:justify;padding-right:'+h+"px;padding-left:"+i+'px">'+c[0]+f+"</div>";g+='<div style="padding-right:5px;text-align:justify;padding-right:'+(i+h)+'px">'+c[1]+f+"</div>"}else if(poem_Type==3){g+='<div style="width:'+k+'px">';g+=e();g+='<div style="padding-right:5px;text-align:justify;padding-right:'+h+'px">'+c[0]+f+"</div>";g+='<div style="padding-right:5px;text-align:justify;padding-right:'+h+'px">'+c[1]+f+"</div>"}else{g+='<div style="text-align:right;width:'+k+'px">';g+=e();g+='<div style="padding-right:5px;text-align:justify;margin-left:'+(i+m)+"px;position:absolute;margin-right:"+h+"px;width:"+i+'px">'+c[0]+f+"</div>";g+='<div style="padding-right:5px;text-align:justify;padding-right:'+(m+i+h)+'px">'+c[1]+f+"</div>"}g+="</div>"}else if(c=="-")g+='<div align=center style="padding-right:'+h+'px">'+poem_BreakImage+"</div>";else if(c){g+=e();g+='<div align=center style="padding-right:'+h+'px"><div style="text-align:justify;width:'+i+'px">'+c+f+"</div></div>"}else g+="<br>";window.document.write(g)}window.document.write("</td></tr></table>");if(poem_Shadow){window.document.write("</td></tr>");window.document.write('<tr><td rowspan=3 colspan=2 style="padding-left:'+2*l+'px"><div style="width:100%;height:'+l+'px;background-color:black;font-size:1pt;filter:alpha(opacity=15);-moz-opacity:0.15;opacity:0.15;font-size:1pt"></div></td></tr>');window.document.write("</table>")}j.innerHTML=""};var Behaviour={list:[],register:function(f){Behaviour.list.push(f)},start:function(){Behaviour.addLoadEvent(function(){Behaviour.apply()})},apply:function(){for(h=0;sheet=Behaviour.list[h];h++)for(selector in sheet)if(list=document.getElementsBySelector(selector))for(i=0;element=list[i];i++)sheet[selector](element)},addLoadEvent:function(f){var a=window.onload;window.onload=typeof window.onload!="function"?f:function(){a();f()}}};Behaviour.start();function getAllChildren(f){return f.all?f.all:f.getElementsByTagName("*")}document.getElementsBySelector=function(f){if(!document.getElementsByTagName)return[];f=f.split(" ");for(var a=new Array(document),o=0;o<f.length;o++){token=f[o].replace(/^\s+/,"").replace(/\s+$/,"");if(token.indexOf("#")>-1){var b=token.split("#"),c=b[0];a=b[1];a=fetch_object(a);if(c&&a.nodeName.toLowerCase()!=c)return[];a=new Array(a)}else if(token.indexOf(".")>-1){b=token.split(".");c=b[0];var j=b[1];c||(c="*");b=[];for(var d=0,g=0;g<a.length;g++){var l;l=c=="*"?getAllChildren(a[g]):a[g].getElementsByTagName(c);for(var k=0;k<l.length;k++)b[d++]=l[k]}a=[];for(d=c=0;d<b.length;d++)if(b[d].className&&b[d].className.match(new RegExp("\\b"+j+"\\b")))a[c++]=b[d]}else if(token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)){c=RegExp.$1;var m=RegExp.$2;j=RegExp.$3;var n=RegExp.$4;c||(c="*");b=[];for(g=d=0;g<a.length;g++){l=c=="*"?getAllChildren(a[g]):a[g].getElementsByTagName(c);for(k=0;k<l.length;k++)b[d++]=l[k]}a=[];c=0;switch(j){case"=":j=function(e){return e.getAttribute(m)==n};break;case"~":j=function(e){return e.getAttribute(m).match(new RegExp("\\b"+n+"\\b"))};break;case"|":j=function(e){return e.getAttribute(m).match(new RegExp("^"+n+"-?"))};break;case"^":j=function(e){return e.getAttribute(m).indexOf(n)==0};break;case"$":j=function(e){return e.getAttribute(m).lastIndexOf(n)==e.getAttribute(m).length-n.length};break;case"*":j=function(e){return e.getAttribute(m).indexOf(n)>-1};break;default:j=function(e){return e.getAttribute(m)}}a=[];for(d=c=0;d<b.length;d++)if(j(b[d]))a[c++]=b[d]}else{if(!a[0])return;c=token;b=[];for(g=d=0;g<a.length;g++){l=a[g].getElementsByTagName(c);for(k=0;k<l.length;k++)b[d++]=l[k]}a=b}}return a};var xmlhttp;if(!xmlhttp&&typeof XMLHttpRequest!="undefined")try{xmlhttp=new XMLHttpRequest}catch(e){xmlhttp=false}function myXMLHttpRequest(){var b;try{b=new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{b=new ActiveXObject("Microsoft.XMLHTTP")}catch(c){b=false}}if(!b&&typeof XMLHttpRequest!="undefined")try{b=new XMLHttpRequest}catch(d){b=false;alert("couldn't create xmlhttp object")}return b}function sndRate(b,a,c,d,f,h,i,g){g=fetch_object(g+c);g.innerHTML='<img src="images/loading.gif" border="0">';xmlhttp.open("GET","rate.php?action="+b+"&star="+a+"&id="+c+"&m="+d+"&c="+f+"&v="+h+"&av="+i);xmlhttp.onreadystatechange=handleResponse;xmlhttp.send(null)}function handleResponse(){if(xmlhttp.readyState==4)if(xmlhttp.status==200){var b=xmlhttp.responseText,a=[];if(b.indexOf("|")!=-1){a=b.split("|");changeText(a[0],a[1])}}}function changeText(b,a){var c=document.all?1:0,d=0;if(parseInt(navigator.appVersion)>=5)d=1;if(d){b=fetch_object(b);b.innerHTML=a}else if(c)document.all[b].innerHTML=a}var ratingAction={"a.rater":function(b){b.onclick=function(){var a=this.href.replace(/.*\?(.*)/,"$1"),c=a.split("&");a=[];for(j=0;j<c.length;j++){var d=c[j].replace(/(.*)=.*/,"$1"),f=c[j].replace(/.*=(.*)/,"$1");a[d]=f}c=a.action;d=a.id;f=a.star;var h=a.m,i=a.c,g=a.v,k=a.av;a=a.div;sndRate(c,f,d,h,i,g,k,a);return false}}};Behaviour.register(ratingAction);