function showCoupon(day,month,year,code,discount,desc,company,couptype) {
	expire = new Date(year,month - 1,day);
	today = new Date();
	if (today.valueOf() > expire.valueOf() + 86400 * 1000) { return 0; }
	total = "<li><p>";
	total = total + "<a href=\"" + company + "-Discount.php?discount=" + discount + "\" ";
	total = total + "target=\"_blank\" onClick=\"javascript: pageTracker._trackPageview('/outside/CJShoes');javascript:copyCode('" + code + "');\">";
	total = total + "<strong>" + code + "</strong></a> - ";
	if (couptype) { total = total + "<strong>" + couptype + " coupon</strong> - "; }
	total = total + desc;
	before = "";
	after = "";
	if ((expire.valueOf() - today.valueOf()) < 5 * 86400 * 1000) {
	before = "<span class=\"expdiscount\">";
	after = "</span>";
	}
	if ((expire.valueOf() - today.valueOf()) < 0) {
		month = 13;	
		day = "today";
	}
	if ((expire.valueOf() - today.valueOf()) > 0 && (expire.valueOf() - today.valueOf()) < 86400 * 1000) {
		month = 13;	
		day = "tomorrow";
	}
	total = total + " " + before + "(expires " + monthName(month - 1) + " " + day + ")" + after + "</p></li>";
	document.write(total);
}
function showDiscount(day,month,year,discount,title,desc,company) {
	expire = new Date(year,month - 1,day);
	today = new Date();
	if (today.valueOf() > expire.valueOf() + 86400 * 1000) { return 0; }
	total = "<li><p>";
	total = total + "<a href=\"" + company + "-Discount.php?discount=" + discount + "\" ";
	total = total + "target=\"_blank\" onClick=\"javascript: pageTracker._trackPageview('/outside/CJShoes');\">";
	total = total + "<strong>" + title + "</strong></a> - ";
	total = total + desc;
	before = "";
	after = "";
	if ((expire.valueOf() - today.valueOf()) < 5 * 86400 * 1000) {
		before = "<span class=\"expdiscount\">";
		after = "</span>";
	}
	if ((expire.valueOf() - today.valueOf()) < 0) {
		month = 13;	
		day = "today";
	}
	if ((expire.valueOf() - today.valueOf()) > 0 && (expire.valueOf() - today.valueOf()) < 86400 * 1000) {
		month = 13;	
		day = "tomorrow";
	}
	total = total + " " + before + "(expires " + monthName(month - 1) + " " + day + ")" + after + "</p></li>";
	document.write(total);
}

function monthName(monthnum) {
	var monthy;
	switch (monthnum) {
	case 12:
		return " ";
		break;
	case 0:
		monthy = "January";
		break;
	case 1:
		monthy = "February";
		break;
	case 2:
		monthy = "March";
		break;
	case 3:
		monthy = "April";
		break;
	case 4:
		monthy = "May";
		break;
	case 5:
		monthy = "June";
		break;
	case 6:
		monthy = "July";
		break;
	case 7:
		monthy = "August";
		break;
	case 8:
		monthy = "September";
		break;
	case 9:
		monthy = "October";
		break;
	case 10:
		monthy = "November";
		break;
	case 11:
		monthy = "December";
		break;
	}
	return monthy;
}

function show6pmDiscount(day,month,year,endday,endmonth,endyear,discount,title,desc,linkname) {
	expire = new Date(endyear,endmonth - 1,endday);
	start = new Date(year,month - 1,day);
	today = new Date();
	total = "<li><p>";
	if (! (today.valueOf() > expire.valueOf() + 86400 * 1000 || today.valueOf() < start.valueOf())) {
	total = total + "<a ";
	if (linkname) {
	total = total + "name=\"" + linkname + "\" ";
	}
	total = total + "href=\"6pm-Discount.php?discount=" + discount + "\" ";
	total = total + "target=\"_blank\" onClick=\"javascript: pageTracker._trackPageview('/outside/CJShoes');\">";
	total = total + "<strong>" + title + "</strong></a> - ";
	total = total + desc;
	}
	else {
	total = total + "<strong style='text-decoration:underline'>" + title + "</strong></a> - ";
	total = total + desc;
	}
	before = "";
	after = "";
	if ((expire.valueOf() - today.valueOf()) < 5 * 86400 * 1000) {
		before = "<span class=\"expdiscount\">";
		after = "</span>";
	}
	if ((expire.valueOf() - today.valueOf()) < 0 && (expire.valueOf() - today.valueOf()) > -86400 * 1000) {
		endmonth = 13;	
		endday = "today";
	}
	if ((expire.valueOf() - today.valueOf()) > 0 && (expire.valueOf() - today.valueOf()) < 86400 * 1000) {
		endmonth = 13;	
		endday = "tomorrow";
	}
	tobegin = start.valueOf() - today.valueOf()
	if (tobegin < 5 * 86400 * 1000 && tobegin > 0) {
		before = "<span class=\"expdiscount\">";
		after = "</span>";
	}
	if (tobegin < 86400 * 1000 && tobegin > 0) {
		endmonth = 13;	
		endday = "tomorrow";
	}
	if (!(today.valueOf() > expire.valueOf() + 86400 * 1000 || today.valueOf() < start.valueOf())) {
	total = total + " " + before + "(expires " + monthName(endmonth - 1) + " " + endday + ")" + after + "</p></li>";
	}
	if (tobegin > 0) {
	total = total + " " + before + "(starts " + monthName(month - 1) + " " + day + ")" + after + "</p></li>";
	}
	if (today.valueOf() > expire.valueOf() + 86400 * 1000) {
	total = total + " (expired " + monthName(endmonth - 1) + " " + endday + ")</p></li>";
	}
	document.write(total);
}
function discountLink(sday,smonth,syear,day,month,year,place) {
	expire = new Date(year,month - 1,day);
	begin = new Date(syear,smonth - 1,sday);
	today = new Date();
	result = "<a href=\"#" + place + "\">discount</a> - ";
	until = "until ";
	before = "";
	after = "";
	change = false;
	if (begin.valueOf() > today.valueOf()) {
		until = "starts ";
		result = "discount - ";
		change = true;
	}
	if ((expire.valueOf() - today.valueOf()) < 5 * 86400 * 1000) {
		before = "<span class=\"expdiscount\">";
		after = "</span>";
	}
	if ((expire.valueOf() - today.valueOf()) < 0 && (expire.valueOf() - today.valueOf()) > -86400 * 1000) {
		month = 13;	
		day = "day";
		until = "final ";
	}
	if ((expire.valueOf() - today.valueOf()) > 0 && (expire.valueOf() - today.valueOf()) < 86400 * 1000) {
		month = 13;	
		day = "tomorrow";
	}
	expires = until + monthName(month - 1) + " " + day;
	if (change) {
		expires = until + monthName(smonth - 1) + " " + sday;	
	}
	if ((expire.valueOf() + 86400 * 1000) < today.valueOf()) {
		expires = "expired";
		before = "";
		after = "";
		result = "discount - ";
	}
	result = result + before + expires + after;
	document.write(result);
}
function ssdateRange() {
	today = new Date();
	now = today.getDay();
	now = now + 6;
	now = now % 7;
	then = today.valueOf() - (now - 5) * 86400000
	later = today.valueOf() - (now - 6) * 86400000
	then = new Date(then);
	later = new Date(later);
	return monthName(then.getMonth()) + " " + then.getDate() + " - " + monthName(later.getMonth()) + " " + later.getDate();
}
function susdateRange() {
	today = new Date();
	now = today.getDay();
	now = now + 0;
	now = now % 7;
	then = today.valueOf() - (now) * 86400000
	later = today.valueOf() + (7 - now) * 86400000
	then = new Date(then);
	later = new Date(later);
	return monthName(then.getMonth()) + " " + then.getDate() + " - " + monthName(later.getMonth()) + " " + later.getDate();
}
function fsdateRange() {
	today = new Date();
	now = today.getDay();
	now = now + 6;
	now = now % 7;
	then = today.valueOf() - (now - 4) * 86400000
	later = today.valueOf() - (now - 6) * 86400000
	then = new Date(then);
	later = new Date(later);
	return monthName(then.getMonth()) + " " + then.getDate() + " - " + monthName(later.getMonth()) + " " + later.getDate();
}
function mfdateRange() {
	today = new Date();
	now = today.getDay();
	now = now + 1;
	now = now % 7;
	then = today.valueOf() - (now - 2) * 86400000
	later = today.valueOf() - (now - 6) * 86400000
	then = new Date(then);
	later = new Date(later);
	return monthName(then.getMonth()) + " " + then.getDate() + " - " + monthName(later.getMonth()) + " " + later.getDate();
}
function showEndlessDiscount(sday,smonth,syear,day,month,year,discount,title,desc,linkname) {
	expire = new Date(year,month - 1,day);
	start = new Date(syear,smonth - 1,sday);
	today = new Date();
	if ((today.valueOf() > expire.valueOf() + 86400 * 1000) || today.valueOf() < start.valueOf()) { return 0; }
	total = "<li><p>";
	total = total + "<a ";
	if (linkname) { total = total + "name=\"" + linkname + "\" "; }
	total = total + "href=\"Endless-Discount.php?discount=" + discount + "\" ";
	total = total + "target=\"_blank\" onClick=\"javascript: pageTracker._trackPageview('/outside/CJShoes');\">";
	total = total + "<strong>" + title + "</strong></a> - ";
	total = total + desc;
	before = "";
	after = "";
	if ((expire.valueOf() - today.valueOf()) < 5 * 86400 * 1000) {
	before = "<span class=\"expdiscount\">";
	after = "</span>";
	}
	if ((expire.valueOf() - today.valueOf()) < 0) {
		month = 13;	
		day = "today";
	}
	if ((expire.valueOf() - today.valueOf()) > 0 && (expire.valueOf() - today.valueOf()) < 86400 * 1000) {
		month = 13;	
		day = "tomorrow";
	}
	total = total + " " + before + "(expires " + monthName(month - 1) + " " + day + ")" + after + "</p></li>";
	document.write(total);
}

function showShoeMallDiscount(sday,smonth,syear,day,month,year,discount,title,desc,linkname) {
	expire = new Date(year,month - 1,day);
	start = new Date(syear,smonth - 1,sday);
	today = new Date();
	if ((today.valueOf() > expire.valueOf() + 86400 * 1000) || today.valueOf() < start.valueOf()) { return 0; }
	total = "<li><p>";
	total = total + "<a ";
	if (linkname) { total = total + "name=\"" + linkname + "\" "; }
	total = total + "href=\"Endless-Discount.php?discount=" + discount + "\" ";
	total = total + "target=\"_blank\" onClick=\"javascript: pageTracker._trackPageview('/outside/CJShoes');\">";
	total = total + "<strong>" + title + "</strong></a> - ";
	total = total + desc;
	before = "";
	after = "";
	if ((expire.valueOf() - today.valueOf()) < 5 * 86400 * 1000) {
	before = "<span class=\"expdiscount\">";
	after = "</span>";
	}
	if ((expire.valueOf() - today.valueOf()) < 0) {
		month = 13;	
		day = "today";
	}
	if ((expire.valueOf() - today.valueOf()) > 0 && (expire.valueOf() - today.valueOf()) < 86400 * 1000) {
		month = 13;	
		day = "tomorrow";
	}
	total = total + " " + before + "(expires " + monthName(month - 1) + " " + day + ")" + after + "</p></li>";
	document.write(total);
}

function showShoeMallCoupon(sday,smonth,syear,day,month,year,code,discount,desc,linkname,couptype,red) {
	expire = new Date(year,month - 1,day);
	start = new Date(syear,smonth - 1,sday);
	today = new Date();
	if ((today.valueOf() > expire.valueOf() + 86400 * 1000) || today.valueOf() < start.valueOf()) { return 0; }
	total = "<li><p>";
	total = total + "<a ";
	if (linkname) { total = total + "name=\"" + linkname + "\" "; }
	total = total + "href=\"ShoeMall-Discount.php?discount=" + discount + "\" ";
	total = total + "target=\"_blank\" onClick=\"javascript: pageTracker._trackPageview('/outside/CJShoes');javascript:copyCode('" + code + "');\">";
	total = total + "<strong>" + code + "</strong></a> - ";
	if (couptype) { total = total + "<strong>" + couptype + " coupon</strong> - "; }
	total = total + desc;
	before = "";
	after = "";
	if ((expire.valueOf() - today.valueOf()) < 5 * 86400 * 1000) {
	before = "<span class=\"expdiscount\">";
	after = "</span>";
	}
	if ((expire.valueOf() - today.valueOf()) < 0) {
		month = 13;	
		day = "today";
	}
	if ((expire.valueOf() - today.valueOf()) > 0 && (expire.valueOf() - today.valueOf()) < 86400 * 1000) {
		month = 13;	
		day = "tomorrow";
	}
	total = total + " " + before + "(expires " + monthName(month - 1) + " " + day;
	if (red) { total = total + " or after " + red + " redemptions"; }
	total = total + ")" + after + "</p></li>";
	document.write(total);
}

function showEndlessCoupon(sday,smonth,syear,day,month,year,code,discount,desc,linkname,couptype,red) {
	expire = new Date(year,month - 1,day);
	start = new Date(syear,smonth - 1,sday);
	today = new Date();
	if ((today.valueOf() > expire.valueOf() + 86400 * 1000) || today.valueOf() < start.valueOf()) { return 0; }
	total = "<li><p>";
	total = total + "<a ";
	if (linkname) { total = total + "name=\"" + linkname + "\" "; }
	total = total + "href=\"Endless-Discount.php?discount=" + discount + "\" ";
	total = total + "target=\"_blank\" onClick=\"javascript: pageTracker._trackPageview('/outside/CJShoes');javascript:copyCode('" + code + "');\">";
	total = total + "<strong>" + code + "</strong></a> - ";
	if (couptype) { total = total + "<strong>" + couptype + " coupon</strong> - "; }
	total = total + desc;
	before = "";
	after = "";
	if ((expire.valueOf() - today.valueOf()) < 5 * 86400 * 1000) {
	before = "<span class=\"expdiscount\">";
	after = "</span>";
	}
	if ((expire.valueOf() - today.valueOf()) < 0) {
		month = 13;	
		day = "today";
	}
	if ((expire.valueOf() - today.valueOf()) > 0 && (expire.valueOf() - today.valueOf()) < 86400 * 1000) {
		month = 13;	
		day = "tomorrow";
	}
	total = total + " " + before + "(expires " + monthName(month - 1) + " " + day;
	if (red) { total = total + " or after " + red + " redemptions"; }
	total = total + ")" + after + "</p></li>";
	document.write(total);
}
