var pf204652IntervalId = 0;
var pf204652maxHeight = 180;// Chieu cao khung quang cao
var pf204652minHeight = 20;
var pf204652curHeight = 0;

function pf204652show() {
	pf204652curHeight += 2;
	if (pf204652curHeight > pf204652maxHeight) {
		clearInterval(pf204652IntervalId);
	}
	pf204652bottomLayer.style.height = pf204652curHeight + 'px';
}
function pf204652hide() {
	pf204652curHeight -= 3;
	if (pf204652curHeight < pf204652minHeight) {
		clearInterval(pf204652IntervalId);
	}
	pf204652bottomLayer.style.height = pf204652curHeight + 'px';
}

function pf204652clickhide() {
	jQuery('#pf204652hide').hide();
	jQuery('#pf204652show').show();
	pf204652IntervalId = setInterval('pf204652hide()', 5);
	SetCookie123("popup", "1");
}
function pf204652clickshow() {
	jQuery('#pf204652hide').show();
	jQuery('#pf204652show').hide();
	pf204652IntervalId = setInterval('pf204652show()', 5);
	SetCookie123("popup", "2");
}
function pf204652clickclose() {
	document.body.style.marginBottom = '0px';
	pf204652bottomLayer.style.display = 'none';
	SetCookie123("popup", "0");
}

function GetCookie123(name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
			return getCookieVal123(j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0)
			break;
	}
	return null;
}
function SetCookie123(name, value) {
	var argv = SetCookie123.arguments;
	var argc = SetCookie123.arguments.length;
	var expDays = 1;
	var exp = new Date();
	exp.setTime(exp.getTime() + (expDays * 24 * 60 * 60 * 1000));
	var expires = exp;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape(value)
			+ ((expires == null) ? "" : ("; expires=" + expires.toGMTString()))
			+ ((path == null) ? "" : ("; path=" + path))
			+ ((domain == null) ? "" : ("; domain=" + domain))
			+ ((secure == true) ? "; secure" : "");
}
function getCookieVal123(offset) {
	var endstr = document.cookie.indexOf(";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

jQuery(document).ready(function() {
	jQuery('#coc67178 a.min').click(function() {
		pf204652clickhide();
		return false;
	});
	jQuery('#coc67178 a.max').click(function() {
		pf204652clickshow();
		return false;
	});
	jQuery('#coc67178 a.close').click(function() {
		pf204652clickclose();
		return false;
	});
	if (GetCookie123("popup") != null && GetCookie123("popup") == 0) {
		pf204652clickclose();
	}
	if (GetCookie123("popup") != null && GetCookie123("popup") == 1) {
		jQuery('#coc67178 a.min').delay(2000).queue(function() {
			jQuery('#coc67178 a.min').click();
		});
	}
});
