
	function frameLogout(){
		window.location='index.php';
	}
	
	function memberValidateForm(frm){
		if(frm.username.value=='') {
			alert('Please fill in your username');
			frm.username.focus();
			return false;
		}
		if(frm.password.value=='') {
			alert('Please fill in your password');
			frm.password.focus();
			return false;
		}
		return true;
	}
	
	function couponValidateForm(frm, islogin, numCoupon, numDownload){
		if(islogin=='') {
			alert('Please login before adding this coupon to your cart.');
			return false;
		}
		if((parseInt(numCoupon)-parseInt(numDownload))<=0) {
			alert('Due to popularity of the coupon you just selected, the number of coupons is fully downloaded.\n Sorry for any inconvenience, please continue to browse for other coupons. Thank you!');
			return false;
		}
		return true;
	}
	
	function getHelp(helpType){
		var content = "";
		if (helpType=="selectbusiness") {
			content += "<span class='label'>Select Business</span><br>";
			content += "<span class='value'>";
			content += "Your coupon is associated with a single business name. If you define multiple locations for that business, ";
			content += "then this coupon will apply to all of those locations. If you want separate coupons per location define each ";
			content += "as a separate business in the Account section.";
			content += "</span>";
		} else if (helpType=="categprim") {
			content += "<span class='label'>Select a Coupon Category</span><br>";
			content += "<span class='value'>";
			content += "Users can find coupons by searching or clicking through a hierarchy of categories. ";
			content += "Please select a category that best fits your coupon. ";
			content += "</span>";
		} else if (helpType=="categsec") {
			content += "<span class='label'>Select a Secondary Coupon Category</span><br>";
			content += "<span class='value'>";
			content += "Users can find coupons by searching or clicking through a hierarchy of categories.";
			content += "</span>";
		} else if (helpType=="couponname") {
			content += "<span class='label'>Coupon Name</span><br>";
			content += "<span class='value'>";
			content += "This is the most important part to get customer attention. You must put an attractive coupon name, for example: \"BUY 1 GET 1 FREE\", \"50% discount for first order\", etc.. ";
			content += "</span>";
		} else if (helpType=="typeofcoupon") {
			content += "<span class='label'>Type of Coupon</span><br>";
			content += "<span class='value'>";
			content += 'If the user must print the coupon to redeem it, select "Printed". If they simply click a link and get the deal at ';
			content += 'your webstore, select "Webstore".';
			content += "</span>";
		} else if (helpType=="url") {
			content += "<span class='label'>URL</span><br>";
			content += "<span class='value'>";
			content += 'When a user clicks on your coupon, they will go to the URL entered here. Please point directly to the page for the item referenced in the coupon, not your main webpage. ';
			content += 'Ideally, your URL should pass the discount information to your webstore, making the discount automatic. Otherwise, your coupon should include a coupon code in the description field.';				
			content += "</span>";
		} else if (helpType=="distribution") {
			content += "<span class='label'>Distribution</span><br>";
			content += "<span class='value'>";
			content += 'Do you want your coupon available nationally or locally. Webstores will probably want "National" distribution, ';
			content += 'but if you serve a local community, select "Local". If you have a restaurant in Kuala Lumpur only, ';
			content += "you don't want your coupon to show up in Selangor. If you have multiple locations for a business, ";
			content += 'it will show up in each location under the "Local" option.';
			content += "</span>";
		} else if (helpType=="campaigndate") {
			content += "<span class='label'>Coupons Start Date / End Date</span><br>";
			content += "<span class='value'>";
			content += "You can create coupons that start in the future. They won't become visible until their start date. ";
			content += "The end date is printed on the coupon. Not having an end date can create the nightmare of an eternal coupon¡­use an end date.";
			content += "</span>";
		} else if (helpType=="availability") {
			content += "<span class='label'>Availability</span><br>";
			content += "<span class='value'>";
			content += 'Do you want to limit how many times a consumer can use your coupon? Then select "Limited Use". ';
			content += "This way you can offer a great deal to get people to try your products/services without having them get that deal every single time. ";
			content += "We then limit how many times each individual can see the coupon. When the coupon is no longer available to that individual, ";
			content += 'they will no longer see it. But, we strongly recommend offering a coupon of less value that is "Always Available" to encourage regular users to keep coming back.';
			content += "</span>";
		} else if (helpType=="daysvalid") {
			content += "<span class='label'>How Soon After Printing Should This Coupon Expire</span><br>";
			content += "<span class='value'>";
			content += "While you¡¯ve already defined an end date for the campaign, you might want more control over the very valuable limited use coupons. ";
			content += "Otherwise unscrupulous people could make copies of them and try to use them regularly. So we can create an expiration date, ";
			content += "for each individual coupon, based upon when they print it. For example you might want to give them a 1 week window to use the coupon from ";
			content += "when they open/print it.";
			content += "</span>";
		} else if (helpType=="smstype") {
			content += "<span class='label'>Why we need your mobile number here?</span><br>";
			content += "<span class='value'>";
			content += "After you registered with our system, we also provided SMS coupons to send to you. You might want to get very valuable limited coupons without download/print it.";
			content += "</span>";
		} else if (helpType=="numofusage") {
			content += "<span class='label'>How many coupons can be download/printed?</span><br>";
			content += "<span class='value'>";
			content += "After you created coupon with our system, system will allow certain number of coupons being download/print it.";
			content += "</span>";
		}
		return content;
	}
	
	function printpage() {
		window.print();  
	}
