var lastClassBodyCoupon="";

function centerDivCoupon(){

	var divCenter = document.getElementById("frameReportCoupon");

	var width = 0;
	var height = 0;
	var scrollTop = 0;
	var scrollLeft = 0;

	if(divCenter!= null){
		if (typeof  window.innerWidth == "undefined"){
			// Internet Explorer 7
			width= parseInt(document.body.clientWidth);
			height= parseInt(document.body.clientHeight);
			scrollTop = document.documentElement.scrollTop;
			scrollLeft = document.documentElement.scrollLeft;
		}
		else {
			//Fire Fox
			width= parseInt(window.innerWidth);
			height= parseInt(window.innerHeight);

			scrollTop = window.pageYOffset;
			scrollLeft = window.pageXOffset;
		}

		var leftValue = parseInt(width/2 - divCenter.offsetWidth/2) + scrollLeft;
		var topValue =  parseInt(height/2 - divCenter.offsetHeight/2) + scrollTop;

		if (leftValue < 0){
			leftValue = 0;
		}
		if (topValue < 0){
			topValue = 0;
		}
		divCenter.style.left = leftValue+"px";
	}
}

function showReportCoupon(){
	brandIdObj = document.getElementById("BRANDID");
	if(brandIdObj != null){
		brandIdObj.style.display = "none";
	}
	lastClassBodyCoupon = document.body.className;
	document.body.className = "printCoupon";
	var overlay = document.getElementById("overlayCoupon");
	var frameReport = document.getElementById("frameReportCoupon");

	overlay.style.display = "block";
	frameReport.style.display = "block";

	centerDivCoupon(overlay);
	window.print();
}

function closeReportCoupon(){
	brandIdObj = document.getElementById("BRANDID");
	if(brandIdObj != null){
		brandIdObj.style.display = "inline";
	}
	document.body.className = lastClassBodyCoupon;
	var overlay = document.getElementById("overlayCoupon");
	var frameReport = document.getElementById("frameReportCoupon");
	frameReport.style.display = "none";
	overlay.style.display = "none";
}