function display_visitor_stats(busid)
{savepage('display_visitor_stats('+busid+')');closeopenfloat('open');uploadtext_to_float(loadingcode);document.getElementById("float_title").innerHTML="Visitor Statistics";GDownloadUrl("include/business_count_get.php?bid="+busid,function(data){var xml=GXml.parse(data);var vcount=xml.documentElement.getElementsByTagName("result");var vmess=xml.documentElement.getElementsByTagName("message");var temp=new Array();var newlayout="";var b_message=vmess[0].getAttribute("message");var year_store='';var count_highest=0;temp=b_message.split(':');if(trimwhitespace(temp[0])=="OK")
{for(var i=0;i<vcount.length;i++)
{var tmpcount=vcount[i].getAttribute("result_count");tmpcount=tmpcount*1;count_highest=count_highest*1;if(count_highest<tmpcount){count_highest=tmpcount}}
for(i=0;i<vcount.length;i++)
{var b_stats_month=vcount[i].getAttribute("result_month");var b_stats_year=vcount[i].getAttribute("result_year");var b_stats_count=vcount[i].getAttribute("result_count");if((year_store!=b_stats_year)||(year_store==''))
{year_store=b_stats_year;newlayout+='<p><span class = "year_text">'+year_store+'</span><br/></p>';}
newlayout+='<p><label class="stat_label">'+b_stats_month+'</label><span class="statbar_back"><span id="statbar'+i+'" class="statbar_fill"></span></span> <span id = "visitorlabel'+i+'"class ="stat_count_text">&nbsp;'+b_stats_count+' Visitors'+'</span><br/></p>';}
newlayout+='<span><a href="javascript:displaynewdetails('+busid+');">Click here to return to the businesses main page</a></span>';uploadtext_to_float(newlayout);for(i=0;i<vcount.length;i++)
{var b_stats_count=(vcount[i].getAttribute("result_count")*1);if(b_stats_count==count_highest)
{change_css_style("visitorlabel"+i,'color','red')}
change_css_style("statbar"+i,'width',((b_stats_count/count_highest)*100)+'%')}}else
{newlayout+='<br/><br/><p><center><b>There have been no recorded hits!</b></center><br/></p>';newlayout+='<span><a href="javascript:displaynewdetails('+busid+');">Click here to return to the businesses main page</a></span>';uploadtext_to_float(newlayout);}
document.getElementById("float_inside").scrollTop=0;});}
function keyword_stats_top100(option_top100)
{savepage('keyword_stats_top100()');closeopenfloat('open');uploadtext_to_float(loadingcode);document.getElementById("float_title").innerHTML="Keyword Statistics";if((option_top100>=1)&&(option_top100<=3)){}else{option_top100=1;}
GDownloadUrl("include/keyword_count_get.php?type="+option_top100,function(data){var xml=GXml.parse(data);var vcount=xml.documentElement.getElementsByTagName("keywords");var vmess=xml.documentElement.getElementsByTagName("message");var newlayout="";var b_message=vmess[0].getAttribute("message");newlayout+='<br /><div><b><center>Top One Hundred Keywords</center></b></div>';newlayout+='<br /><div><center><a href="javascript:keyword_stats_top100(1);">This Month</a> ~ <a href="javascript:keyword_stats_top100(2);">This Year</a> ~ <a href="javascript:keyword_stats_top100(3);">All Time</a></center></div>';temp=b_message.split(':');if(trimwhitespace(temp[0])=="OK")
{newlayout+='<p><label class="key_num_label">'+'Rank'+'</label> <label class="keyword_label">'+'Keyword / Phrase'+'</label> <span id = "visitorlabel'+i+'"class ="stat_count_text">&nbsp;'+'Count'+'</span><br/></p>';for(i=0;i<vcount.length;i++)
{var K_name=vcount[i].getAttribute("keyword");var k_count=vcount[i].getAttribute("count");newlayout+='<p><label class="key_num_label">'+(i+1)+'</label> <label class="keyword_label">'+K_name.toUpperCase()+'</label> <span id = "visitorlabel'+i+'"class ="stat_count_text">&nbsp;'+k_count+'</span><br/></p>';}
newlayout+='<span><a href="javascript:go_back_a_page();">Click here to return to the search results page</a></span>';uploadtext_to_float(newlayout);}else
{newlayout+='<br/><br/><p><center><b>There was a problem retrieving the information, please try again later</b></center><br/></p>';newlayout+='<span><a href="javascript:go_back_a_page();">Click here to return to the search results page</a></span>';uploadtext_to_float(newlayout);}
document.getElementById("float_inside").scrollTop=0;});}
