//settigns
var content="popup.html";


$(document).ready(function(){
	popup();
	setTimeout(popup_show, 3000);
})


jQuery.extend( jQuery.easing,
{
	swing2: function (p, n, firstNum, diff) {
		return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
	}
});

/* var popup2 =  function(){
	alert("009");
} */

var lock=false;
var uplock=false;

function popup(){
	var ele = document.createElement("div")
	ele.innerHTML="dave";
	ele.id="56456";
	
	
	$("body").append(ele);

	$(ele).load(content, function(response, status, xhr) {
	  if (status != "error") {
		popup_animate(ele);
	  }
	});
	
}

var startbottom
var endbottom
function popup_animate(){
endbottom = parseInt($(".popup").css('bottom'));
startbottom =parseInt($(".popup").css('bottom'))-$(".popup").height()-7;




$(".popup").css('bottom', startbottom);

//$(".popup").animate({bottom: endbottom},2000,function(){lock=false;})
	
}

function popup_hide(){
	if(lock==true)return;
	lock=true;
	$(".popup").animate({bottom:startbottom},2000,"swing2",function(){lock=false;uplock=false});
}

function popup_show(){
	if(lock==true&&uplock==true)return;
	lock=true;
	uplock=true;
	$(".popup").animate({bottom:endbottom},2000,"swing2", function(){lock=false;});
}
