
function InsertFlash(src, width, height) { 
    document.writeln("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"" + width + "\" height=\"" + height + "\">");
    document.writeln("    <param name=\"movie\" value=\"" + src + "\" />");
    document.writeln("    <param name=\"quality\" value=\"high\" />");
    document.writeln("    <param name=\"wmode\" value=\"opaque\" />");
    document.writeln("    <embed src=\"" + src + "\" quality=\"high\" wmode=\"opaque\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\"></embed></object>");
}


function initInputControl() {
    if (document.getElementById('info_email')) {
        document.getElementById('info_email').onclick = function() {
            if (this.value=='váš@email') {
                this.value = '';
            }
        }
    }
    if (document.getElementById('info_email2')) {
        document.getElementById('info_email2').onclick = function() {
            if (this.value=='váš@email') {
                this.value = '';
            }
        }
    }
}

function addLoadEvent( func ) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}

addLoadEvent(initInputControl);

	function storeCaret (textEl) {
		if (textEl.createTextRange) 
			textEl.caretPos = document.selection.createRange().duplicate();
	}	
	
	function insertAtCaret (textEl, text) {
		if (textEl.createTextRange && textEl.caretPos) {
			var caretPos = textEl.caretPos;
			caretPos.text =	caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
		}
		else if(document.getElementById && !document.all) {
		  textEl.value  += text;  
		 }
		else {
		 alert("Před kliknutím na \"smajlík\" umístěte kurzor do textu Vašeho příspěvku");
		}
	}
	
	function insertAt2Caret (textEl, text, odkaz) {
		odkaz=odkaz*1;
		if(odkaz==0) {
		  alert("Do textového pole zadejte číslo příspěvku, na který chcete odkazovat");
				document.vlozit.odkazprispevek.focus();
		}
		else if (textEl.createTextRange && textEl.caretPos) {
			var caretPos = textEl.caretPos;
			caretPos.text =	caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
		}
		else if(document.getElementById && !document.all) {
		  textEl.value  += text;  
		}
		else {
		 alert("Umístěte kurzor do textu Vašeho příspěvku");
		}
	}	
