WKT = function() { };
WKT.prototype = {
	init: function() {
		if (!(BrowserDetect.browser == 'Explorer' && BrowserDetect.version <= 6)) {
			if (typeof sIFR == "function") {
				sIFR.replaceElement(named({sSelector:"h2", sFlashSrc:"swf/futuri.swf", sColor:"#451e0d"}));
				sIFR.replaceElement(named({sSelector:"h3", sFlashSrc:"swf/futuri.swf", sColor:"#451e0d"}));
				sIFR.replaceElement(named({sSelector:"h4", sFlashSrc:"swf/futuri.swf", sColor:"#451e0d"}));
				sIFR.replaceElement(named({sSelector:"p.h4", sFlashSrc:"swf/futuri.swf", sColor:"#451e0d"}));
				sIFR.replaceElement(named({sSelector:"h5", sFlashSrc:"swf/futuri.swf", sColor:"#451e0d"}));
			}
		}
		var dtm = new Date();
		var spn = $get('spnCopyrightYear');
		if (spn) spn.innerHTML = dtm.getFullYear();
	},
	
	validateForm: function() {
		var blnOK = true;
		this.showElement($get('divError_Name'), false);
		this.showElement($get('divError_Email'), false);
		this.showElement($get('divError_EmailRepeat'), false);
		this.showElement($get('divError_EmailNotMatch'), false);
		this.showElement($get('divErrorSummary'), false);
		if (!this.checkEntered($get('txtName'))) {
			blnOK = false;
			this.showElement($get('divError_Name'), true);
		}
		if (!this.checkEntered($get('txtEmail'))) {
			blnOK = false;
			this.showElement($get('divError_Email'), true);
		}
		if (!this.checkEntered($get('txtEmailRepeat'))) {
			blnOK = false;
			this.showElement($get('divError_EmailRepeat'), true);
		}
		if ($get('txtEmail').value != $get('txtEmailRepeat').value) {
			blnOK = false;
			this.showElement($get('divError_EmailNotMatch'), true);
		}
		if (!blnOK) {
			this.showElement($get('divErrorSummary'), true);
			document.location.href = document.location.href.replace("#regform", "") + "#regform";
		}
		return blnOK;
	},
	
	checkEntered: function(el) {
		if (!el) return;
		return (el.value != '');
	},
	
	showElement: function(el, bln) {
		if (!el) return;
		if (bln) {
			el.className = el.className.replace('invisible', '');
		} else {
			if (el.className.indexOf('invisible') < 0) el.className += ' invisible';
		}
	},
	
	updateEBookPriceAfterCurrencyChange: function(ddl, strBook) {
		var spnAmount = $get("spnAmount_" + strBook);
		if (spnAmount) spnAmount.innerHTML = ddl.options[ddl.selectedIndex].getAttribute("price");
		var hidAmount = $get("hidAmount_" + strBook);
		if (hidAmount) hidAmount.value = ddl.options[ddl.selectedIndex].getAttribute("price");
		spnAmount = null;
		hidAmount = null;
	}
	
}
$WKT = new WKT();
$get = function(strID) {
	return document.getElementById(strID);
};