// JavaScript Document

// map popup
function map_popup(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600,left = 400,top = 192');");
}

// pageflipper
function flippages() {
	window.open('/pageflipper/','peeler','resizable=yes,width=850,height=650,left='+(screen.availWidth/2-425)+',top='+(screen.availHeight/2-325)+'');
	return false;
}

function CheckIsIE()
{
	if (navigator.appName.toUpperCase() == 'MICROSOFT INTERNET EXPLORER') { return true;}
	else { return false; }
}

function emailFriend(body) {
	var doc = "mailto:" + "?subject=" + escape(document.title) + "&body=" + escape(body);
  window.location = doc;
}

// print a coupon
function printCoupon(couponid, printit) {
	var container = document.getElementById('print_container');
	var addr = document.getElementById('addr'+couponid);
	
	// setup container
	if ( container && addr && printit == true ) {
		container.src = '../print/?pcoupon='+couponid+'&addr='+addr.value;
		return false;
	}
	
	// perform ajax request
	var url = '../print/?ajax=printcoupon&pcoupon='+couponid+'&addr='+addr.value;
	new Ajax(url, {
			method: 'get',
			evalScripts: true
	}).request();
	
	return false;
}
