﻿/*
 @Ajax类，主要目的是完成前台和后台页的交互
 @作者: samfeng
 @日期: 2008-06-06 09:59:02.983
*/

//Ajax的基类
var BaseAjax = new Class({
    /// <summary>
    /// 初始化类，并且对一些变量赋值
    /// </summary>
    /// <param name="_showID">要加载的DIV的ID</param>
	/// <param name="_funID">栏目ID</param>
	initialize: function(_showID, _funID){
		this.showID = _showID; 
		this.topNumber = -1; //显示条数, -1表示没有限制
		this.funID = _funID;         //栏目ID
		this.async = true;           //是否同步
		this.method = 'get';        //Ajax发送方法
		/*
		 * 加载进度图片采用那种方式
		 * small  用小图片的方式
		 * big    用大图片的方式
		 * custom 用自定义方式
		 */
		this.loadingMethod = 'small';
		this.requestUrl = "../ServerAspx/magServer.aspx";
		this.data = "maMethod="+escape(this.showID)+"&funID="+escape(this.funID)+"&topNumber="+escape(this.topNumber);	
		this.loadHtmlCode = '';
		this.xsltPath = '';	  //xslt文件的路径
	},
	
	getBaseData: function(){
	   this.data = "maMethod="+escape(this.showID)+"&funID="+escape(this.funID)+"&topNumber="+escape(this.topNumber)+"";
	},	
	

    /// <summary>
    /// 加载进度样式
    /// </summary>
	loadding: function(){
		switch(this.loadingMethod){
			case "small":
			   $(this.showID).empty().addClass('ajax-small-loading');
			   break;
		    case "big":
			   $(this.showID).empty().addClass('ajax-big-loading');
			   break;			   
		}		
		$(this.showID).setHTML(this.loadHtmlCode);
	},
	

    /// <summary>
    /// 清除进度样式
    /// </summary>	
	unloaded: function(){
		switch(this.loadingMethod){
			case "small":
			   $(this.showID).removeClass('ajax-small-loading');
			   $(this.showID).setHTML("");
			   break;
		    case "big":
			   $(this.showID).removeClass('ajax-big-loading');
			   break;			   
		}	
	},
	
    setNaviULVisibility: function(){ 
        if( typeof(mlddminit) == 'function'){
	        mlddminit();
	     }
    }
}
  
);

//Ajax的普通扩展类，主要是用来处理返回值是xml的数据
var CommReXmlAjax = BaseAjax.extend({
    initilize: function(_showID, _funID){
        this.parent(_showID, _funID);
    },
    
    /// <summary>
    /// 采用返回值为字符串的方式来进行Ajax方法交互
    /// </summary>		
	ajaxExecMethod: function(){
	　　this.requestUrl　+= "?"+this.data;
	　　this.loadding();    
	    var myAjax = new Ajax( this.requestUrl, {
	                                           method: this.method,
	                                           async:this.async,
											   onComplete: this.CallBack_Response.curry(this)
											   }
						 );
		myAjax.request();
		
	},
	
    /// <summary>
    /// 处理xml返回数据的回调函数
    /// </summary>		
	/// <param name="_funID">栏目ID</param>
	/// <param name="_xsltPath">xslt路径</param>	
	CallBack_Response: function(value,requestText,requestXML){
		try{
		//这里调用了../../Js/ui/xsltAndXml/XsltAndXml.js中的XsltAndXml类
		var xsltConvert = new XsltAndXml(value.showID, requestText, value.xsltPath);
		xsltConvert.XslConvertXmlToHtml();
		value.unloaded();
		value.setNaviULVisibility();
		} catch(e) {
			alert('数据处理失败!');
		}
	}
 });    
    
//Ajax的普通扩展类，主要是用来处理返回值是text的数据
var CommReTextAjax = BaseAjax.extend({
    initilize: function(_showID, _funID){
        this.parent(_showID, _funID);
    },
    
    /// <summary>
    /// 采用返回值为字符串的方式来进行Ajax方法交互
    /// </summary>		
	ajaxExecMethod: function(){
	　　this.requestUrl　+= "?"+this.data;
	　　this.loadding();    
	    var myAjax = new Ajax( this.requestUrl, {
	                                           method: this.method,
	                                           async:this.async,
											   onComplete: this.CallBack_Response.curry(this)
											   }
						 );
		myAjax.request();
		
	},
	
	CallBack_Response: function(value,requestText,requestXML){
		try{
			value.unloaded();	
			switch(value.showID){
			 case "testTxtUserName":
			    var reArray = requestText.split('|+|');
			    $(value.showID).setHTML(reArray[1]);
    		    ifEnableUser = (reArray[0] == "1");
			   break;
			 case "testTxtCertCode":
			    var reArray = requestText.split('|+|');
			    $(value.showID).setHTML(reArray[1]);
    		    ifEnableWriter = (reArray[0] == "0");
			   break;			   
			 case "maga_detail_json_info":
			     var jsonObject = Json.evaluate(requestText,"");
	     	     JsonTransact( jsonObject, value.showID );
			   break;
			 default:
	     	    $(value.showID).setHTML(requestText);
	     	    value.setNaviULVisibility();
   	           //如果DIV中有类名为cssTitle的元素，那么收缩到指定长度
   	           GetLengthString( value.showID, 'cssTitle', titleLength,'…' );
   	           //如果DIV中有类名为cssType的元素，那么收缩到指定长度
   	           GetLengthString( value.showID, 'cssType', typeLength,'…' );
   	           //如果DIV中有类名为cssWriter的元素，那么收缩到指定长度
   	           GetLengthString( value.showID, 'cssWriter', writeLength,'…' );
   	            var Tips3 = new Tips($$('#'+value.showID+' .cssTips'), {
                    showDelay: 400,
                    hideDelay: 400,
                    fixed: true
                    });  	     	
              break;
          }
		} catch(e) {
			alert('数据处理失败!');
		}
	}
 });
 
 
 //json处理类
var CommReJsonAjax = BaseAjax.extend({
    initilize: function(_showID, _funID){
        this.parent(_showID, _funID);
    },
    
    /// <summary>
    /// 采用返回值为字符串的方式来进行Ajax方法交互
    /// </summary>		
	ajaxExecMethod: function(){
	　　this.requestUrl　+= "?"+this.data;
	　　this.loadding();    
	    var myAjax = new Ajax( this.requestUrl, {
	                                           method: this.method,
	                                           async:this.async,
											   onComplete:this.CallBack_Response.curry(this)
											   });
		myAjax.request();
		
	},
	
	CallBack_Response: function(value,requestText,requestXML){
		try{
		    var jsonObject = Json.evaluate(requestText,"");
			value.unloaded();	
	     	JsonTransact( jsonObject, value.showID );
   	           //如果DIV中有类名为cssTitle的元素，那么收缩到指定长度
   	           GetLengthString( value.showID, 'cssTitle', titleLength,'…' );
   	           //如果DIV中有类名为cssType的元素，那么收缩到指定长度
   	           GetLengthString( value.showID, 'cssType', typeLength,'…' );
   	           //如果DIV中有类名为cssWriter的元素，那么收缩到指定长度
   	           GetLengthString( value.showID, 'cssWriter', writeLength,'…' );
   	            var Tips3 = new Tips($$('#'+value.showID+' .cssTips'), {
                    showDelay: 400,
                    hideDelay: 400,
                    fixed: true
                    });  	  	   	     	
		} catch(e) {
			alert('数据处理失败!');
		}
	}
 });
 
 //Ajax的更新类，主要是用来处理返回值是text的数据
var UpReTextAjax = BaseAjax.extend({
    initilize: function(_showID, _funID){
        this.parent(_showID, _funID);
        this.magaID = '';
        this.picID = '';
        this.ifLoading = false;
    },
    
    /// <summary>
    /// 采用返回值为字符串的方式来进行Ajax方法交互
    /// </summary>		
	ajaxExecMethod: function(){
	　　this.requestUrl　+= "?"+this.data;
	　　if(this.ifLoading){
	　　 this.loadding();    
	　　}
	    var myAjax = new Ajax( this.requestUrl, {
	                                           method: this.method,
	                                           async:this.async,
											   onComplete: this.CallBack_Response.curry(this)
											   }
						 );
		myAjax.request();
		
	},
	
	CallBack_Response: function(value,requestText,requestXML){
		try{
		if(this.ifLoading){
			value.unloaded();
		 }	
			switch(value.showID){
			 case "maga_Submit_Comment": 
			     //new Asset.javascript('../../js/ui/dialog/dialog_box.js', 'dialog');
			     //$('').click();
			     var resultArray = requestText.split('|+|');
			     if( resultArray[0] == "0"){
			     ErrorInfo(resultArray[1],280,150,"错误提示",null,null);
			     } else {
			      SucceedInfo(resultArray[1],280,150,null,null,null);
			      //刷新用户留言
			      $('control_user_show').setStyle('display','none');
			      refrsh(5,1, 'refrsh', 'pagination01', $H({'magaID':value.magaID}));  
			     //刷新验证码  
			      $(value.picID).click();
			     //把所有的input的值都清理掉
			     var inputs = $$('#'+value.showID+' input');
			     inputs.each(function(ip, i){
			         if(ip.type != 'hidden' && ip.type != 'submit'){
			            ip.value = '';
			         }
			      });
			      $('reviewContent').value = '';
//			      if(!(resultArray[2]==""&&resultArray[3]=="")){
//			        //如果引用了Head, 那么就要更新Head中isloginhy和LBuserOne的状态
//			        if($chk($("Head1_isloginhy"))&&$chk($("Head1_LBuserOne"))){
//			           var isloginhy = $("Head1_isloginhy");
//			           var LBuserOne = $("Head1_LBuserOne");
//			           isloginhy.setProperties({
//			                     href: 'javascript:__doPostBack(\'Head1$isloginhy\',\'\');',
//			                     onclick: 'ShowUser();LoginOut();' });
//			           isloginhy.setText('欢迎您：'+resultArray[2]+' |退出登录');
//			           LBuserOne.removeClass('hide');
//			           LBuserOne.setProperty('href','javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(\'Head1$LBuserOne\', \'\', false, \'\', \'../UserPage/Default.aspx\', false, true));');
//			           LBuserOne.setText('|个人管理');
//			        }
//			      }
			     }
			   break;
			   case "Add_New_User":
			      var reArray = requestText.split('|+|');
			      switch(reArray[0]){
			        case "0":
			           ErrorInfo(reArray[1],411,160,"错误提示",null,null);
			         break;
			        case "1":
			          //showDialog('成功',reArray[1],'success',0,411,160, true);
			           
			             if(!$chk(reArray[2])){
			                window.location="RegisterOK.aspx?ReturnUrl=";
			             } else {
			                window.location="RegisterOK.aspx?ReturnUrl="+escape(reArray[2]);
			             };
			         break;
			        case "6":
			          //showDialog('成功',reArray[1],'success',0,411,160, true);
			           
			             if(!$chk(reArray[2])){
			                window.location="RegisterWriterOK.aspx?ReturnUrl=";
			             } else {
			                window.location="RegisterWriterOK.aspx?ReturnUrl="+escape(reArray[2]);
			             };
			         break;			         
			        case "2":
			           $('txtUserName').focus();
			           $('txtUserName').blur();
			         break;
			        case "3":
			           $('txtPassword').focus();
			           $('txtPassword').blur();
			         break;
			        case "4":
			           $('txtConfirmPassword').focus();
			           $('txtConfirmPassword').blur();
			         break;     
			        case "5":
			           $('txtCert_Code').focus();
			           $('txtCert_Code').blur();
			         break; 	         			             			         
			      }
			     break;
			 default:
	         	$(value.showID).setHTML(requestText);
	          	value.setNaviULVisibility();			 
			   break;
			}
		} catch(e) {
		    ErrorInfo('数据处理失败!',411,160,"错误提示",null,null);
		}
	}
 });
 
 

 
 
 //Ajax的普通扩展类，主要是用来处理返回值是text的数据
var PaginationReTextAjax = BaseAjax.extend({
    initilize: function(_showID, _funID, _sName, _functionInfo, _pageViewDiv, _pageSize, _currentPage){
        this.parent(_showID, _funID);
        this.functionInfo = _functionInfo;
        this.pageViewDiv = _pageViewDiv;
        this.sName = _sName;
        this.pageSize = _pageSize;
        this.currentPage = _currentPage;
        this.data = "maMethod="+this.showID+"&funID="+this.funID+"&pageSize="+this.pageSize+"&currentPage="+this.currentPage;
        this.paras = null;
        this.magaID = "";
        
    },
    
    /// <summary>
    /// 采用返回值为字符串的方式来进行Ajax方法交互
    /// </summary>		
	ajaxExecMethod: function(){
	　　this.requestUrl　+= "?"+this.data;
	　　this.loadding();    
	    var myAjax = new Ajax( this.requestUrl, {
	                                           method: this.method,
	                                           async:this.async,
											   onComplete: this.CallBack_Response.curry(this)
											   }
						 );
		myAjax.request();
		
	},
	
	CallBack_Response: function(value,requestText,requestXML){
		try{
			value.unloaded();	
			var reArray = requestText.split('|+|');
	     	$(value.showID).setHTML(reArray[0]);
	     	if( reArray[1] > 0){
	        $(value.pageViewDiv).setStyle('visibility', 'visible');
	        switch(value.showID){
	          case "maga_user_guestbook":
	           var tst = $("maga_user_guestbook");
	           var pintable = $('pinluntable');
	           var pintableHeight = pintable.scrollHeight;
	           var fx = new Fx.Styles(tst, {duration:200, wait:false, transition: Fx.Transitions.linear});
	            fx.start({
		            'height': [205, pintable.getStyle('height').toInt()]
	            });	             
	           SetPage(reArray[1],value.pageSize, value.currentPage,value.sName, value.functionInfo, value.pageViewDiv, value.paras);
	            break;
	          default:
	     	    SetPage(reArray[1],value.pageSize, value.currentPage,value.sName, value.functionInfo, value.pageViewDiv, value.paras);
	     	    break;
	     	 }
	     	} else {
	        switch(value.showID){
	          case "maga_user_guestbook":
	           var tst = $("maga_user_guestbook");
	           var pintable = $('pinluntable');
	           var pintableHeight = pintable.getStyle('height').toInt();
	           new Fx.Style('maga_user_guestbook','height').set(pintableHeight-10);
	            break;
	          default:
	     	    break;
	     	 }	     	  
	     	  $(value.pageViewDiv).setStyle('visibility', 'hidden');
	     	}
   	       //如果DIV中有类名为cssTitle的元素，那么收缩到指定长度
   	       GetLengthString( value.showID, 'cssTitle', titleLength,'…' );
   	       //如果DIV中有类名为cssType的元素，那么收缩到指定长度
   	       GetLengthString( value.showID, 'cssType', typeLength,'…' );
   	       //如果DIV中有类名为cssWriter的元素，那么收缩到指定长度
   	       GetLengthString( value.showID, 'cssWriter', writeLength,'…' );	
   	    var Tips3 = new Tips($$('#'+value.showID+' .cssTips'), {
            showDelay: 400,
            hideDelay: 400,
            fixed: true
            });     	
	     	//value.setNaviULVisibility();
		} catch(e) {
			alert('数据处理失败!');
		}
	}
 });
 
// function downloadMagazine( magaID, url, isFree, FreeNum, isAddHitCount ){
//    if( isFree == 1){
//       alert("本书为收费图书，如没有购买只能免费看前"+FreeNum+"页!");
//    }
//    
//    if(isAddHitCount==1){
//      addHitCount(magaID);
//    }
//    var requestUrl = "../ServerAspx/magServer.aspx?maMethod="+encodeURIComponent("UP_DOWNCOUNT")+"&magaID="+encodeURIComponent(magaID)+"&url="+encodeURIComponent(url);	
//	var myAjax = new Ajax( requestUrl, {
//                                           method: "post",
//                                           async:false,
//									       onComplete: function(txt,xml){
//									       }
//									   }
//						 );
//	myAjax.request();    
//	//$('download').src = "../ServerAspx/download.aspx?url="+encodeURIComponent(url);	
//	window.open(url,"download");
//}
function downloadMagazine( magaID, url, isFree, FreeNum, isAddHitCount ){
    var isAlert = false;
    if( isFree == 1){
       Alert('本书为收费图书，如没有购买只能免费看前'+FreeNum+'页!',null,null,"信息提示",function(){downloadExec( magaID, url,  isAddHitCount);},null);
//       ConfirmInfo('信息确认框功能测试',null,null,null,fun1,fun2);
    } else {
       downloadExec( magaID, url, isAddHitCount );  
    }
    
}



function downloadExec(magaID, url,isAddHitCount){
    if(isAddHitCount==1){
      addHitCount(magaID);
    }
    var requestUrl = "../ServerAspx/magServer.aspx?maMethod="+encodeURIComponent("UP_DOWNCOUNT")+"&magaID="+encodeURIComponent(magaID)+"&url="+encodeURIComponent(url);	
	var myAjax = new Ajax( requestUrl, {
                                           method: "get",
                                           async:false,
									       onComplete: function(txt,xml){
									       }
									   }
						 );
	myAjax.request();    
	//$('download').src = "../ServerAspx/download.aspx?url="+encodeURIComponent(url);	
	window.open(url,"download");
};

function addHitCount( magaID ){
    var requestUrl = "../ServerAspx/magServer.aspx?maMethod="+encodeURIComponent("UP_HITCOUNT")+"&magaID="+encodeURIComponent(magaID);	
	var myAjax = new Ajax( requestUrl, {
                                           method: "post",
                                           async:false,
									       onComplete: function(txt,xml){
									       }
									   }
						 );
	myAjax.request();    
}

function Writer( userid,type ){
var requestUrl;
    if(type==1)
    {
     requestUrl = "ServerAspx/magServer.aspx?maMethod="+encodeURIComponent("WriterRequest")+"&userid="+encodeURIComponent(userid);	
     }
     else
     {
        requestUrl = "../../ServerAspx/magServer.aspx?maMethod="+encodeURIComponent("WriterRequest")+"&userid="+encodeURIComponent(userid);
     }
	var myAjax = new Ajax( requestUrl, {
                                           method: "post",
                                           async:false,
									       onComplete: function(txt,xml){
									             var result = txt;
									             switch(result){
									                case "0":
									                  alert("你的申请已发送到网站，管理员将在24小时内处理！");
									                break;
									                case "1":
									                  alert("您已经是作家！");
									                break;
									                case "2":
									                alert("您发出的申请，审核未通过，请与管理员联系！");
									                  //showDialog('消息提示','您审核未通过，请与管理员联系！','prompt',0, 411,160,true);
									                break;
									                case "3":
									                alert("您已经发出申请，正在审核中，管理员将在24小时内处理！");
									                  //showDialog('消息提示','您已经发出申请，正在审核中，等待管理员处理！','prompt',0, 411,160,true);
									                break;
									                 case "4":
									                 alert("您还没有登陆，请先登陆！");
									                  //showDialog('消息提示','您还没有登陆，请先登陆！','prompt',0, 411,160,true);
									                break;
									           }
									       }
									   }
						 );
	myAjax.request();    
	//$('download').src = "../ServerAspx/download.aspx?url="+encodeURIComponent(url);	

}

 //添加投诉信息, 加载模态窗口的方法
 function AddTS( maga_ID ){
       var plIframe ='<iframe id="plIframe" src="" style="width:640px!important;width:630px;height:260px!important;height:250px;" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>';
       showDialog('投诉',plIframe,'prompt',0, 660,300,true);
       $('plIframe').src = "../UserPage/UserMessage/Complait1.aspx?productID="+maga_ID;
       
 };
 
 
  //添加收藏信息, 加载模态窗口的方法
 function AddSC( maga_ID ){
       var scIframe = '<iframe id="scIframe" src="" style="width:540px!important;width:520px;height:230px!important;height:200px;" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"></iframe>';
       showDialog('收藏',scIframe,'prompt',0, 550,267,true);
       $('scIframe').src = "../UserPage/Favorite/MUserFavoriteAdd.aspx?magaID="+maga_ID;
       
 };
 


 function JsonTransact(jsonObject, methodType){
    switch(methodType){
      //detail.aspx页的maga_detail_info层的处理方法
      case "maga_detail_info":

      var htmlString = new StringBuilder();
      htmlString.append('<table width="98%" height="330" border="0" cellpadding="0" cellspacing="0">');
      htmlString.append('<tr>'); 
      htmlString.append('    <td width="41%" align="center" valign="top"><table width="233" height="322" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">');
      htmlString.append('        <tr>');
      htmlString.append('          <td align="center"><img src="'+jsonObject.root.Rows[0].maga_ShowPicURL+'" width="226" height="314"></td>');
      htmlString.append('        </tr>');
      htmlString.append('      </table></td>');
      htmlString.append('    <td width="1%">&nbsp;</td>');
      htmlString.append('    <td width="58%" valign="top"><table width="349" height="364" border="0" cellpadding="0" cellspacing="0">');
      htmlString.append('        <tr> ');
      htmlString.append('          <td height="20px" colspan="3"><strong><font color="#666666" style="font-size:14px;">'+jsonObject.root.Rows[0].maga_Name+'</font></strong></td>');
      htmlString.append('          <td height="20px"><font color="#FF0000"></font></td>');
      htmlString.append('        </tr>');
      htmlString.append('        <tr> ');
      htmlString.append('          <td width="83" height="30" align="center"><font color="#333333">［作　　者］</font></td>');
      htmlString.append('          <td width="97" height="30"><font color="#333333"><a class="cssWriter" style="color:#9E9E9E;" href="javascript:void(0);" onclick="javascript:GoToWriterDetail(\''+jsonObject.root.Rows[0].user_ID+'\',\''+jsonObject.root.Rows[0].user_Appellation+'\');">'+jsonObject.root.Rows[0].user_Appellation+'</a></font></td>');
      htmlString.append('          <td width="83" height="30" align="center"><font color="#333333">［所属类别］</font></td>');
      htmlString.append('          <td width="92" height="30"><font color="#333333">'+jsonObject.root.Rows[0].book_TypeName+' </font></td>');
      htmlString.append('        </tr>');
      htmlString.append('        <tr> ');
      htmlString.append('          <td width="83" height="30" align="center"><font color="#333333">［上架日期］</font></td>');
      htmlString.append('          <td width="97" height="30"><font color="#333333"> '+jsonObject.root.Rows[0].maga_PublishDate+'</font></td>');
      htmlString.append('          <td width="83" height="30" align="center"><font color="#333333">［文件大小］</font></td>');
      htmlString.append('          <td width="92" height="30"><font color="#333333">'+jsonObject.root.Rows[0].maga_Size+'</font></td>');
      htmlString.append('        </tr>');
      htmlString.append('        <tr> ');
      htmlString.append('          <td height="30" style="padding-left:4px;"><font color="#333333">［单　　价］</font></td>');
      htmlString.append('          <td height="30" height="30"><font color="#009933">'+jsonObject.root.Rows[0].maga_Price+' </font></td>');
      htmlString.append('          <td width="83" height="30" align="center"><font color="#333333">［发刊周期］</font></td>');
      htmlString.append('          <td width="92" height="30"><font color="#333333">'+jsonObject.root.Rows[0].maga_PublishCircle+' </font></td>');      
      htmlString.append('        </tr>'); 
      htmlString.append('        <tr> ');
      htmlString.append('          <td height="30" style="padding-left:4px;"><font color="#333333">［下载次数］</font></td>');
      htmlString.append('          <td height="30" height="30"><font color="#333333">'+jsonObject.root.Rows[0].maga_DownCount+' 次</font></td>');
      htmlString.append('          <td width="83" height="30" align="center"><font color="#333333">［点击次数］</font></td>');
      htmlString.append('          <td width="92" height="30"><font color="#333333">'+jsonObject.root.Rows[0].maga_HitCount+' 次</font></td>');      
      htmlString.append('        </tr>');             
      htmlString.append('        <tr> ');
      htmlString.append('          <td height="30" style="padding-left:4px;"><font color="#333333">［热门标签］</font></td>');
      htmlString.append('          <td height="30" colspan="3"><font color="#009933">'+jsonObject.root.Rows[0].maga_Tags+' </font></td>');
      htmlString.append('        </tr>');
      htmlString.append('        <tr> ');
      htmlString.append('          <td height="47" colspan="4" class="line3" style="padding-left:6px;"><font color="#666666">'+jsonObject.root.Rows[0].maga_Abbrev+'</font></td>');
      htmlString.append('        </tr>');
      htmlString.append('        <tr> ');
      htmlString.append('          <td align="left" style="height: 30px;padding-left:8px;"><a onclick="javascript:shoppingCart.addProduct(\''+jsonObject.root.Rows[0].maga_ID+'\',1,\'n\');" href="javascript:void(0);">');
      htmlString.append('          <img  style="border:0px;" src="../Images/index/gouwuche.gif" width="56" height="18"/></a></td>');            
      htmlString.append('          <td align="left" style="height: 30px;padding-left:12px;"><a onclick="javascript:downloadMagazine(\''+jsonObject.root.Rows[0].maga_ID+'\',\''+jsonObject.root.Rows[0].maga_Address+'\');" href="javascript:void(0);">');
      htmlString.append('          <img  style="border:0px;" src="../Images/index/readyonline.gif" width="56" height="18"/></a></td>');
      htmlString.append('          <td align="left" style="height: 30px;padding-left:0px;"><a onclick="javascript:AddTS(\''+jsonObject.root.Rows[0].maga_ID+'\');" href="javascript:void(0);">');
      htmlString.append('          <img  style="border:0px;" src="../Images/index/tousu.gif" width="56" height="18"/></a></td>');
      htmlString.append('          <td align="left" style="height: 30px;padding-left:0px;"><a onclick="javascript:AddSC(\''+jsonObject.root.Rows[0].maga_ID+'\');" href="javascript:void(0);">');
      htmlString.append('          <img  style="border:0px;" src="../Images/index/soucang.gif" width="56" height="18"/></a></td>');
      htmlString.append('        </tr>');      
      htmlString.append('        <tr align="left"> ');
      htmlString.append('          <td height="30" colspan="4" style="padding-left:8px;line-height:20px;"><font color="#CC3300">安装下载月桂，轻松获得精彩杂志，轻松DIY出自己的个性杂志');
      htmlString.append('            </font></td>');
      htmlString.append('        </tr>');
      htmlString.append('        <tr align="left"> ');
      htmlString.append('          <td height="30" colspan="4" style="padding-left:8px;"><a href="../DownLoad/YoGui.exe"><img border=0 src="../Images/bu_images/xj.gif" width="120" height="25" ></a></td>');
      htmlString.append('        </tr>');
      htmlString.append('      </table></td>');
      htmlString.append('  </tr>');
      htmlString.append('</table>');
      var m = htmlString.toString();
      $(methodType).setHTML(htmlString.toString());    
      break;
    }   
 };
 

 function SendPassword(action,eId,value){
    var requestUrl = "ForgetPassword.aspx?action="+action+"&value="+encodeURIComponent(value);
	var myAjax = new Ajax( requestUrl, {
                                           method: "post",
                                           async:false,
									       onComplete: function(txt)
									       {
									            //alert(txt);
									           // alert(eId);
									           if(action!="sendemail")
									           {
									            isOk(txt,eId);
									            
									           }
									           else
									           {
									               alert(txt);
									               if(txt.indexOf('成功')>-1)
									                 window.location.href='index.htm';
									           }
									       }
									   }
						 );
	myAjax.request();    
};

 function isOk(Ok,eId)
    {
        if(Ok=='false')
        {
           document.getElementById(eId).innerHTML='<font color=red>×验证失败，请重新输入</font>';
           document.getElementById('Hidden1').value='notok';
        }
        if(Ok=='success')
        {
            document.getElementById(eId).innerHTML='<font color=red>验证成功！</font>';
            document.getElementById('Hidden1').value='isok';
        }
    }
