<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="skin/default/jooyea/css/iframe.css">
<SCRIPT language=JavaScript src="servtools/ajax_client/ajax.js"></SCRIPT>
<script Language="JavaScript">
	parent.guide("blog");
function CheckForm(){
	if(document.myform.blog_title.value==""){
		parent.Dialog.alert("{echo:lp{b_empty_t};/}");
		document.myform.blog_title.focus();
		return (false);
	}
    
	KindSubmit();
    
	if(document.myform.blog_content.value==""){
		parent.Dialog.alert("{echo:lp{b_empty_content};/}");
		return false;
   }
		return true;
}

function AddContentImg(ImgName,classId){  
	var frm = document.myform;
	var htmlletter = window.frames["KindEditorForm"];       
	htmlletter.document.getElementsByTagName("BODY")[0].innerHTML=htmlletter.document.getElementsByTagName("BODY")[0].innerHTML+"<br><IMG src='./"+ImgName+"' onload='fixImage(this,420,0)' classId="+classId+" /><br>";	
}
</script>

</head>
<body>
   <div class="main_right_title">
     <span class="main_title_dot"></span>
     <span class="main_title_txt">{echo:$titleStr;/}</span>
	 <div class="div_but_2" onclick="window.history.go(-1);">{echo:lp{b_re_last};/}</div>
   </div>
   <form action="{echo:$form_action;/}" method="post"  name="myform" onSubmit="return CheckForm();">
 
        
	<table border="0" width="90%" cellpadding="2" cellspacing="1" align="center" class="small tleft" style="margin:0 auto;">

		<tr>
		
			<td nowrap class="TableLine2" width="40" align="right">{echo:lp{b_title};/}：</td>
			<td class="TableLine1">
				<input class="BigInput" type="text" autocomplete='off' name="blog_title" value="{echo:$ulogTitle;/}" maxlength="30" size="67">
			</td>
		
		</tr>
    
    <tr>
    	
			<td nowrap class="TableLine2" width="40" align="right">{echo:lp{b_sort};/}：</td>
       
			<td class="TableLine1">
				<script language=JavaScript>
					function trim(str){ //删除左右两端的空格
						return str.replace(/(^\s*)|(\s*$)|(　*)/g , "");
					}

					function saveNowSort(){//获取接受返回信息层
						var sort_list=document.getElementById("blog_sort_list");
						var sort_add_msg=document.getElementById("sort_add_msg");	
						var blog_sort=trim(document.getElementById("new_sort_name").value); 
						document.getElementById("blog_sort_name").value=blog_sort;
						if(blog_sort==""){
								parent.Dialog.alert("{echo:lp{b_empty};/}");
								return false;
							}
																	
						//接收表单的URL地址		
						var url="do.php?act=blog_sort_add"; 
						 								
						//需要POST的值，把每个变量都通过&来联接 
						var postStr="new_sort="+blog_sort;
														
						ajax=InitAjax();//实例化Ajax 								
						ajax.open("POST", url, true);//通过Post方式打开连接 						
						ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); //定义传输的文件HTTP头信息 
						ajax.send(postStr); //发送POST数据 
						
						//获取执行状态 
					  ajax.onreadystatechange = function() { 
					      //如果执行状态成功，那么就把返回信息写到指定的层里 
					     if (ajax.readyState==4&&ajax.status==200) { 
					         sort_list.innerHTML=ajax.responseText; 
					         newCancel();
					         //sort_add_msg.innerHTML='添加成功&nbsp;';
					     }
					  }
							  
					} 
       	    	         	    
          function newShow(){
						document.getElementById('newSort').style.display='';
						document.getElementById('sortManage').style.display='none';
          }
          
          function newCancel(){  
        		var sort_add_msg=document.getElementById("sort_add_msg");	
        		document.getElementById('new_sort_name').value='';
            document.getElementById('newSort').style.display='none';
            document.getElementById('sortManage').style.display='';
          }
          
        </script>
        
         <table border="0">
         	   <tr>          	   	       	   	         	    	
         	    	<td>
	         	    	  <div id=blog_sort_list>
	                    {echo:blog_sort_list($dbo,$t_blog_sort,$user_id,$usubPara);/}
	                  </div>
                </td>                
                <td>
	                	<input type='hidden' name='blog_sort_name' id='blog_sort_name' value='{echo:$blog_sort_name;/}' />
	                	<span id='sort_add_msg'></span>
										<div id=newSort style="display:none">
											<input type=text class="d2input" name='new_sort_name' maxlength="20" id='new_sort_name' width='5'>
											<input type=button class="top_button" value='{echo:lp{b_button_save};/}' onclick="saveNowSort();">
											<input type=button class="top_button" value='{echo:lp{b_button_cancel};/}' onclick="newCancel();">
										</div>
										<span id=sortManage>
											<a href='javascript:newShow();'>{echo:lp{b_add_sort};/}</a>&nbsp;&nbsp;|&nbsp;<a href='?app=blog_manager_sort'>{echo:lp{b_manage_sort};/}</a>
	                  </span>
                </td> 
                               
              </tr>
          </table>                
        </td>
      </tr>
    
	    <tr>
	      	<td valign="top" nowrap class="TableLine2" width="40" align="right">{echo:lp{b_content};/}：</td>
	      	<td class="TableLine1" align="left">
			        <textarea name="blog_content" id="blog_content" cols="45" rows="5" style="display:none;">{echo:$ulogTxt;/}</textarea>
			        <script type="text/javascript" src="servtools/simeditor/KindEditor.js"></script>
			         <script type="text/javascript">
			          var editor = new KindEditor("editor");
			          editor.hiddenName = "blog_content";
			          editor.skinPath = "servtools/simeditor/skins/default/";
			          editor.iconPath = "servtools/simeditor/icons/";
			          editor.cssPath = "servtools/simeditor/common.css";
			          editor.editorType = "simple";
			          editor.editorWidth = "480px";
			          editor.editorHeight = "300px";
			          editor.show();
			          function KindSubmit(){
				         editor.data();
			          }
			         </script>
	    		</td>
	    </tr>

	   	<tr>
		      <td nowrap class="TableLine2" width="40" align="right">{echo:lp{b_pic};/}：</td>
		      <td class="TableLine1" align=left>
				      <div id="POPUP_KE_IMAGE">
				      <iframe name="KindImageIframe" id="KindImageIframe" width="100%" height=30 align=top allowTransparency="true" scrolling=no src='?app=upload_form' frameborder=0></iframe>
				      </div>
		      </td>
	    </tr>
    
	    <tr>
	    	
	    	<td></td>
	    	
	    	<td>{echo:album_name($dbo,$t_album,$user_id,$album_id);/}{echo:lp{b_sel_album};/}</td>
	    	
	    	<script type='text/javascript'>
				var album_select=document.getElementById("album_name");
				album_select.onchange=list_album_photos;
			               		 	           	    						      
				function list_album_photos(){//获取接受返回信息层  							
					var album_select_val=document.getElementById("album_name").value;
					var photos_list=document.getElementById("photos_list");
							
					if(album_select_val==""){
						return false;
						}else{
									photos_list.innerHTML="数据加载中,请稍侯...";
									
									var url="?app=user_ico_select&type=blog_photo&album_id="+album_select_val;				
																	
									ajax=InitAjax();//实例化Ajax 								
									ajax.open("GET", url, true);//通过Post方式打开连接 						
									ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); //定义传输的文件HTTP头信息 
									ajax.send(null); //发送POST数据
							
							    //获取执行状态 
								  ajax.onreadystatechange = function() { 
								      //如果执行状态成功，那么就把返回信息写到指定的层里 
								     if (ajax.readyState==4&&ajax.status==200) { 
								         photos_list.innerHTML=ajax.responseText; 
								         
								     }
								  } 
							 }
						  
					}
				</script> 					      
			</tr>
		
			<tr>
				
				<td></td>
				
				<td><div id='photos_list'></div></td>
				
			</tr>
      <tr>
	       	<td align="right">{echo:lp{b_limit};/}：</td>
	      	<td>
	      			<input type='radio' name='blog_limit' value='0' {echo:$public;/}  />{echo:lp{b_public};/}
	      			<input type='radio' name='blog_limit' value='1' {echo:$pals;/} />{echo:lp{b_pals};/}
	      			<input type='radio' name='blog_limit' value='2' {echo:$pri;/} />{echo:lp{b_private};/}
	      	</td>
      	
      </tr>
       
     <tr>
		      <td nowrap class="TableLine2" width="40" height="60"></td>
		      <td class="TableLine1">
		        <input type=submit class=anniu value="{echo:lp{b_button_sure};/}" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		        <input type=button class=anniu value="{echo:lp{b_button_cancel};/}" onclick='location.href="{echo:$goBackUrl;/}"' /><BR><BR>
			  	</td>
    </tr>
    
  </table>
  </form>
</body>
</html>