var KL ={ };

KL.GetThumbnail =function(imgpath){
    var auc = new Array();
    auc["imgpath"]=imgpath;
    new Ajax().Post("../ajax/thumbnail.ashx",auc,callback);
    function callback(s){
        $("titleimg").src=s;
    }
}

KL.DeleteAttachment =function(Value,aidlist){
	if(DeleteAttach())
	{
		var auc = new Array();
		auc["aid"]= Value;
		new Ajax().Post("../ajax/attachmentdel.ashx",auc,callback);
		function callback(s){
			if(s=="True"){
			  window.location='attachmentgrip.aspx?aidlist='+aidlist;
			}
			else
			{
				alert("删除附件失败！");
			}
		}
	}
}

//删除
function Delete(){ return confirm('您确认要删除吗？'); }

//删除附件
function DeleteAttach(){ return confirm('您确认要删除此附件吗？'); }

// 输出FLASH
function WriteFlash(url,width,height){
    document.write('<object id="MyFlash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + width + '" height="' + height + '">');
    document.write('<param name="movie" value="' + url + '">');
    document.write('<param name="wmode" value="opaque">');
    document.write('<param name="menu" value="false">');
    document.write('<param name="quality" value="high">');
    document.write('<embed src="' + url + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"></embed>');
    document.write('</object>');
}

// 获取对象
function $(objName){
    return document.getElementById(objName);
}

/*  Request对象 */
var Request = {
    Url : null  ,
    // 获取url对象，不区分大小写
    QueryString : function(key,string){   
        var url;
        if(this.Url == null) 
            url = location.href;
        else
            url = this.Url;
        if(string!=null)
            url = string;
        url = url.indexOf('?') == -1 ? url : url.substring(url.indexOf('?') + 1);
        var q = url.split('&');
        for(i=0; i<q.length; i++){
            var s = q[i].split("=");
            if(s.length == 2){
                if(s[1].substring(s[1].length-1) == "#")
                     s[1] = s[1].substring(0,s[1].length-1);
                if(s[0].toLowerCase() == key.toLowerCase()) return s[1];
            }
        }
        return "";
    }   ,
    Host : function(){
        var url = location.href.toLowerCase().replace("http://","");
        return url.indexOf("/") == -1 ? url : url.substring(0, url.indexOf("/"));
    }
}

/*  Cookie  */
var Cookie = {
    GetValue : function(name){
        var value = null;
        var cookie = document.cookie; 
        var cookies = cookie.split(";");
        for(var i=0; i<cookies.length; i++){
            var cookieName = cookies[i].substring(0,cookies[i].indexOf("="));
            if(cookieName.Trim() == name){
               value =  cookies[i].substring(cookies[i].indexOf("=") + 1);
            }
        }
        return value;
    }   ,
    
    SetValue : function(name,value,expires){

        document.cookie = name + "=" + escape (value) + (expires == null || expires == undefined ? "" : "; expires=" + expires.toGMTString())
    }   
}


