﻿// JScript File

function Showpopup(hoveritem,Popup,cid,tid,classname)
{
document.getElementById('ctl00_Cnt_hdntopic').value=tid;
document.getElementById('ctl00_Cnt_hdncat').value=cid;
hp = document.getElementById(Popup);
hp.style.top = hoveritem.offsetTop+ -70 +"px";
hp.style.left = hoveritem.offsetLeft + 200 +"px";
hp.className = classname;
hp.style.display = "inline";
}
function Hidepopup(Popup)
{
hp = document.getElementById(Popup);
hp.style.display = "none";
}

function redirect(cityid)
{
var tid=document.getElementById('ctl00_Cnt_hdntopic').value;
var cid=document.getElementById('ctl00_Cnt_hdncat').value;
window.location="set_city.aspx?cityid="+cityid+"&tid="+tid+"&cid="+cid;
}
///for loading recent forums onload
function getRecentForums(){
updateForum("new1");
}
addLoadEvent(getRecentForums);
// or like this:
addLoadEvent(function() {
/* more code to run on page load */
});
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}
function changeTab(source)
{
document.getElementById("new1").className="tab";
document.getElementById("new2").className="tab";
document.getElementById("new3").className="tab";
source.className="tab_active";            
updateForum(source.id);      
}
function updateForum(type)
{ 
document.getElementById("load").style.display="block";
var randomnumber=Math.random()*11;   
var url="ProcessAjax.aspx?type="+type+"&rand="+randomnumber;         
callServer(url,updatepg)
}
function updatepg()
{
if (request.readyState == 4) 
{             
var response =request.responseText;
document.getElementById("divForum").innerHTML=response;
document.getElementById("load").style.display="none";
}
}
///for paging
function updateForumPaging(pageType,pageNumber)
{ 
document.getElementById("load").style.display="block";
var randomnumber=Math.random()*11;   
var url="ProcessAjax.aspx?type="+pageType+"&rand="+randomnumber+"&pageCount="+pageNumber;         
callServer(url,updatepg)
}
        