﻿/******************************************************************************
* filename: Common.js
* Common Modul Scripting(Basic, Utilities)
* (C) MasterLi(masterlijf#hotmail.com),Oran Day(likecode#qq.com)
* (C) NSW(http://www.nsw88.com)
*******************************************************************************/
//模板保存
function TempleteSave() {
    //读取所有的模板层
    $("div[title=Templete]").each(function(i) {
    //循环把div替换成相对应的控件
        var ID = $(this).attr("id");
        var SID = $(this).attr("SID");
        alert(SID);
        //$(this).replaceWith("<" + ID + ":" + ID + " ID='" + ID + i + "' runat='server' SID='" + SID + "' />");
    });
      //异步生成新的首页，同时把新首页的代码保存到xml文件中
//    var Content = document.body.innerHTML;
//    $.post("/ajax.ashx?action=templateSave&t=" + Math.random(), {
//        Content: Content
//    }, function(msg) {
//        alert(gav(msg, "msg"))
//    });
}

//设置数据源
function TemplateSet(src) {
    var SID = $(src).parent().parent().parent().attr("SID")
    alert(SID);
    var ID = $(src).parent().parent().parent().attr("id")
    if (SID == undefined) {
        SID = "0001,0002,0007";
        //如果没有这个属性的时候，给这个层添加属性
        $(src).parent().parent().parent().attr("SID", SID);
       // alert($(src).parent().parent().parent().attr("SID"));
        
    }    
}
