function submitIntoNewWindow(formular) {
	if (formular.captcha!=null) {
		if (formular.captcha.value.length>0) {
			openWindow("?captcha="+ escape(formular.captcha.value));
			tempDisable("capsubmit");
		}
		doSelect(formular.captcha);
	} else if (formular.comment!=null) {
		if (formular.comment.value.length>0) {
			tempDisable("comsubmit");
			doSubmitten(formular)
		} else {
			doSelect(formular.comment);
		}
	} else {
		doSubmitten(formular);
	}
	return false;
}

function doSubmitten(formular) {
	openWindow("");
	theFormular = formular;
	setTimeout("theFormular.submit();",100);
}

function openWindow(url){
	theWindow = window.open("about:blank",'_swfloopsWW','width=600,height=250,resizable=yes,scrollbars=yes,top='+(screen.availHeight/2-125)+',left='+(screen.availWidth/2-300));
	if (url!='') {
		theUrl = url;
		setTimeout("theWindow.location.href = theUrl;",100);
	}
	return false;
}

function enable(knappID) {
	GEBI(knappID).disabled = false;
}

disableCnt = 0;
function tempDisable(knappID) {
	disableCnt++;
	GEBI(knappID).disabled = true;
	setTimeout("if (disableCnt=="+disableCnt+"){enable('"+knappID+"');}", 4000);
}

function doSelect(falt) {
	falt.select();
}

function selectASAP(faltID) {
	if (GEBI(faltID)!=null && GEBI(faltID)!=undefined) {
		for (i=1; i<=3; i++){
			setTimeout("if (GEBI('"+faltID+"').value==''){doSelect(GEBI('"+faltID+"'));}", i*150);
		}
	} else {
		setTimeout("selectASAP('"+faltID+"');", 100);
	}
}

function GEBI(X) {
	return document.getElementById(X);
}

function wwNeedCaptcha() {
	wwI=0;
	wwCnt=0;
	wwSpinTitle();
	setTimeout("window.focus();",500);
	selectASAP('field');
}

function wwSpinTitle() {
	document.title = Array('> ','>> ','')[wwI++]+'Need Captcha';
	wwI=wwI>2?0:wwI;
	wwCnt++;
	if (wwCnt==15){
		alert('You need to type in a captcha.');
	}
	setTimeout("if (wwI!=9){wwSpinTitle();}", 500);
}

function wwAge() {
	setTimeout("document.title='(old) '+document.title;", 12500);
}

function wwNewCaptcha() {
	setTimeout("window.focus();", 500);
	alert('Incorrect captcha.\n\nNotice: A new captcha has been generated for you.\n\n**IMPORTANT** To see the new one you have to refresh the page with the old captcha.');
}

function quote(postNr) {
	c = GEBI("cmnt");
	c.value += ">>"+postNr+"\r\n";
	c.focus();
	r = c.createTextRange();
	r.moveStart("character", c.value.length);
	r.select();
}

function setO() {
	obj = window.document.emfl;
}

function setFlashSize(width, height) {
	if (!foff) {
		setO();
		if (width!='') {
			obj.style.width = width;
		}
		if (height!='') {
			obj.style.height = height;
		}
	}
}

function changeFlashSize(breddRiktning, hojdRiktning) {
	if (!foff) {
		setO();
		wW = ""+ obj.style.width;
		hH = ""+ obj.style.height;
		if (wW.indexOf('%')!=-1) {
			wW = (document.body.clientWidth-172)*(wW.replace("%", "")/100);
		} else {
			wW = wW.replace("px", "")*1;
		}

		if (hH.indexOf('%')!=-1) {
			hH = 660*(hH.replace("%", "")/100);
		} else {
			hH = hH.replace("px", "")*1;
		}

		wW = Math.round(wW*(1+(0.15*breddRiktning)));
		hH = Math.round(hH*(1+(0.15*hojdRiktning)));
		setFlashSize(wW+'px', hH+'px');
	}
}

foff = false;
function flashOff() {
	if (!foff) {
		foff = true;
		GEBI("econt").innerHTML='<div id="mssg">(flash off)</div>';
	}
}

function flashMake550x400() {
	setFlashSize('550px', '400px');
}

function flashResetSize() {
	setFlashSize('100%', '100%');
}

function flashGrow() {
	changeFlashSize(1, 1);
}

function flashShrink() {
	changeFlashSize(-1, -1);
}

function flashWiden() {
	setFlashSize('100%', '350px');
}

function flashHeighten() {
	setFlashSize('350px', '100%');
}

function wwTimeoutDL(){
	setTimeout("GEBI('dllink').innerHTML='<i>The link has timed out, press F5 to get a new one.</i>';", 60000);
}