﻿var curSection = "";
var curChar = "";

function getByS(bysection)
{
	var reqUrl = "ajax/TogoBuilding.aspx?fuc=getbys&page=1&t="+new Date();
	if (null != bysection && 0 != bysection) 
	{
		reqUrl += "&s=" + bysection;
	}
	
    for(i=1;i<=6;i++)
    {
        var menu=document.getElementById("one"+i);
        menu.className=i==bysection?"hover":"";
    }
    
    document.getElementById("curSection").value = bysection;
    
	Ajax.doGet(reqUrl,null,SetBuild,true,false);
}

function SetBuild(responseStr)
{   
	var objDiv=document.getElementById("div_section");
	if (responseStr!="")
	{
		objDiv.innerHTML=responseStr;
		if(curChar==null)
		{
			curChar = null;
		}
		else
		{
			//document.getElementById(curChar).className = "lpnow";
		}		
	}
	else
	{
	    objDiv.style.display="none";
	}
}

function getByC(bychar)
{
    var reqUrl = "ajax/TogoBuilding.aspx?fuc=getbyl&page=1&t="+new Date();
	if (null != document.getElementById("curSection").value && 0 != document.getElementById("curSection").value) 
	{
		reqUrl += "&s=" + document.getElementById("curSection").value;
	}
	if (null != bychar) 
	{
		reqUrl += "&c=" + bychar;
		curChar = bychar;
	}
	else
	{
		bychar = null;
	}
	
    
	Ajax.doGet(reqUrl,null,SetBuild,true,false);
}

function getBySUH(bysection)
{
	var reqUrl = "ajax/TogoBuilding.aspx?fuc=getbys_uh&page=1&t="+new Date();
	if (null != bysection && 0 != bysection) 
	{
		reqUrl += "&s=" + bysection;
	}
	
    for(i=1;i<=6;i++)
    {
        var menu=document.getElementById("one"+i);
        menu.className=i==bysection?"hover":"";
    }
    
    document.getElementById("curSection").value = bysection;
    
	Ajax.doGet(reqUrl,null,SetBuild,true,false);
}

function getByCUH(bychar)
{
    var reqUrl = "ajax/TogoBuilding.aspx?fuc=getbyl_uh&page=1&t="+new Date();
	if (null != document.getElementById("curSection").value && 0 != document.getElementById("curSection").value) 
	{
		reqUrl += "&s=" + document.getElementById("curSection").value;
	}
	if (null != bychar) 
	{
		reqUrl += "&c=" + bychar;
		curChar = bychar;
	}
	else
	{
		bychar = null;
	}
    
	Ajax.doGet(reqUrl,null,SetBuild,true,false);
}

function getBySS(bysection)
{
	var reqUrl = "ajax/TogoBuilding.aspx?fuc=getbyss&page=1&t="+new Date();
	if (null != bysection && 0 != bysection) 
	{
		reqUrl += "&s=" + bysection;
	}
	
    for(i=1;i<=6;i++)
    {
        var menu=document.getElementById("one"+i);
        menu.className=i==bysection?"hover":"";
    }
    
    document.getElementById("curSection").value = bysection;
    
	Ajax.doGet(reqUrl,null,SetBuild,true,false);
}

///用户中心
function showpage(pages , bysection )
{   
    var reqUrl = "ajax/TogoBuilding.aspx?fuc=getbys_uh&page="+ pages +"&t="+new Date();
	if (null != bysection && 0 != bysection) 
	{
		reqUrl += "&s=" + bysection;
	}
	
    for(i=1;i<=6;i++)
    {
        var menu=document.getElementById("one"+i);
        menu.className=i==bysection?"hover":"";
    }
    
    document.getElementById("curSection").value = bysection;
    
	Ajax.doGet(reqUrl,null,SetBuild,true,false);
}

function pre(section)
{
    var oldpage = parseInt( jQuery("#myfocus").html());
    if (oldpage == 1)
    {
        return;
    }
    else
    {
        var newpage = parseInt( oldpage - 1)+"";
        showpage(newpage , section);
    }
}

function next(section , total)
{
    var oldpage = parseInt( jQuery("#myfocus").html());
    var t = parseInt( total);
    if (oldpage >= t)
    {
        return;
    }
    else
    {
        var newpage = parseInt(oldpage + 1)+"";
        showpage(newpage , section);
    }
}

function first(section)
{
    showpage(1 , section);
}

function last(section , total)
{
    showpage( parseInt(  total) ,section); 
}

//首页 ,选择建筑物
function showpageP(pages , bysection )
{   
    var reqUrl = "ajax/TogoBuilding.aspx?fuc=getbys&page="+ pages +"&t="+new Date();
	if (null != bysection && 0 != bysection) 
	{
		reqUrl += "&s=" + bysection;
	}
	
    for(i=1;i<=6;i++)
    {
        var menu=document.getElementById("one"+i);
        menu.className=i==bysection?"hover":"";
    }
    
    document.getElementById("curSection").value = bysection;
    
	Ajax.doGet(reqUrl,null,SetBuild,true,false);
}

function preP(section)
{
    var oldpage = parseInt( jQuery("#myfocus").html());
    if (oldpage == 1)
    {
        return;
    }
    else
    {
        var newpage = parseInt( oldpage - 1)+"";
        showpageP(newpage , section);
    }
}

function nextP(section , total)
{
    var oldpage = parseInt( jQuery("#myfocus").html());
    var t = parseInt( total);
    if (oldpage >= t)
    {
        return;
    }
    else
    {
        var newpage = parseInt(oldpage + 1)+"";
        showpageP(newpage , section);
    }
}

function firstP(section)
{
    showpageP(1 , section);
}

function lastP(section , total)
{
    showpageP( parseInt(  total) ,section); 
}

function sethand(ele)
{
    jQuery("#"+ele).css("cursor","red"); 
}


