var SiteMap = {};

SiteMap.ExpandSiteMap = function(obj, sContainerName, nSectionID){
    //alert(obj.src);
    //if()
    if(obj.src.match("2.gif")){
        obj.src = obj.src.replace("2.gif", ".gif");
    }else{
        obj.src = obj.src.replace(".gif", "2.gif");
    }
    var oContainer =  document.getElementById(sContainerName);
    if(oContainer.style.display == ''){
        oContainer.style.display = 'none';
    }else{
        oContainer.style.display = '';
    }
    
    if( oContainer.innerHTML != '' ){
        return false;
    }
    
//    var oLoading = new LoadingImage(oContainer);
//    oLoading.Style = "text-align: center; margin: 0px;";
//    oLoading.Render();
    oContainer.innerHTML = 'loading...';
    
    var HttpRequest = new CHttpRequest();
	
	HttpRequest.QueryString = "AjaxType=HTML&RequestFile=UI.SiteMap&MethodName=XRender";
	HttpRequest.AssyncCall = true;
	HttpRequest.AddProperty("Arguments[SectionID]", nSectionID);
	
    HttpRequest.Additional = sContainerName;
	HttpRequest.onReturn = "SiteMap.ExpandSiteMap_CallBack";
    
	var Response = HttpRequest.Send();
}

SiteMap.ExpandSiteMap_CallBack = function(httpRequest, AdditionalData){
	document.getElementById(AdditionalData).innerHTML = httpRequest.responseText;
}
