var objAjax=new JAjax();
var modelClass=new Object();
modelClass.readModelLst=function(){
	var out=objAjax.getText("post","./mangerRun.aspx?type=readModel&t="+create_id(),null,null);
	if(out.indexOf(c1)>-1)
	{
		var spOut=out.split(c1);
		var tab=$("tab");
		if(!tab){
			var cretab=document.createElement("table");
			cretab.setAttribute("id",tab);
			cretab.setAttribute("border","0");
			cretab.setAttribute("cellPadding","0");
			cretab.setAttribute("cellSpacing","0");
			cretab.style.cssText="width:100%;";
			tab=document.body.appendChild(cretab);
		}
		//添加数据
		var rowindex=0;
		var tr=null;
		for(var j=0;j<spOut.length-1;j++){	
		    if(j==0){
				tr=tab.insertRow(rowindex);
			}
			if(j>0&&j%4==0){
				rowindex+=1;
				tr=tab.insertRow(rowindex);
			}
			var td=tr.insertCell(0);
			var createDiv=document.createElement("div");//添加最外部div开始
			createDiv.className="bigDiv";	
			td.style.cssText="text-align:center;";
			var bigDiv=td.appendChild(createDiv);//添加最外部div结束			
			createDiv=document.createElement("div");//第一层div开始
			createDiv.className="overStyle_1";
			createDiv.onmouseover=function(){
				this.className="overStyle";	
			}
			createDiv.onmouseout=function(){
				this.className="overStyle_1";	
			}
			var mainDiv=bigDiv.appendChild(createDiv);//第一层div结素
			
			var imgDiv=document.createElement("div");//图象开始
			imgDiv.style.cssText="width:185px;height:200px;overflow:hidden;border:solid 1px #cccccc";
			var imgAppDiv=mainDiv.appendChild(imgDiv);
			var img=document.createElement("img");
			img.setAttribute("src","../class/"+spOut[j]+"/home.jpg");
			img.title=spOut[j];
			img.onload=function(){
				setImgWH(this);
			}
			imgAppDiv.appendChild(img);	//图象结素
			
			imgDiv=document.createElement("div");//说明开始
			imgDiv.style.cssText='text-align:center;font-size:12px;width:100%;height:20px;padding-top:6px;'
			var createNoteTxt=document.createTextNode(spOut[j]);
			imgDiv.appendChild(createNoteTxt);
			imgDiv.title=spOut[j];
			mainDiv.appendChild(imgDiv);//说明结束
			
			var saveDiv=document.createElement("div");//创建操作开始
			saveDiv.style.cssText="text-align:center;padding-left:30px;padding-top:2px;padding-bottom:5px;";
			var saveDivCre=mainDiv.appendChild(saveDiv);
			
			saveDiv=document.createElement("div");
			saveDiv.className="btnClass";
			saveDiv.title="预览";
			saveDiv.model=spOut[j];
			createNoteTxt=document.createTextNode("预览");
			saveDiv.appendChild(createNoteTxt);
			saveDiv.onclick=function(){
			    parent.window.open("../../child/class/"+this.model+"/Default.aspx?childRootid="+menuid,"预览","fullscreen=1,channelmode=1,toolbar=1,location=1,directories =1,status=1,menubar=1,scrollbars,resizable=1,width=700px,height=600px,top=100px;left=100px");
				//alert("预览处理程序");	
			}
			saveDivCre.appendChild(saveDiv);
			
			saveDiv=document.createElement("div");
			saveDiv.style.cssText="width:10px;float:left;";
			saveDivCre.appendChild(saveDiv);			
			
			saveDiv=document.createElement("div");
			saveDiv.className="btnClass";
			saveDiv.title="应用";
			createNoteTxt=document.createTextNode("应用");
			saveDiv.appendChild(createNoteTxt);
			saveDiv.model=spOut[j];
			saveDiv.onclick=function(){
				var objResponse=new JHttpResponse();
				objResponse.write("menuid",menuid);
				objResponse.write("model",this.model);
			    var out=objAjax.getText("post","./mangerRun.aspx?type=useModel&t="+create_id(),objResponse,null);
				if(out=="ok"){
					alert("应用成功");
				}else{
					alert(out);	
				}
				//alert("创建处理程序");	
			}			
			saveDivCre.appendChild(saveDiv);	
		}
		var index=j%4;
		//添加空位
		for(var i=index;i<4;i++){
			var td=tr.insertCell(index);//添加一个单元格			
			var createDiv=document.createElement("div");//添加最外部div开始
			createDiv.className="bigDiv";	
			td.style.cssText="text-align:center;";
			var bigDiv=td.appendChild(createDiv);//添加最外部div结束			
			createDiv=document.createElement("div");//第一层div开始
			createDiv.className="overStyle_1";
			createDiv.onmouseover=function(){
				this.className="overStyle";	
			}
			createDiv.onmouseout=function(){
				this.className="overStyle_1";	
			}
			var mainDiv=bigDiv.appendChild(createDiv);//第一层div结素
			
			var imgDiv=document.createElement("div");//图象开始
			imgDiv.style.cssText="width:190px;height:230px;overflow:hidden;";
			var imgAppDiv=mainDiv.appendChild(imgDiv);
			var img=document.createElement("img");
			img.title="等待中....";
			img.setAttribute("src","./img/run.gif");
			img.onload=function(){
				setImgWH(this);
			}
			imgAppDiv.appendChild(img);	//图象结素			
			imgDiv=document.createElement("div");//文本
			imgDiv.style.cssText="text-align:center;padding-left:30px;padding-top:2px;padding-bottom:5px; font-size:12px;color:red;";
			var createNoteTxt=document.createTextNode("等待发布中...");
			imgDiv.appendChild(createNoteTxt);
			createDiv.appendChild(imgDiv);
		}
	}else{
		alert(out);
	}
}
