function SubscribeWindow() {
	w_width = 550;
	w_height = 370;
	if (screen) {
		w_left = (screen.availWidth - w_width)/2;
		w_top = ((screen.availHeight - w_height)/2)-20;
	}
	theWindowParam = 'width='+w_width+',height='+w_height+',left='+w_left+',top='+w_top+',status=no,resizable=no,scrollbars=no';

	fparam = 'newsletter.php';
  window.SubWindow = open(fparam, 'SubWindow', theWindowParam);
	setTimeout('if(SubWindow&&!SubWindow.closed)SubWindow.focus()',100);
}
function ValidateSubscriptionForm (form) { // Used in Give us your feedback page (pageid=5&ctype=bm)
  var fname = form.fullname.value;   
  var email = form.email.value;   
  var scode = form.security_code.value;   

	if (ValidateStringLength(fname) == false) {
		alert("You must enter your fullname.");
		return false;
	} else if (ValidateStringLength(email) == false) {
		alert("You must enter your email.");
		return false;
	} else if ((email.indexOf('@') == -1) || (email.indexOf('.') == -1)) {
		alert("Wrong email format.");
		return false;
	} else if (ValidateStringLength(scode) == false) {
		alert("Type the code shown");
		return false;
	} else {
		return true;
	}
}
function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

function ValidateStringLength(theString) {
	var theTrimString = trim(theString);
	if (theTrimString.length == '0') {
		return false;	
	} else {
		return true;
	}	
}

