/**************************
# 希望您能保留版权 v1.4.0 #
# 联系我：http://klfy.org #
**************************/
/* window-box */
$(document).ready(function(){
	$("#button").click(function(){
		var bwidth = $(window).width();       //获得浏览器的宽
		var bheight = $(window).height();	  //获得浏览器的高
		var cwidth = $("#set_position_window").width();   //获得当前窗体的宽
		var cheight = $("#set_position_window").height(); //获得当前窗体的高
		var left = (bwidth-cwidth)/2;	//计算出居中的左边距
		var top = (bheight-cheight)/2;	//计算出居中的上边距
		$("#klfy_pop").css("left",0).css("top",0).fadeIn("slow");	
		$("#set_position_window").css("left",left).css("top",top).fadeIn("slow");
	});
			
	$("#close").click(function(){
		$("#set_position_window").fadeOut("slow");
		$("#klfy_pop").fadeOut("slow");	
	});
});

function fixUglyIE() {
	for (a in document.links) document.links[a].onfocus = document.links[a].blur;
}

if (document.all) {
		document.onmousedown = fixUglyIE;
}

function high(which2) {
	theobject = which2;
		highlighting = setInterval("highlightit(theobject)", 50);
}

function low(which2) {
	clearInterval(highlighting);
	which2.filters.alpha.opacity = 40;
}

function highlightit(cur2) {
	if (cur2.filters.alpha.opacity < 100) {
		cur2.filters.alpha.opacity += 10;
	} else {
		if (window.highlighting) {
			clearInterval(highlighting);
		}
	}
}

function MM_displayStatusMsg(msgStr) {
	status = msgStr;
	document.MM_returnValue = true;
}

/* FlashUploadMsg */
function goNext() {
	alert('全部文件已经上传.');
}

/* CTRL触发删除 */
//鸣谢：Blues，提供技术支持.
$(document).ready(function(){
	var url = './files/include/files.class.php';
	var $targ = $('#file_remove');
	var $flag = true;
	//按下
	$(document).keydown(function(event){
	switch(event.keyCode){
		case 17:if($flag){
			bindC();
			$flag = false;
		}  
	}
});
       
//松开
$(document).keyup(function(event){
	switch(event.keyCode){
		case 17:unbindC();$flag = true;
	}
});
       
//解除绑定
function unbindC(){
	$targ.unbind('click.ctrlC');
}       

//绑定监听
function bindC(){
	$targ.bind('click.ctrlC' ,function(event){
		if($(event.target).is('.del_file')){
			event.preventDefault();
			//传递值
			if(!confirm('是否删除目录或文件？(如果是目录，选“是”将删除当前目录和目录下所有文件!!)'))return;
			path = $(event.target).attr('href');
			$.get('./files/include/files.class.php',{'path':path},function(data){
			 //debug
				if(data!=1)
					alert('被保护的文件，删除失败！');
				else if(data == 1)
					alert('删除成功');window.location.reload();
					//返回上一页 javascript:history.go(-1);
				});
			}
		});
	}
});
