var baseURL='http://pibuzz.com';
//=================================================================================
// JavaScript Document
var SidebarTabs=new Array('tabhotcategories', 'taballcategories', 'tabcomments', 'tabrecentposts', 'tabpopularposts');
var SidebarBoxes=new Array('hotcategories', 'allcategories', 'recentcomments', 'recentposts', 'popularposts');
var Backgrounds=new Array('bottomtopcategories.jpg', 'bottomallcategories.jpg', 'bottomusercomments.jpg', 'bottomrecentposts.jpg', 'bottompopularposts.jpg');
var TheBox;
var p=0; 
var q=3;

//===================================
function UpdateAjaxBackground(k){
	
var absurl='http://pibuzz.com/wp-content/themes/default/images';	
if(p>=0 && p<=1){document.getElementById("ajaxtext1").style.backgroundImage='url('+absurl+'/'+Backgrounds[p]+')'; }
if(q>=2 && q<=4){document.getElementById("ajaxtext2").style.backgroundImage='url('+absurl+'/'+Backgrounds[q]+')'; }

return true;
}



//===================================
function ClearTab(k){

if(k>1 && k<5){
	for(i=2; i<SidebarTabs.length; i++){
	TheTab=eval('document.getElementById("'+SidebarTabs[i]+'")');
	TheTab.style.color="#AEAEAE";
	TheTab.className="inactive";
	}
}
else{
	for(i=0; i<=1; i++){
	TheTab=eval('document.getElementById("'+SidebarTabs[i]+'")');
	TheTab.style.color="#AEAEAE";
	TheTab.className="inactive";
	}
}
	
return true;
}

//==============================================================
function ResizeBox(p, q){
var dH1, dH2, H1, H2;
if(p=='1'){dH1=60;} else {dH1=30; }
document.getElementById("ajaxtext1").style.zIndex=10;
H1=document.getElementById("ajaxtext1").offsetHeight+dH1;

if(q=='2'){dH2=250; } else if(q=='3'){dH2=150;} else if(q=='4'){dH2=250;}
document.getElementById("ajaxtext2").style.zIndex=10;
H2=document.getElementById("ajaxtext2").offsetHeight+dH2;

if(document.all){
document.getElementById("ajaxbox1").style.height=H1;
document.getElementById("ajaxbox2").style.height=H2;
}
else{
	document.getElementById("ajaxbox1").style.height=H1+"px";
	document.getElementById("ajaxbox2").style.height=H2+"px";
	}

return true;
}



//=====================================
function ChangeTab(k){
var TheTab, H;
var dH=60;

if(k!='' && k!='5'){
ClearTab(k);
TheTab=eval('document.getElementById("'+SidebarTabs[k]+'")');
TheTab.style.color="#000000";
TheTab.className="activebutton";
}

if(k<='1'){
	p=k;
TheBox=document.getElementById("ajaxtext1");
document.getElementById("ajaxtext1").innerHTML='<center><br /><br /><br /><img src="'+baseURL+'/wp-content/loading.gif" width="32" height="32" align="top" vspace="2" /><br />Loading...</center>';
}
else {
q=k;
TheBox=document.getElementById("ajaxtext2");
document.getElementById("ajaxtext2").innerHTML='<center><br /><br /><br /><img src="'+baseURL+'/wp-content/loading.gif" width="32" height="32" align="top" vspace="2" /><br />Loading...</center>';

}

return true;
}

//=====================================
function fOver(theElement){
if(theElement.className!='activebutton'){
	theElement.style.color="#000000";
}
	
}


function fOut(theElement){
if(theElement.className!='activebutton'){
	theElement.style.color="#AEAEAE";
}
	
	
}

//=====================================




//=====================================
function LoadText(responsetext){
TheBox.innerHTML=responsetext+'<br />';
//ResizeBox();
UpdateAjaxBackground();
return true;
}

//=====================================
function SidebarInfo(k){
ChangeTab(k);
url=baseURL+'/wp-content/ajax.php?k='+k;
ajax.get(url,LoadText);
return true;
}

//======================================
function QuoteDisplay(responsetext){
if(responsetext!=null && responsetext!=''){
document.getElementById("quotablebox").innerHTML=responsetext;
}
return true;
}

//======================================
function GetQuote(k, d){
url=baseURL+'/wp-content/quote.php?k='+k+'&d='+d;
ajax.get(url,QuoteDisplay);
return true;
}


//======================================
function ArchiveDisplay(responsetext){
if(responsetext!=null && responsetext!=''){
document.getElementById("archivedata").innerHTML=responsetext;
}
return true;
}

//======================================
function GetArchive(k, d){
url=baseURL+'/wp-content/ajax.php?k='+k+'&d='+d;
ajax.get(url,ArchiveDisplay);
document.getElementById("archivedata").innerHTML=document.getElementById("archivedata").innerHTML+'<center><br /><img src="'+baseURL+'/wp-content/loading.gif" width="32" height="32" align="top" vspace="2" /><br />Loading...</center>';
return true;
}