	
	
	/*转义字符函数   & < >  / */
	function escapeHTML(html)
	{	
		html = html.replace(/&/g,'&amp;').replace(/>/g,'&gt;').replace(/</g,'&lt;').replace(/"/g,'&quot;');
		return html ;
	}
	
	
	
	//格式化日期
	function formatDate(v,pattern){  
		if(v instanceof Date){
			var y = v.getFullYear();  
			var m = v.getMonth() + 1;  
			var d = v.getDate();  
			var h = v.getHours();  
			var i = v.getMinutes();  
			var s = v.getSeconds(); 
			var ms = v.getMilliseconds();     
			if(h>0 || i>0 || s>0) 
			if(m<10) m = '0' + m;
			if(d<10) d = '0' + d;
			if(h<10) h = '0' + h;
			if(i<10) i = '0' + i;
			if(s<10) s = '0' + s;
			return y + '-' + m + '-' + d + ' ' + h + ':' + i;  
		
		}
		return '';  
	}  
	
	//加入收藏夹
	function AddFavorite(sURL, sTitle)
    {
        try
        {
            window.external.addFavorite(sURL, sTitle);
        }
        catch (e)
        {
            try
            {
                window.sidebar.addPanel(sTitle, sURL, "");
            }
            catch (e)
            {
                alert("加入收藏失败，请使用Ctrl+D进行添加");
            }
        }
    }
    
	 //等比例缩放图片
	   function DrawImage(ImgD,FitWidth,FitHeight){
	     var image=new Image();
	     image.src=ImgD.src;
	     if(image.width>0 && image.height>0){
	         if(image.width/image.height>= FitWidth/FitHeight){
	             if(image.width>FitWidth){
	                 ImgD.width=FitWidth;
	                 ImgD.height=(image.height*FitWidth)/image.width;
	             }else{
	                 ImgD.width=image.width; 
	                ImgD.height=image.height;
	             }
	         } else{
	             if(image.height>FitHeight){
	                 ImgD.height=FitHeight;
	                 ImgD.width=(image.width*FitHeight)/image.height;
	             }else{
	                 ImgD.width=image.width; 
	                ImgD.height=image.height;
	             } 
	        }
	     }
	 }
	    
    
    //获得Cookie的值
    function getCookie(sName)   
	{     
	    var aCookie = document.cookie.split("; "); 
	    for (var i=0; i < aCookie.length;i++)   
	    {      
	        var aCrumb = aCookie[i].split("="); 
	
	        if (sName == aCrumb[0])     
	        	return unescape(aCrumb[1]);   
	    }       
	    return null;  
	}
	
	function login() {
		var href = window.location.href;
		href = href.substring(0,href.lastIndexOf(".action"));
		var hostPos = href.lastIndexOf("/");
		var target = window.location.href.substring(hostPos);
		href = href.substring(0,hostPos) + "/member_login.action?targetURL=" + target;
		window.location.href = href;
	}
	
	//提示信息
   function showMessage(string,time)
	{
		$("body").append('<div id="msgTiny" style="display: none; width: 300px;"> '+
							'<label id="msgShow"></label>'+
							'</div>'
		);
		$("#msgShow").html(string);
		 var dialogOption = {
                        title: "操作提示",
                        delay: time,
                        modal: false,
						position: "center"
                    };
                    
                    $("#msgTiny").FFDialog(dialogOption);
                    
	}
	//提示信息需要关闭
	function showMessageConfirm(string)
	{
		$("body").append('<div id="msgConfirm" style="display: none; width: 300px;"> '+
							'<label id="msgShowString"></label>'+
							'</div>'
		);
		$("#msgShowString").html(string);
		 var dialogOption = {
                        title: "操作提示",
                        delay: -1,
                        modal: true,
						position: "center",
						buttons: {
	                        confirm: {
	                            show: true,
	                            text: "确定",
								preventDefault: false,
	                            callback: function(){
									$("#msgConfirm").FFDialog("destory");
	                            }
	                        }
	                    }
                    };
                    $("#msgConfirm").FFDialog(dialogOption);
                    
	}
	
	
