window.onload=L;window.onresize=S;function S(){var nh=WH();if(nh<=100){return;}nh=nh-E("hd").clientHeight-E("tdlh").clientHeight-60;nh=nh<100?100:nh;E("ptr").style.height=nh+'px';;E("prs").style.height=nh+'px';;}var vd=null;var req=null;function L(){S();T(0);if(window.XMLHttpRequest){try{req=new XMLHttpRequest();}catch(e){req=0;}}else if(window.ActiveXObject){try{req=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{req=new ActiveXObject('Microsoft.XMLHTTP');}catch(e){req=0;}}}if(req){req.onreadystatechange=RP;req.open('GET','http://www.islamitexts.org/getjson.php?k='+s+':'+vs+'-'+ve,1);req.send('');}for(var ii=vs;ii<=ve;ii++){if(E('v'+ii)&&E('t'+ii)){CP('v'+ii);CP('t'+ii);}}CD('v'+ov);CD('t'+ov);}function RP(){if(req.readyState==4&&req.status==200){vd=eval('('+req.responseText+')');}}function WH(){var ht=0;if(typeof(window.innerHeight)=='number'){ht=window.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){ht=document.documentElement.clientHeight;}else if(document.body&&document.body.clientHeight){ht=document.body.clientHeight;}return ht;}function E(id){if(document.getElementById)return document.getElementById(id);else if(document.all)return document.all[id];else if(document.layers)return document.layers[id];}function D(){var w='';if(document.getSelection){w=document.getSelection();}else if(document.selection&&document.selection.createRange){var r=document.selection.createRange();if(document.selection.type=='Text'&&r.text>''){document.selection.empty();w=r.text;}}else return;w=w.match(/[a-zA-Z]+/i);if(w){window.open('http://www.searchquran.org/wordfinder.php?w='+encodeURIComponent(w),'dict','width=700,height=500,resizable=1,menubar=1,scrollbars=1,status=1,titlebar=1,toolbar=1,location=1,personalbar=1');}}var v=0;function C(a,b){if(b==ov){return;}s=a;v=b;if(vd[(b-vs)+'']){ST(vd[(b-vs)+'']);return;}}function ST(tx){for(var i=0;i<tx.translations.length;i++){RI('pt'+tx.translations[i].id,tx.translations[i].translation);}var ct=tx.commentaries.translation;ct=ct.replace(/{{/g,'<span class=ntrf>');ct=ct.replace(/}}/g,'</span>');RI('ct1',ct+' (Translation)');if(!tx.commentaries.notes){RI('cn','<div class=cnot>No notes found for this verse.</div>');}else{var t='';for(var j=0;j<tx.commentaries.notes.length;j++){var n=tx.commentaries.notes[j];t+='<div class=cnot>'+n.id+'. '+n.note+'</div>';}RI('cn',t);}if(E('v'+ov))E('v'+ov).className='qrv';if(E('v'+v))E('v'+v).className='qrvs';E('t'+ov).className='qrt';E('t'+v).className='qrts';CD('v'+v);CD('t'+v);CP('v'+ov);CP('t'+ov);E('sk').value=s+':'+v;ov=v;}function RI(e,t){var el=E(e);if(!el){return;}if(el.innerHTML){el.innerHTML=t;}else if(el.innerText){el.innerText=t;}}var st=-1;function T(a){if(a==st){return;}DN('tch1');if(a==0){E('tbc').className='sel';E('tbt').className='';CD('tbc');CP('tbt');DB('tc0');DN('tc1')}if(a==1){E('tbc').className='';E('tbt').className='sel';CD('tbt');CP('tbc');DN('tc0');DB('tc1')}st=a;}function CD(e){E(e).style.cursor='default';}function CP(e){E(e).style.cursor='pointer';}function DB(e){E(e).style.display='block';}function DN(e){E(e).style.display='none';}function TR(){for(var l=vs;l<=ve;l++){RI('t'+l,vd[l-vs].translations[E('tsl').value-1].translation+' ('+l+')');}}
