window.onload = function(){
	try{new SUPONLINE().list()}catch(e){}
	loadBanner();
	loadMenu();
	loadAllCom(null);
	new Specialty().load();
	new NEWSHOME().getNews(0);
	new NEWSHOME().getNews(1);	
	loadAllRolo();
	getCurDate();
	try{new CATEGORYUSER().list();}catch(e){}
	try {loadHomeConfig();}catch(e){}
	try {new RATING().list()}catch(e){}
}
var $H_PIC="";
var $H_DESC="";
var $CURDESC="";
HOME=function(){}
HOME.prototype.load=function(){
	var fncSuc = XHR.Delegate(this,this.loadSuc);
	var param = {act:"getHome"};
	new XHR("post",fncSuc).send($PN+"/DoSubAdmin",param);
}
HOME.prototype.loadSuc=function(r){
	var xml = new XML(r);
	if(xml.value){
		var h = xml.get("home")[0];
		$("title_home").innerHTML = "<span id='title_"+h.getAttribute("id")+"'></span>";
		$H_DESC = h.getAttribute("description")
		$("h_description").innerHTML = $H_DESC;
		$H_PIC = h.getAttribute("picture")
		$("h_img").innerHTML = "<img src='"+$LIB_PATH+$H_PIC+"'/>";
		$("title_"+h.getAttribute("id")).innerHTML = h.getAttribute("title")

	}else{
		
	}
}
HOME.prototype.updatePicture=function(picture,type){
	var fncSuc = XHR.Delegate(this,this.updatePictureSuc);
	var param = {act:"updateHomePic",picture:picture,type:type};
	new XHR("post",fncSuc).send($PN+"/DoSubAdmin",param);
}
HOME.prototype.updatePictureSuc=function(r){
	var xml = new XML(r);
	if(xml.value){
		var h = xml.get("home")[0];
		$("h_img").innerHTML = "<img src='"+h.getAttribute("picture")+"'/>";
	}
}
HOME.prototype.updateDesc=function(description){
	var fncSuc = XHR.Delegate(this,this.updateDescSuc);
	var param = {act:"updateHomeDesc",description:description};
	new XHR("post",fncSuc).send($PN+"/DoSubAdmin",param);
	this.desc = description;
}
HOME.prototype.updateDescSuc=function(r){
	var xml = new XML(r);
	updateRTEDone();
	if(xml.value){
		var h = xml.get("home")[0];
		$H_DESC = this.desc;
		$("h_description").innerHTML = $H_DESC;
		
	}
}

