/* 
author Customer Service <cs@traithep.com>
copyright Copyright (C) 2011, Traithep Consultant. All rights reserved.
*/

var baseurl = '/';

// count string occurance
String.prototype.count=function(s1) {
	return (this.length - this.replace(new RegExp(s1,"g"), '').length) / s1.length;  
};

function dodelete (module, id, extra)
{
	var rs = confirm('Delete?');
	if (rs) {
		if (extra != undefined)
			extra = '/'+extra;
		else
			extra = '';
		window.location = baseurl+"tcpanel/"+module+"/delete/"+id+extra;
	}
}

function mailValidate(email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   return reg.test(email);
}
