var cmap_domain = document.domain;
var cmap_fullUrl = window.location.toString().split('?')[0];
var hexcolor = "^([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$";
var cmap_widgetCode = [];
cmap_widgetCode.push('<iframe scrolling="0" frameborder="0" marginheight="0" marginwidth="0" src="http://www.couponmap.com/iframe/');
if (typeof(cmap_lat) == 'number' && typeof(cmap_lng) == 'number') {
	cmap_widgetCode.push(cmap_lat + '/' + cmap_lng);
}
cmap_widgetCode.push('/?');
if (typeof(cmap_width) == 'number' && cmap_width <= 2000) cmap_widgetCode.push('&width=' + cmap_width.toString());
if (typeof(cmap_height) == 'number' && cmap_height <= 2000) cmap_widgetCode.push('&height=' + cmap_height.toString());
if (typeof(cmap_showSearch) == 'boolean' && cmap_showSearch) {
	cmap_widgetCode.push('&search=true');
}
if (typeof(cmap_borderWidth) == 'number' && typeof(cmap_borderColor) == 'string' && cmap_borderColor.match(hexcolor)) {
	cmap_widgetCode.push('&border=' + cmap_borderWidth.toString());
	cmap_widgetCode.push('&borderColor=' + cmap_borderColor.toString());
}
cmap_widgetCode.push('&domain=' + cmap_domain);
cmap_widgetCode.push('&fullUrl=' + cmap_fullUrl);
cmap_widgetCode.push('" style="overflow:hidden;');
if (typeof(cmap_width) == 'number' && cmap_width <= 2000) { 
	cmap_widgetCode.push('width:' + cmap_width.toString() + 'px;');
} else {
	cmap_widgetCode.push('width:420px;');
}
if (typeof(cmap_height) == 'number' && cmap_height <= 2000) {
	cmap_widgetCode.push('height:' + cmap_height.toString() + 'px;');
} else {
	cmap_widgetCode.push('height:300px;');
}
cmap_widgetCode.push('"></iframe>');
document.write(cmap_widgetCode.join(''));
