var j$=jQuery.noConflict();function outPutTN(h,n){try{var c=document.getElementById(n[0].keyid);for(var l=0;l<h.length;l++){var q=h[l];if(typeof(q.TNlinkF)=="undefined"){continue}if(typeof(q.TNlinkL)=="undefined"){continue}var p=document.createElement("a");p.href=q.link+objInfo.value.afiid;p.setAttribute("target","_blank");if((q.TNlinkF!="null")&&(q.TNlinkL!="null")){if(10<=getURLnum(q.TNlinkF)){continue}if(typeof(n[0].cnt)=="undefined"){break}if((getLastTNnum(q.TNlinkL)<=5)||(n[0].cnt=="max")){for(var g=1;g<=getLastTNnum(q.TNlinkL);g++){var m=document.createElement("img");m.src=getURLmoji(q.TNlinkF)+"-"+getXKetaNum(getKeta(q.TNlinkF),g)+".jpg";m.setAttribute("alt",q.title);m.setAttribute("width",120);m.setAttribute("height",90);p.appendChild(m)}}else{if(getLastTNnum(q.TNlinkL)<n[0].cnt){var b=getLastTNnum(q.TNlinkL)}else{var b=n[0].cnt}var d=new Array(b);d=rnd_sel(1,getLastTNnum(q.TNlinkL),b);for(var f=0;f<=b-1;f++){var m=document.createElement("img");m.src=getURLmoji(q.TNlinkF)+"-"+getXKetaNum(getKeta(q.TNlinkF),d[f])+".jpg";m.setAttribute("alt",q.title);m.setAttribute("width",120);m.setAttribute("height",90);p.appendChild(m)}}c.appendChild(p)}}}catch(o){}}function outPutPK(g,k){try{var j=document.getElementById(k[0].keyid);for(var d=0;d<g.length;d++){var f=g[d];if(typeof(f.PackL)=="undefined"){continue}var b=document.createElement("a");b.href=f.link+objInfo.value.afiid;b.setAttribute("target","_blank");if((f.PackL!="null")&&(f.PackL!=null)){var c=document.createElement("img");c.src=f.PackL;c.setAttribute("alt",f.title);b.appendChild(c);j.appendChild(b)}}}catch(h){}}function out(a){(document.getElementById("outputArea")).appendChild(document.createTextNode(a));(document.getElementById("outputArea")).appendChild(document.createElement("br"))}function getURLmoji(a){return a.replace(/-.+$/,"")}function getURLnum(a){a=a.replace(/^.+?-/,"");a=a.replace(/^0*/,"");a=a.replace(/\.jpg.*$/,"");return a}function getKeta(b){b=b.replace(/^.+?-/,"");b=b.replace(/\.jpg.*$/,"");var a=new String(b);return a.length}function getLastTNnum(b){var a=getURLnum(b);if((0<=a)&&(a<=10)){a=5}else{if((11<=a)&&(a<=15)){a=15}else{if((16<=a)&&(a<=20)){a=20}else{if((21<=a)&&(a<=25)){a=25}else{if((26<=a)&&(a<=30)){a=30}else{if((31<=a)&&(a<=35)){a=35}else{if((36<=a)&&(a<=40)){a=40}else{}}}}}}}return a}function getXKetaNum(c,b){var a=new String(b);while(a.length<c){a=new String("0"+a.valueOf())}return a.valueOf()}function rnd_sel(h,b,c){var a=new Array();var g=new Array(c);for(var f=0;f<b-h+1;f++){a[f]=f+h}for(var f=0;f<c;f++){var e=Math.floor((b-h+1-f)*Math.random());g[f]=a[e];var d=a[b-h-f];if(e!=(b-h-f)){a[e]=d}}return g}(function(a){a(document).ready(function(){var c=a.map(objInfo.value.items,function(e,d){return e.keyid});var b=(function(d){return function(f){var e=a.grep(f.value.items,function(i,h){return i.keyid==d});var g=a.grep(objInfo.value.items,function(i,h){return i.keyid==d});if((typeof(e)!="undefined")&&(e.length==0)){return}switch(g[0].type){case"TN":outPutTN(e,g);break;case"P":outPutPK(e,g);break;default:}}});a("div").each(function(){var d=a.inArray(this.id,c);if(0<=a.inArray(this.id,c)){a.getJSON(objInfo.value.jsonpath,(b)(this.id))}})})})(jQuery);