var krpanoplugin=function(){var E=this,c=null,w=null,J,F;E.registerplugin=function(g,n,k){c=k;c.registerattribute("tfin","SrNo;Room Type;Tarrif($);1;Delux Double;250;2;Delux Single;200;3;Luxury Double;150;4;Luxury Single;100;5;Economy Double;100;6;Economy Single;80;");c.registerattribute("ttitle","Room tarrif per night:1:1:1");c.registerattribute("rows","10");c.registerattribute("colword","3:1,1,0,0x000000:0:2,1,1,0x000000");c.registerattribute("xstart","10");c.registerattribute("ystart","10");c.registerattribute("xpad",
"5");c.registerattribute("ypad","5");c.registerattribute("borderword","#000000:2");c.registerattribute("headercolour","#0000FF");c.registerattribute("cellbackgroundcolour","#FFFF00");c.registerattribute("fcolour","#FF0000");c.registerattribute("fnt","5");c.registerattribute("fsiz","4");c.registerattribute("pluginbordercolour","#000000");c.registerattribute("pluginfillcolour","#0000FF");c.registercontentsize(512,512);w=document.createElementNS("http://www.w3.org/2000/svg","svg");w.style.width="100%";
w.style.height="100%";c.sprite.appendChild(w);g=[];n=[];var f,q=[],t=[],d=[],l=[],x=[],m=[],p=[],h,y,a,b,u,e,z,A,B,C,L,D,M,N,v,r,K,O,P,Q;p.length=0;h=l.length=0;p=c.tfin.split(";");k=Number(c.rows);l=c.colword.split(":");f=Number(l[0]);z=Number(c.xstart);A=Number(c.ystart);B=Number(c.xpad);C=Number(c.ypad);x.length=0;x=c.borderword.split(":");L=x[0];D=0;1<x.length&&(D=Number(x[1]));0==D&&(D=1);M=c.headercolour;N=c.cellbackgroundcolour;x=c.fcolour;v=Number(c.fnt);r=Number(c.fsiz);P=c.pluginbordercolour;
O=c.pluginfillcolour;K=c.ttitle;y=p.length;1>k&&(k=1);20<k&&(k=20);1>f&&(f=1);20<f&&(f=20);if(y<k*f)for(a=y;a<k*f;a++)p[a]=" ";v=1==v?"Times New Roman":2==v?"Arial":3==v?"Calibri":4==v?"Courier":5==v?"Verdana":"Arial";y=1==r?10:2==r?12:3==r?14:4==r?16:5==r?18:10;r=0;q[0]=z;t[0]=A;for(b=0;b<f;b++){for(a=h=0;a<k;a++)p[a*f+b].length>h&&(h=p[a*f+b].length,u=a);h=p[u*f+b];d[b]=Math.round(h.length*y*.6)+2*B;h=y+2*C;q[b+1]=q[b]+d[b]}b=[];u=[];var G=[],H=[],I=[];u.length=f;G.length=f;H.length=f;I.length=
f;b.length=f;for(a=0;a<f;a++)u[a]=0,G[a]=0,H[a]=0,I[a]=x,b[a]="";if(1<l.length)for(a=0;a<l.length-1;a++)b=l[a+1].split(","),0<b.length&&(u[a]=Number(b[0]),1<b.length&&(G[a]=Number(b[1])),2<b.length&&(H[a]=Number(b[2])),3<b.length&&(I[a]=b[3]));for(a=0;a<k;a++)t[a+1]=t[a]+h;for(a=0;a<k;a++)for(b=0;b<f;b++)e=a*f+b,l=0==a||1==G[b]?"bold":"normal",Q=I[b],n[e]=document.createElementNS("http://www.w3.org/2000/svg","rect"),n[e].setAttribute("x",q[b]),n[e].setAttribute("y",t[a]),n[e].setAttribute("width",
d[b]),n[e].setAttribute("height",h),n[e].setAttribute("stroke-width",D),n[e].setAttribute("stroke",L),0==a?n[e].setAttribute("fill",M):n[e].setAttribute("fill",N),g[e]=document.createElementNS("http://www.w3.org/2000/svg","text"),0==u[b]?(g[e].setAttribute("text-anchor","start"),g[e].setAttribute("x",q[b]+B),g[e].setAttribute("y",t[a]+h-C)):1==u[b]?(g[e].setAttribute("text-anchor","middle"),g[e].setAttribute("x",q[b]+d[b]/2),g[e].setAttribute("y",t[a]+h-C)):2==u[b]&&(g[e].setAttribute("text-anchor",
"end"),g[e].setAttribute("x",q[b]+d[b]-B),g[e].setAttribute("y",t[a]+h-C)),1==H[b]&&g[e].setAttribute("font-style","italic"),g[e].setAttribute("font-size",y),g[e].setAttribute("font-family",v),g[e].setAttribute("fill",Q),g[e].setAttribute("font-weight",l),l=document.createTextNode(p[e]),g[e].appendChild(l);for(a=0;a<f;a++)r+=d[a];J=r+z+z;F=k*h+A+A;F+=h;c.registercontentsize(J,F);d=document.createElementNS("http://www.w3.org/2000/svg","rect");d.setAttribute("x",q[0]-z);d.setAttribute("y",t[0]-A);d.setAttribute("width",
J);d.setAttribute("height",F);d.setAttribute("stroke",P);d.setAttribute("fill",O);d.setAttribute("fill-opacity",.25);d.setAttribute("stroke-width",1);w.appendChild(d);d.addEventListener("click",E.hittest);0<K.length&&(m.length=0,m=K.split(":"),B=p=d=0,1<m.length&&(2==m.length?d=Number(m[1]):3==m.length?(d=Number(m[1]),p=Number(m[2])):4==m.length&&(d=Number(m[1]),p=Number(m[2]),B=Number(m[3]))),l="normal",z="none",A="normal",0!=d&&(l="bold"),0!=p&&(z="underline"),0!=B&&(A="italic"),d=document.createElementNS("http://www.w3.org/2000/svg",
"text"),d.setAttribute("x",q[0]+r/2),d.setAttribute("y",t[k]+h),d.setAttribute("font-size",y),d.setAttribute("font-family",v),d.setAttribute("text-decoration",z),d.setAttribute("font-style",A),d.setAttribute("fill",x),d.setAttribute("font-weight",l),d.setAttribute("text-anchor","middle"),q=document.createTextNode(m[0]),d.appendChild(q),w.appendChild(d));for(e=0;e<k*f;e++)w.appendChild(n[e]),w.appendChild(g[e])};E.unloadplugin=function(){c=null};E.onresize=function(c,n){return!1}};
