var format="HTML";
var LastImageUrl="http://";
var LastMailAddr="";

var mode = "html";
var xmode = "html";

function swappMode() {
if (xmode != "text") {

frames.Editor.document.body.innerText = frames.Editor.document.body.innerHTML;
formatToolbar.style.display = "none";
xmode = "text";
} else {
frames.Editor.document.body.innerHTML = frames.Editor.document.body.innerText;
formatToolbar.style.display = "";
xmode = "html";
}
frames.Editor.focus();
}

function potvrd(text,cil){

	ano = window.confirm(text);
	
		if(ano) 
		window.location.href = cil;
	
};


function presmerujNa(cil){

	
	window.location.href = cil;


};	
	


function DoCommand(Par1,seeUI,Par2)
{
frames.Editor.document.body.focus()
var s=frames.Editor.document.selection.createRange()
s.execCommand(Par1,seeUI,Par2)
s.select()
frames.Editor.document.body.focus()
}

function ExtMail()
{
var adr
var Text=Editor.document.selection.createRange().text
adr=prompt("Zadejte správnou e-mailovou adresu.",LastMailAddr);
LastMailAddr=adr
if (Text=="") {
  Text=adr
}
frames.Editor.document.body.focus()
if (adr!="" && adr!="http://"&& adr!=null) {
Editor.document.selection.createRange().pasteHTML('<a href="mailto:' + adr + '">' + Text + '</a>')
}
}

function ExtBig()
{
var Text=Editor.document.selection.createRange().text
if (Text!="") {
  frames.Editor.document.body.focus()
  Editor.document.selection.createRange().pasteHTML('<big>' + Text + '</big>')
}
}

function ExtSmall()
{
var Text=Editor.document.selection.createRange().text
if (Text!="") {
frames.Editor.document.body.focus()
Editor.document.selection.createRange().pasteHTML('<small>' + Text + '</small>')
}
}

function ExtMarq()
{
var adr
var Text=Editor.document.selection.createRange().text
adr=prompt("Zadejte běžící text",Text)
frames.Editor.document.body.focus()
if (adr!="" && adr!=null) {
  Editor.document.selection.createRange().pasteHTML('<blink><marquee>' + adr + '</marquee></blink>')
}
}

function ExtMedia()
{
  var adr
  adr=prompt("Zadejte adresu multimediálního obsahu","http://")
  frames.Editor.document.body.focus()
  if(adr!="" && adr!=null) {
	Editor.document.selection.createRange().pasteHTML('<embed src="' + adr + '" autostart="false"><noembed><a href="' + adr + '">Download</a></noembed></embed>')
  }
}

function SendData()
{

if (xmode != "html") {
	frames.Editor.document.body.innerHTML = frames.Editor.document.body.innerText;
}
var HTML
if(typeof(window.document.forms.form1.NET)== 'object')
	{
	HTML=frames.Editor.document.body.innerHTML
	if(HTML=="" || HTML=="<P>&nbsp;</P>") {
      	alert("Zadejte tělo příspěvku !")
		frames.Editor.document.body.focus()
		return false
	}
	else	{
		document.all.ID.value=HTML
	}
}
else	{
	if(window.document.forms.form1.body.value=="")	{
		alert("Zadejte tělo příspěvku !")
		window.document.form1.body.focus()
		return false
	}
}
}

function goTo(cil){
  window.location.href = cil;
}	

var add_smile = function(t) {
  document.addmessage.text.value+= '' + t + ''; 
}


var switchImage = function(imgId, imgUrl) {
  var img = document.getElementById(imgId);
  img.style.backgroundImage = "url('"+imgUrl+"')" ; 
}

var switchImageBack = function(imgId, imgUrl) {

  var x = document.getElementById(imgId);
  x.style.backgroundImage="url("+imgUrl+")";
}
