function build_box(site,glname,loc,mes,nov,hits,rank) {
document.write("<td valign=top>");

document.write("<table cellspacing=0 cellpadding=0 border=0 width=340><tr><td>");
document.write("<table cellspacing=0 cellpadding=0 border=0><tr><td colspan=2><img src=images/box_left_top108x37.gif width=108 height=37></td></tr>");
document.write("<tr><td><img src=images/box_left_left18x108.gif width=18 height=108></td>");
document.write("<td valign=top width=90 height=108 background=images/box_left_img90x108.jpg><a href=hitstraker.php?"+site+" target=_blank><img src=icons_new/icon"+site+".jpg width=90 height=90 border=0></a></td>");
document.write("</tr></table></td><td>");
if (rank<10) {
bg_header="box_rite_header232x28top"+(rank+1)+".jpg";
bg_hits="box_rite_top232x32_top10.jpg";
}else{
bg_header="box_rite_header232x28.jpg";
bg_hits="box_rite_top232x32.jpg";
}

document.write("<table cellspacing=0 cellpadding=0 border=0><tr><td width=232 height=32 class=hits background=images/"+bg_hits+">"+hits+"&nbsp;&nbsp;&nbsp;&nbsp;</td></tr>");
document.write("<tr><td width=232 height=28 background=images/"+bg_header+"><a class=sites href=hitstraker.php?"+site+" target=_blank>"+glname+"</a>");
if (gals[pn].nov==1) document.write("&nbsp;<img src=icons_new/new05.gif>");
if (gals[pn].nov==2) document.write("&nbsp;<img src=icons_new/new07.gif>");
document.write("</td></tr>");
document.write("<tr><td height=85 background=images/box_rite_text232x85.jpg class=mes>"+mes+"</td></tr>");

document.write("</table></td></tr></table>");

document.write("</td>");
}




total_hits=0;
cols=2;

function build_gals(st,numb) {

rows=Math.ceil((numb-st)/cols);
document.write("<table cellspacing=0 cellpadding=0 border=0>");
for (i=0;i<rows;i++) {

document.write('<tr>');
for (j=0;j<cols;j++) {

pn=i*cols+j+st;

total_hits+=hit_data[gals[pn].site];

build_box(gals[pn].site,gals[pn].glname,gals[pn].loc,gals[pn].mes,gals[pn].nov,hit_data[gals[pn].site],top_data[gals[pn].site]);

if (pn%2==0)  document.write("<td nowrap style='width:30px'>&nbsp;</td>");


}
document.write("</tr>");



}
document.write("</table>");
}



function build_toplist() {
topsites=10;
document.write("<table cellspacing=0 cellpadding=0 border=0 width=100%>");
for (i=0;i<topsites;i++) {
document.write("<tr><td width=22 align=right><img src=images/top"+(i+1)+".gif height=19></td>");
for (j=0;j<gals.length;j++) {
if (gals[j].site==toplist_data[i]) {
break;
}
}
document.write("<td><a class=topsites href=hitstraker.php?"+gals[j].site+" target=_blank>"+gals[j].glname+"</a></td>");
document.write("<td class=hits align=right>"+hit_data[toplist_data[i]]+"&nbsp;&nbsp;</td></tr>");
}
document.write("</table>");
}


function true_loc(st){            //call from hitstraker.php
for (i=0;i<gals.length;i++) {
if (gals[i].site==st) {
return gals[i].loc;
break;
}
}
}

chdp='';
dpp=0;
function change_dpic() {
document.getElementById('md').style.fontWeight='400';
document.getElementById('d').innerText=dailypics[dpp];
document.dpic.src="dailypic/dp/dth/"+dailypics[dpp]+".jpg";
dpp++;
if (dpp==dailypics.length) {
dpp=0;
dailypic_over();
return;
}
chdp=setTimeout("change_dpic()",3000);
}

function dailypic_over() {
clearTimeout(chdp);
document.getElementById('md').style.fontWeight='600';
document.getElementById('d').innerText=tday;
document.dpic.src="dailypic/dp/dth/"+tday+".jpg";
}

function dailypic_out() {
clearTimeout(chdp);
change_dpic();
}

















