function disable_flower_selector(entryid)
{
var o=document.getElementById('flowertagid_'+entryid);
if (o) {
o.innerHTML="Giving...";
}
var o=document.getElementById('flowergivingtd_'+entryid);
if (o) {
o.style.display='none';
}
}
var jcurrent_flower_selector=0;
function jopen_flower_selector(entryid)
{
//document.onmouseup=jblogcomments_mouse_up;
var jcurrent=jcurrent_flower_selector;
if (jcurrent_flower_selector!=0) close_flower_selector(jcurrent);
if (jcurrent==entryid) return;
jcurrent_flower_selector=entryid;
var o=document.getElementById('flowerselector_'+entryid);
if (o) {
var html='
';
var j=0;
for (var i=1;i<=16;++i) {
if (j==0) html+='';
html+='';
html+=' ';
html+=' | ';
j++;
if (j>=4) {
j=0;
html+='
';
}
}
html+='
';
o.innerHTML=html;
if (o.style.display=='') o.style.display='none';
else o.style.display='';
}
}
function close_flower_selector(entryid)
{
if (jcurrent_flower_selector==entryid) jcurrent_flower_selector=0;
var o=document.getElementById('flowerselector_'+entryid);
if (o) {
if (o.style.display=='') o.style.display='none';
}
else {
}
}
function jflowerselector_mouse_up()
{
close_flower_selector(jcurrent_flower_selector);
}
function jflowerselector()
{
document.onmouseup=jflowerselector_mouse_up;
}
var flowerselector=new jflowerselector();
var jflower_xmldoc=null;
function gflwr(entryid,flowerid)
{
disable_flower_selector(entryid);
if (typeof window.ActiveXObject!='undefined') {
jflower_xmldoc = new ActiveXObject("Microsoft.XMLHTTP");
jflower_xmldoc.onreadystatechange = jflower_process_http_request;
}
else {
jflower_xmldoc = new XMLHttpRequest();
jflower_xmldoc.onload = jflower_process_http_request;
}
url='/home/giveflower.php?entryid='+entryid+'&flowerid='+flowerid+'&type=xmlhttp';
if (jflower_xmldoc) {
jflower_xmldoc.open( "GET", url, true );
jflower_xmldoc.send( null );
var o=document.getElementById('jflowertagid_'+entryid);
if (o) o.innerHTML='
'+o.innerHTML;
}
}
function jflower_process_http_request()
{
if (jflower_xmldoc.readyState!=4) return;
var ok=jflower_xmldoc.responseText.substring(0,4);
if (ok=='[OK]') {
var p=jflower_xmldoc.responseText.indexOf(';');
if (p>0) {
var p2=jflower_xmldoc.responseText.indexOf(';',p+1);
if (p2>0) {
var entryid=jflower_xmldoc.responseText.substring(4,p);
var flowercount=jflower_xmldoc.responseText.substring(p+1,p2);
var response=jflower_xmldoc.responseText.substring(p2+1);
var o=document.getElementById('jflowertagid_'+entryid);
if (o) o.innerHTML=response;
o=document.getElementById('flowerselectorlink_'+entryid);
if (o) o.innerHTML="I gave flower!";
o=document.getElementById('flowercounttag_'+entryid);
if (o) o.innerHTML='Flowers: '+flowercount;
}
}
}
else if (ok=='[!K]') {
var p=jflower_xmldoc.responseText.indexOf(';');
if (p>0) {
var entryid=jflower_xmldoc.responseText.substring(4,p);
var response=jflower_xmldoc.responseText.substring(p+1);
o=document.getElementById('flowerselectorlink_'+entryid);
if (o) o.innerHTML="";
}
}
delete jflower_xmldoc;
jflower_xmldoc=null;
}