function OpenSite(strURL) {
	if (strURL.indexOf("http://www.soundonsound.com") == -1) {
		if (parseInt(navigator.appVersion) > 3) {
			if (navigator.appName == "Netscape") {
				intWidth = window.innerWidth;
				intHeight = window.innerHeight;
			 }
			if (navigator.appName.indexOf("Microsoft") != -1) {
			 	intWidth = document.body.offsetWidth;
	 			intHeight = document.body.offsetHeight;
			}
		}
		intHeight  *= 0.8;
		intWidth *= 0.8;
		window.open('/Redirect.php?newurl=' + strURL, 'window002', 'scrollbars=yes,location=yes,status=yes,resizable=yes,toolbar=yes,menubar=yes,height=' + intHeight + ',width=' + intWidth, true);
	} else {
		// Remove http:// if required
		if (strURL.indexOf("http://") == 0) {
			strURL = strURL.substr(7, 1000);
			strURL = strURL.substr(strURL.indexOf('/'), 1000);
		}
		location.href = strURL;
	}
}

function formatCurrency(number, showSymbol) {
	number = number.toString();

	if (number.length == 0 || number == '0') return 0;

	if (number.length == 2) number = '0' + number;
	if (number.length == 1) number ='00' + number;

	return (showSymbol ? currency : '') + number.substring(0, number.length - 2) + "." + number.substring(number.length - 2);
}

function reloadcaptcha() {
	var now = new Date();
	document.getElementById('captcha').src = '/captcha/captchac_code.php?' + now.getTime();
}

function SendEmail(strAddress) {
	var keep = window.location.search;

	if (keep != '') keep = keep + '&'
	else keep = '?';

	var strURL = "/Contact.php" + keep + "email=" + strAddress + "&subject=" + window.document.title;
	window.location.href = strURL;
}

function SwitchLang(lang) {
	var strURL = location.href;
	if ((intPos = strURL.indexOf("Lang=")) > -1) {
		strURL = strURL.substr(strURL, intPos + 5) + lang;
	} else {
		strURL += "&Lang=" + lang;
	}

	location.href=strURL;
}

function SwitchNav(ver) {
	var strURL = location.href;
	if ((intPos = strURL.indexOf("Dhtml=")) > -1) {
		strURL = strURL.substr(strURL, intPos + 6) + ver;
	} else {
		if ((intPos = strURL.indexOf("#")) > -1) {
			strURL = strURL.substr(0, intPos) + "&Dhtml=" + ver + strURL.substr(intPos, strURL.length - (intPos));
		} else {
			strURL += "&Dhtml=" + ver;
		}
	}
	location.href=strURL;
}

function stripHTML (st) {
	return st.replace(/(<([^>]+)>)/ig, "");
}

function trim(st) {
	var len = st.length;
	var begin = 0, end = len - 1;
	while (st.charAt(begin) == " " && begin < len) {
		begin++;
	}
	while (st.charAt(end) == " " && begin < end) {
		end--;
	}
	return st.substring(begin, end+1);
}

function wordCount(st) {
	st += ' ';
	var wordcount = st.split(' ');
	var wordcount2 = 0;

	for (var i = 0; i < wordcount.length - 1; i++) {
		if (trim(wordcount[i]) != '') wordcount2++;
	}
	return wordcount2;
}