var responsecont;
var xmlHttp;
var requestType;
var newsstring;

function ContentTabNews(tagtd)
{
    if(getObject(tagtd).className=="bbif1")
    {
        getObject(tagtd).className="bbif";
        if(tagtd=="newbaby")
        {
            getObject("hotbaby").className="bbif1";
            try
            {			
               ContentgetTopGroupInfo(tagtd);
            }
            catch(e)
            {
               alert(e);
            }  	
        }
        if(tagtd=="hotbaby")
        {
            getObject("newbaby").className="bbif1";
            try
            {			
              ContentgetTopGroupInfo(tagtd);
            }
            catch(e)
            {
               alert(e);
            }
        }
 
   }
    
            
}
function TabNews(tagtd)
{
 if(getObject(tagtd).className=="right_boxtop2over")
    {
        getObject(tagtd).className="right_boxtop1";
        if(tagtd=="newbaby")
        {
            getObject("hotbaby").className="right_boxtop2";
            try
            {			
                getTopGroupInfo(tagtd);
            }
            catch(e)
            {
               alert(e);
            }  	
        }
        if(tagtd=="hotbaby")
        {
            getObject("newbaby").className="right_boxtop2";
            try
            {			
                getTopGroupInfo(tagtd);                
            }
            catch(e)
            {
               alert(e);
            }
        }
 }
       
}
function getTopGroupInfo(types){
   var url ;
   var loadstatustext="<div >Loading request content, please wait...</div>";
   requestType="aadd";
   if(types=='hotbaby')
        url='hotbabylist.aspx';
   else
        url='newbabylist.aspx';
   CreateXMLHttpRequest();   
   
  // getObject(requestType).innerHTML = loadstatustext;
   xmlHttp.onreadystatechange = processRequestChange;
   xmlHttp.open("GET", url, true);
   xmlHttp.setRequestHeader("If-Modified-Since","0");
   xmlHttp.send(null);  
 

}

function ContentgetTopGroupInfo(types){
   var url ;
   var loadstatustext="<div >Loading request content, please wait...</div>";
   requestType="aadd";
   if(types=='hotbaby')
        url='../hotbabylist.aspx?Level=2';
   else
        url='../newbabylist.aspx?Level=2';
   CreateXMLHttpRequest();   
   
  // getObject(requestType).innerHTML = loadstatustext;
   xmlHttp.onreadystatechange = processRequestChange;
   xmlHttp.open("GET", url, true);
   xmlHttp.setRequestHeader("If-Modified-Since","0");
   xmlHttp.send(null);  
 

}

function RefreshImg(types){
   var url ;
   var loadstatustext="<div >Loading request content, please wait...</div>";
   requestType="flashimgs";
   url='../babyhome/BabyPhotosXML.aspx';
   CreateXMLHttpRequest();   
   
  // getObject(requestType).innerHTML = loadstatustext;
   xmlHttp.onreadystatechange = processRequestChange;
   xmlHttp.open("GET", url, true);
   xmlHttp.setRequestHeader("If-Modified-Since","0");
   xmlHttp.send(null); 

}

function CreateXMLHttpRequest(){
   // Initialize Mozilla XMLHttpRequest object
   if (window.XMLHttpRequest){
       xmlHttp = new XMLHttpRequest();
   } 
   // Initialize for IE/Windows ActiveX version
   else if (window.ActiveXObject) {
       try{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP.3.0");
	   } 
       catch (e){
			try{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){newsstring = "<div class='loading'>Loading rquest content fail, Please try it again latter...</div>";}
       }
   }
}
function processRequestChange(){
   // only if xmlHttp shows "complete"
   if (xmlHttp.readyState == 4){
      // only http 200 to process
      if (window.location.href.indexOf("http")==-1 || xmlHttp.status == 200){
         newsstring = xmlHttp.responseText;
       //inject centent to tab-pane
       shownews(requestType,newsstring);
      }
   }
}
function shownews(requestType,newsstring){

    newsstring=DelForm(newsstring);
//    alert(requestType);
 //  alert(newsstring);
    responsecont = getObject(requestType);
   // alert(responsecont.className);
    responsecont.innerHTML =newsstring;

}
function getObject(objectId) {
     if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	   return document.getElementById(objectId);
     } 
     else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	   return document.all(objectId);
     } 
     else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	   return document.layers[objectId];
     } 
     else {
	   return false;
    }
}

function mout(obj)
{
    if(obj!=null)
    {
        //alert(obj.className);
       if(obj.className=='right_boxtop1over')
            {
            obj.className='right_boxtop1'; 
            }
        if(obj.className=='right_boxtop2over')
            {
            obj.className='right_boxtop2';              
            }
    }

}
function mover(obj)
{
    if(obj!=null)
    {
      //  alert(obj.id);
        if(obj.className=='right_boxtop1')          
           {
           obj.className='right_boxtop1over';        
           }
        else
            obj.className='right_boxtop2over';            
        
    }

}
function VoteDig(pid)
    {       
        var PostData = "do=vote" +"&resID="+pid+"&kind=albumvote";
	PostRequest(window.location.protocol + "//" + window.location.host + "/ajax.aspx", PostData); 
    }
function VoteCount(pid)
    {
     gid('item_'+pid).innerText=parseInt(gid('item_'+pid).innerText)+1;
    }