function timeOut() {
	window.setTimeout("history.back(-1);", 2000);
}

function insertBB(form, element, aTag, eTag) {
	var input = document.forms[form].elements[element];
	
	var scrollTop=input.scrollTop;
	
	input.focus();
	
	if(typeof document.selection != 'undefined') {
		var range = document.selection.createRange();
		var insText = range.text;
		range.text = aTag + insText + eTag;
		range = document.selection.createRange();
		if (insText.length == 0) {
			range.move('character', aTag.length + insText.length + eTag.length);
		} else {
			range.moveStart('character', aTag.length + insText.length + eTag.length);      
		}
		
		input.scrollTo(0, scrollTop);
	} else if(typeof input.selectionStart != 'undefined') {
		var start = input.selectionStart;
		var end = input.selectionEnd;
		var insText = input.value.substring(start, end);
		
		input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
		
		var pos;
		if (insText.length == 0) {
			pos = start + aTag.length + insText.length + eTag.length;
		} else {
			pos = start + aTag.length + insText.length + eTag.length;
		}
		
		input.selectionStart = pos;
		input.selectionEnd = pos;
	}
}

function changePhoto(id) {
	var photo=document.getElementById('mphoto');
	photo.src="images/photos/pic"+id+".jpg";
}
