var obj_top=300;
//-----------------------------------
$(document).ready(function() {
	$.ajax({
		type:		"POST",
		url:		"/seo_layer2.php",
		data:		"task=get",
		success:	function(data) {
			//-------
			$(".bottom").after(data);
			//-------
			$("#lyr_000").css('left',((document.body.clientWidth/2)-215)).hide();
			setTimeout('$("#lyr_000").fadeIn("normal").animate({top: 300}, 1000)',850);
			//-------
			$(window).scroll(function() {
				$("#lyr_000").css('top',(obj_top+document.body.scrollTop)+'px');
			});
			$('#lyr_000').mouseup(function() {
				obj_top=parseInt($(this).css('top').replace('px',''))-document.body.scrollTop;
			});
			//-------
			$('#lyr_000').jqDrag("#lyr_002_top");
			//-------
			$("#button_ok, #button_cancel, #lyr_002_top_x, #sbm").mouseover(function() {
				$(this).css('cursor','pointer');
			});
			//-------
			$("#lyr_002_top").mouseover(function() {
				$(this).css('cursor','move');
			});
			//-------
			$("#button_ok, #button_cancel").mouseover(function() {
				$(this).css('background-color','#FDFDDB');
			});
			$("#button_ok, #button_cancel").mouseout(function() {
				$(this).css('background-color','#FEFEF6');
			});
			//-------
			$("#button_cancel").click(function() {
				$("#lyr_000").animate({left: document.body.clientWidth}, 800);
				$("#lyr_000").fadeOut('fast');
			});
			//-------
			$("#button_ok").click(function() {
				$("#lyr_000").animate({left: document.body.clientWidth}, 800);
				setTimeout('swip_panel()',900);
				$("#lyr_000").animate({left: ((document.body.clientWidth/2)-215)}, 800);
				$("#lyr_002_top_t").html('Final Step To Claim Your Free Newsletter');
			});
			//-------
			$("#lyr_002_top_x").click(function() {
				$("#button_cancel").click();
			});
			//-------
			$("#frmfreegift").submit( function() {
				flag=true;
				text='';
				if($("#firstname").val()=='') {
					flag=false;
				}
				if($("#email2").val()=='') {
					flag=false;
				}
				if(flag==false) {
					alert('Please fill in the empty fields');
				}
				return flag;
			});
			//-------
		}
	});
});
//-----------------------------------
function swip_panel() {
	$("#lyr_002_cont_1").hide();
	$("#lyr_002_cont_2").show();
}
//-----------------------------------


