//-----------------------------------
function layer_show(it) {
	var el = $("#"+it);
	var x=300;
	el.animate({top: x}, 1400);
	layer_cur_top=x;
	//-------
	$(window).scroll(function() {
		$("#"+it).css('top',(layer_cur_top+document.body.scrollTop)+'px');
	});
	//-------
	$("#"+it).Draggable({
		zIndex: 	100,
		opacity: 	0.8
	});
	//-------
	$("."+it+"-x").mouseover(function() {
		$(this).css('cursor','pointer');
	});
	//-------
}
//-----------------------------------
$(document).ready(function() {
	//-------
	$("#layer").hide();
	$("#dlayer").hide();
	$("#blayer").hide();
	//-------
	$("#submit-d").click(function() {
		/*
		if($("#name-d").val()!='' && $("#eml-d").val()!='' && $("#cn-d").val()) {
		$.ajax({
		type:		"POST",
		url:		"index.php",
		data:		"task=dlayer&name="+$("#name-d").val()+"&eml="+$("#eml-d").val()+"&cn="+$("#cn-d").val(),
		success:	function(msg) {
		$("#dlayer").hide();
		if(msg!='good') {
		alert(msg);
		} else {
		$("#name-b").val($("#name-d").val());
		$("#eml-b").val($("#eml-d").val());
		layer_show("blayer");
		}
		}
		});
		window.open('./php/forcedl.php?file=setup.exe');
		}
		*/
	});
	//-------
	$("#submit-b").click(function() {
		if($("#name-b").val()!='' && $("#eml-b").val()!='') {
			$.ajax({
				type:		"POST",
				url:		"index.php",
				data:		"task=blayer&name="+$("#name-b").val()+"&eml="+$("#eml-b").val(),
				success:	function(msg) {
					$("#dlayer").hide();
					if(msg!='good') {
						alert(msg);
					} else {
						$(".blayer-x").click();
					}
				}
			});
		}
	});
	//-------
	$("#beta_link").mouseover(function() {
		$(this).css('cursor','pointer');
	});
	//-------
	$(".layer-x, .dlayer-x, .blayer-x").click(function() {
		i=$(this).attr('class');
		$("#"+i.substring(0,i.indexOf('-x'))).fadeOut('normal').DraggableDestroy();
	});
	//-------
});