function redirect(url) {
	window.location.href=url;
}
function confirmRedirect(url, message, url2) {
	if (window.confirm(message)) {
		redirect(url);
	} else if (url2) {
		redirect(url2);
	}
}
function showWindow(windowURL, width, height, namePrefix) {
	if (!width) {
		width = 550;
	} else {
		width = parseInt(width);
	}
	if (!height) {
		height = 350;
	} else {
		height = parseInt(height);
	}
	if (!namePrefix) {
		namePrefix = '';
	}
	var popUp = window.open(windowURL, 'event_window'+namePrefix, 'status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,scrollbars=1,width='+width+',height='+height); 
	popUp.moveTo(screen.width/2-width/2, screen.height/2-height/2);
}
function roundNumber(number, precision) {
	if (!precision) {
		precision = 2;
	}
	if (number > 8191 && number < 10485) {
		number = number-5000;
		var newnumber = Math.round(number*Math.pow(10,precision))/Math.pow(10,precision);
		newnumber = newnumber+5000;
	} else {
		var newnumber = Math.round(number*Math.pow(10,precision))/Math.pow(10,precision);
	}
	return newnumber;
}
function strRepeat(str, number) {
	res = new String();
	number = parseInt(number);
	var i;
	for (i = 0; i < number; i++) {
		res += str;
	}
	return res;
}
function arrayHasValue(needle,haystack) {
	for (var i = 0; i < haystack.length; i++) {
		if (needle == haystack[i]) { 
			return true; 
		}
	}
	return false;
}
function strCmpWords (strTC, strCW) {
	var i,j;
	strTC = strTC.toLowerCase();
	strCW = strCW.toLowerCase();
	strTC = strTC.replace(/\s+/g, ' ', strTC);
	strCW = strCW.replace(/\s+/g, ' ', strCW);
	var  wordsTC = strTC.split(' ')
		,wordsCW = strCW.split(' ');
	for (i in wordsTC) {
		if (!arrayHasValue(wordsTC[i], wordsCW)) {
			return false;
		}
	}
	return true;
}
function trim(string) {
	return string.replace(/(^\s+)|(\s+$)/g, '');
}
function isEmail(str) {
	///^[a-z]{1}[a-z\d\._]*\@([a-z\d\-]+\.)+[a-z]{2,4}$/i
	return str.match(/^[a-z]{1}[a-z\d\._]*\@([a-z\d\-]+\.)+[a-z]{2,4}$/i);
}
