

function gup (name) {
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp(regexS);
  var results = regex.exec(window.location.href);
  if (results == null) {
    return "";
  } else {
    return results[1];
  }	
}

function show_purchase () {

 	if (gup("purchase").toLowerCase() == "yes")
		return 1;
	else
		return 0;

}

function compare_coupon () {
	
	if (gup("coupon").toLowerCase() == "wtd10")
		return 1;
	else
		return 0;
	
}

function coupon_message (sp, valid_cp) {
	
	if (sp) {
		if (valid_cp)
			return '<i>Purchase <strong>WidgetTD</strong> for Mac and Windows using a secure server from FastSpring, our e-commerce provider:</i><br><br><p style="color:#2554C7">Your version is out of date.  Please download the latest version of WidgetTD.</p>';
		else
			return '<i>Purchase <strong>WidgetTD</strong> for Mac and Windows using a secure server from FastSpring, our e-commerce provider:</i>';

	} else {
		return '<i>Purchase <strong>WidgetTD</strong> for Mac and Windows using a secure server from FastSpring, our e-commerce provider:</i>';

	}
}


function price_message (sp, valid_cp) {

	if (sp) {
		if (valid_cp)
			return '<p style="color:#2554C7"><i>promotional pricing now included in new low price</i></p>';
		else
			return '';

	} else {
		return '';

	}
}





function get_purchase_url () {

	return 'https://sites.fastspring.com/graybox/instant/widgettd';
	
}