<style>
.clr{clear:both; padding:0; margin:0; background:none; }
</style>
<?php
$arr_sort=array ('2'=>'违规图片');
$uploadlimit = array('2'=>5);
$isfaceimg = true;	//判断封面图是否已标记，这个设定针对重复图片的情况。

foreach($arr_sort as $key=>$sort) { ?>
<dl>
    <dd class="list_item clearfix">
          <div class="addPicBox radius3" style="border:none; box-shadow:none;height:100px;">
			   
               <div class="addPicRight" style="margin-left:30px;">
                  <div class="addBtnnew radius5">
                        <span id="spanButtonPlaceholder<?=$key?>"></span>
                  </div>
                <p class="text" style="width:600px;">
                最多上传5张，每张图片不大于5M，支持JPG\PNG格式</p>
				<div class="clr"></div>
<!--                <div class=" clearfix sq-hit left">提示：增加图片可以更为有效的说明情况，且通过图片上传内部资料和房主电话等截图可以优先处理</div>-->
                <div class=" clearfix sq-hit left">提示：申诉请上传房产证图片并留下房东电话，或者上传独家代理合同并留下房东电话，以便核实。</div>
				<br/>
				<br/>
                

              </div>
          </div>
       </dd>
	   </dl>
<script type="text/javascript">
    /*
var swfu<?=$key?>;
$(function() {
swfu<?=$key?> = new SWFUpload({
	// Backend Settings
	upload_url: "<?=$upload_pic_url?>",
	//post_params: {"PHPSESSID": "5onmcek5m1qsu5e5nor2tiq325"},
	//post_params: {"postion" : position},
	// File Upload Settings
	file_size_limit : "5 MB",	// 5MB
	file_types : "*.jpg;*.png;",
	file_types_description : "Images",
	file_upload_limit : "0",
	file_queue_limit : "5",

	custom_settings : {
		upload_target : "jsPicPreviewBoxM<?=$key?>",
		upload_limit  : <?=$uploadlimit[$key]?>,
		upload_nail	  : "thumbnails<?=$key?>",
		upload_infotype : <?=$key?>
	},

	// Event Handler Settings - these functions as defined in Handlers.js
	//  The handlers are not part of SWFUpload but are part of my website and control how
	//  my website reacts to the SWFUpload events.
	swfupload_loaded_handler : swfUploadLoaded,
	file_queue_error_handler : fileQueueError,
	file_dialog_start_handler : fileDialogStart,
	file_dialog_complete_handler : fileDialogComplete,
	upload_progress_handler : uploadProgress,
	upload_error_handler : uploadError,
	upload_success_handler : uploadSuccess,
	upload_complete_handler : uploadComplete,


	// Button Settings
	button_image_url : "",
	button_placeholder_id : "spanButtonPlaceholder<?=$key?>",
	button_width: 66,
	button_height: 28,
	button_cursor: SWFUpload.CURSOR.HAND,
    button_text:"图片上传",
	// Flash Settings
	//flash_url : "<?=STATIC_SOURCE_URL?>/common/js/swf/swfupload.swf"
    flash_url : "/swfupload.swf"
	// Debug Settings
	//debug: true
});

});*/
</script>

	  
<?php
	if(isset($house_detail['house_pic' . $key]) && !empty($house_detail['house_pic' . $key])) {
        $style = 'style="display:block"';
        $bolHasHouse = true;
     } else {
        $style = 'style="display:none"';
        $bolHasHouse = false;
     }

?>
    <div id="jsPicPreviewBoxM<?=$key?>" style="display:none" ></div>
	<dl>
		   <dd class="list_item clearfix" id="picshow<?=$key?>" <?=$style?>>
					<div class="picPreviewBox radius3" style="margin:0px;" >
						<p class="title">您选择的图片</p>
						<div class="picPreviewBoxM clearfix ui-sortable" id="thumbnails<?=$key?>"> 
						
							

							
							
		</div>
	</div>
</dd>
</dl>
<?php } ?>
<input type='hidden' name='deleteupload' value='1' />
<input type='hidden' id="delpic" name='delpic' value='' />
<input type='hidden' id="pic1" name='pic1' value='<?=$house_detail['pic1']?>' />

<script type="text/javascript">

//选择图库图片 box==可点击选择图片外部div ID，  number==最多可以选择的张数  toBox==添加到的div的ID   jsNameInputDz
							function picPreview(box, number, toBox, cs) {
								$("#" + toBox).find(".mItem").find(".delBtn").live("click", function() {

									if($(this).attr("id") == 0) {
										swfu0.setButtonDisabled(false);
									}
									if($(this).attr("id") == 1) {
										swfu1.setButtonDisabled(false);
									}
									if($(this).attr("id") == 2) {
										swfu2.setButtonDisabled(false);
									}

									$(this).parents(".mItem").remove();
									var oNum = $(this).parents(".mItem").find("img").attr("num");
									$("#" + box).find("img").each(function(index, element) {
										if($(this).attr("num") == oNum) {
											$(this).parents(".item").find(".btn").hide()
										}
									});
								});
							}
							
								//图片选择拖动 
							function picPreviewLive(obj) {
								$("#" + obj).sortable(); //拖动
								$("#" + obj).find(".mItemInner").find("img").live("mousemove", function(event) {
									if($("#coordinates").length <= 0) {
										$("<div id='coordinates' class='radius5' >点击拖动</div>").appendTo("body");
									}
									if($("#coordinates").length >= 0) {
										var oDiv = $("#coordinates");
										oDiv.css({
											left: event.pageX + 4 + 'px',
											top: event.pageY + 4 + 'px'
										})
									}
								}).live("mouseout", function() {
									$("#coordinates").remove()
								})

								$("#" + obj).find(".mItem").live("mousedown", function() { //
									$("#coordinates").hide();
									$(this).addClass("mItemHover");
									$(this).siblings(".mItem").find("img").css({
										opacity: 0.4
									});
									$(this).siblings(".mItem").find(".funM").css({
										opacity: 0.2
									});
									$(this).siblings(".mItem").find(".funMtext").css({
										opacity: 0.4
									});

								}).live("mouseup", function() {
									$("#coordinates").hide();
									$(this).removeClass("mItemHover");
									$(this).siblings(".mItem").find("img").css({
										opacity: 1
									});
									$(this).siblings(".mItem").find(".funM").css({
										opacity: .6
									});
									$(this).siblings(".mItem").find(".funMtext").css({
										opacity: 1
									});
								})

								$("#" + obj).find("label").live("mousedown", function(event) {
									event.stopPropagation()
								})

								$("#" + obj).find(".delBtn").live("mousedown", function(event) {
									event.stopPropagation()
								})
								$("#" + obj).find(".jsInputCount ").live("mousedown", function(event) {
									event.stopPropagation()
								})

							}
							$(function() {								
								$(".bigPicLin").live("click mousedown", function(event) {
									$(this).parents(".mItem").removeClass("mItemHover");
									event.stopPropagation();
								});
							});
						var swfu<?=$key?>;
						function appeal(rowid,esta, time, reason, secret_key, obj) {

							$(".yz-zcon .branchCommon").remove();
							$(".yz-zcon").slideUp(500);
							var html = '<div class="branchCommon radius5 " style="display:block" id="jsDialogNeighborhoodComplain">'+
											'<div class="hd">'+
											'<h3 class="h3">我要申诉</h3>'+
											'<a href="javascript:void(0)" class="right close-sq j-close-sq">关闭</a>'+
										'</div>'+
										'<form class="frozen-form" name="house_appeal_form" action="">'+
											'<ul class="frozen-sq clearfix">'+
												'<li><label class="label">违规房源：</label><label class="label" id="houseid"></label></li>'+
												'<li class="middle"><label class="label">违规时间：</label><label class="label" id="time"></label></li>'+
												'<li><label class="label">违规原因：</label><label class="label" id="reason"></label></li>'+
											'</ul>'+
											'<div class="clr"></div>'+
											'<div class="reason-sq">'+
												'<div class="must-sq left">*</div>'+
												'</lable><label class="label left">申诉理由：</label>'+
												'<textarea class="textarea left" id="jsReason" onkeyup="words_deal();"></textarea>'+
												'<label class="error" style="display:none;color:red;margin-left:70px;">请填写申诉理由!</label>'+
												'<div class="clearfix">'+
				
													'<p class="right">'+
														'<lable>剩余<span class="colorR" id="jsReasonNum">50</span>字</lable>'+
													'</p>'+
												'</div>'+
											'</div>'+
											'<div style="float:left;margin-top:10px;">上传图片:</div>'+
											'<style>'+
												'.clr {'+
													'clear: both;'+
													'padding: 0;'+
													'margin: 0;'+
													'background: none;'+
												'}'+
											'</style>'+
											'<dl>'+
												'<dd class="list_item clearfix">'+
													'<div class="addPicBox radius3" style="border:none; box-shadow:none;height:100px;">'+
				
														'<div class="addPicRight" style="margin-left:30px;">'+
															'<div class="addBtnnew radius5">'+
																'<span id="spanButtonPlaceholder2"></span>'+
															'</div>'+
															'<p class="text" style="width:600px;">'+
																'最多上传5张，每张图片不大于5M，支持JPG\PNG格式</p>'+
															'<div class="clr"></div>'+
															
															'<div class=" clearfix sq-hit left">提示：申诉请上传房产证图片并留下房东电话，或者上传独家代理合同并留下房东电话，以便核实。</div>'+
															'<br/>'+
															'<br/>'+
				
														'</div>'+
													'</div>'+
												'</dd>'+
											'</dl>				'+			
											'<div id="jsPicPreviewBoxM2" style="display:none"></div>'+
											'<dl>'+
												'<dd class="list_item clearfix" id="picshow2" style="display:none">'+
													'<div class="picPreviewBox radius3" style="margin:0px;">'+
														'<p class="title">您选择的图片</p>'+
														'<div class="picPreviewBoxM clearfix ui-sortable" id="thumbnails2">'+
				
														'</div>'+
													'</div>'+
												'</dd>'+
											'</dl>'+
											'<input type="hidden" name="deleteupload" value="1" />'+
											'<input type="hidden" id="delpic" name="delpic" value="" />'+
											'<input type="hidden" id="pic1" name="pic1" value="" />'+
				
											'<div class="clr"></div>'+
											'<div class="sq-subt-fields">'+
												'<a href="#" class="btn-sq btnCon radius5" onclick="appeal_add();">提交</a>'+
												'<a href="javascript:void(0)" class="btn-sq btnCon radius5 j-reset-sq"> 取消</a>'+
											'</div>'+
				
											'<input type="hidden" name="secret_key" id="secret_key" value="">'+
				
										'</form>'+
									'</div>';

							
							$(obj).parents(".itemInfoBach").next(".yz-zcon").append(html);
							$(obj).parents(".itemInfoBach").next(".yz-zcon").slideDown(500);
							$("#reason").html(reason);
							$("#houseid").html(rowid);
							$("#time").html(time);
							$("#secret_key").val(secret_key);
							if(esta=='54') {
                                $(".sq-subt-fields a").first().attr("onclick", "appeal_add_delete()");
                            }
							
								swfu<?=$key?> = new SWFUpload({
									// Backend Settings
									upload_url: "<?=$upload_pic_url?>",
									// File Upload Settings
									file_size_limit: "5 MB", // 5MB
									file_types: "*.jpg;*.png;",
									file_types_description: "Images",
									file_upload_limit: "0",
									file_queue_limit: "5",
									custom_settings: {
										upload_target: "jsPicPreviewBoxM<?=$key?>",
										upload_limit: <?=$uploadlimit[$key]?>,
										upload_nail: "thumbnails<?=$key?>",
										upload_infotype: <?=$key?>
									},
									// Event Handler Settings - these functions as defined in Handlers.js
									//  The handlers are not part of SWFUpload but are part of my website and control how
									//  my website reacts to the SWFUpload events.
									swfupload_loaded_handler: swfUploadLoaded,
									file_queue_error_handler: fileQueueError,
									file_dialog_start_handler: fileDialogStart,
									file_dialog_complete_handler: fileDialogComplete,
									upload_progress_handler: uploadProgress,
									upload_error_handler: uploadError,
									upload_success_handler: uploadSuccess,
									upload_complete_handler: uploadComplete,
									// Button Settings
									button_image_url: "",
									button_placeholder_id: "spanButtonPlaceholder<?=$key?>",
									button_width: 66,
									button_height: 28,
									button_cursor: SWFUpload.CURSOR.HAND,
									button_text: "图片上传",
									// Flash Settings
									flash_url: "http://nj.zsb.house365.com/swfupload.swf"
								});
								picPreview("jsPicPreviewList2", 5, "thumbnails2", 2)
								picPreviewLive("thumbnails2");
							
						}


						function appeal_add_delete()
                        {
                            var rowid = $("#houseid").html();
                            var reason = encodeURI($("#jsReason").val());
                            var secret_key = $("#secret_key").val();

                            //2015-7-9 获取图片的地址 ----------start ------------>
                            var p_filenames = $("input[name='p_filename[]']");
                            var p_filenames_img = '';
                            p_filenames.each(function(){
                                var value = $(this).val()+',';
                                p_filenames_img += value;
                            });
                            //2015-7-9 获取图片的地址 ----------end ------------>

                            if(reason == '')
                            {
                                $(".error").show();
                                return false;
                            }else{
                                $(".error").hide();
                            }


                            var form_delete = $("#search_form");//选择图库图片 box==可点击选择图片外部div
                            var tablename   =$("#tablename").val();
                            //alert('<?php echo GB_WO_URL;?>/'+tablename+'/house_appeal_delete/');
                            $.ajax({
                                type: 'get',
                                url : '<?php echo GB_WO_URL;?>/'+tablename+'/house_appeal_delete/',
                                data:  {'secret_key':secret_key , 'rowid':rowid ,'reason':reason,'p_filenames':p_filenames_img},
                                dataType:'json',
                                success: function(data)
                                {
                                    if(data.errorCode == '401')
                                    {
                                        jump_win('<?php echo GB_WO_URL;?>/sell/jump/login/' , '请重新登录');
                                        return false;
                                    }

                                    if( data.is_ok == '1' )
                                    {
                                        $("#dialogts #dialog_tip").html(data.msg);
                                        openWin('dialogts');
                                        form_delete.submit();
                                    }
                                    else
                                    {
                                        $("#dialogts #dialog_tip").html(data.msg);
                                        openWin('dialogts');
                                        form_delete.submit();
                                    }
                                }
                            });

                            $(".yz-zcon").slideUp(500);
                            $(".yz-zcon .branchCommon").remove();

                            $("#gTipsCoverjsDialogNeighborhoodComplain").remove();

                        }

</script>
