<!--
//
///////////////////////////////////////////////////////////////////////////
// form news //////////////////////////////////////////////////////////////
//
var isMozilla = (navigator.userAgent.toLowerCase().indexOf('gecko')!=-1) ? true : false
// linki ///////////////
function ahrefThis() {
if (isMozilla) {
  oField = document.getElementById('tekst')
	if (oField.selectionStart != oField.selectionEnd) {
	var strHref = prompt("adres strony czyli link:","http://")
	if (strHref == null) return;
		objectValue = oField.value
		objectValueDeb = objectValue.substring( 0 , oField.selectionStart )
		objectValueFin = objectValue.substring( oField.selectionEnd , oField.textLength )
		objectSelected = objectValue.substring( oField.selectionStart , oField.selectionEnd )
		oField.value = objectValueDeb+'<a href=\"' + strHref + '\" title=\"zobacz wiêcej\">'+objectSelected+"</a>"+objectValueFin
  } else {
   alert ("zaznacz tekst lub fragment tekstu...")
  }
} else {
  var str = document.selection.createRange().text
	var strHref = prompt("adres strony czyli link:","http://")
	if (strHref == null) return;
  if (document.selection.createRange().text) {
   var sel = document.selection.createRange()
   sel.text = '<a href=\"' + strHref + '\" title=\"zobacz wiêcej\">' +  str + '</a>'
  } else {
   alert ("zaznacz tekst lub fragment tekstu..")
  }
}
}
// cite ///////////////
function citeThis() {
if (isMozilla) {
  oField = document.getElementById('tekst')
	if (oField.selectionStart != oField.selectionEnd) {
		objectValue = oField.value
		objectValueDeb = objectValue.substring( 0 , oField.selectionStart )
		objectValueFin = objectValue.substring( oField.selectionEnd , oField.textLength )
		objectSelected = objectValue.substring( oField.selectionStart , oField.selectionEnd )
		oField.value = objectValueDeb+"<cite>"+objectSelected+"</cite>"+objectValueFin
  } else {
   alert ("zaznacz tekst lub fragment tekstu...")
  }
} else {
  var str = document.selection.createRange().text
  if (document.selection.createRange().text) {
   var sel = document.selection.createRange()
   sel.text = "<cite>" + str + "</cite>"
  } else {
   alert ("zaznacz tekst lub fragment tekstu..")
  }
}
}
// quote ///////////////
function quoteThis() {
if (isMozilla) {
  oField = document.getElementById('tekst')
	if (oField.selectionStart != oField.selectionEnd) {
		objectValue = oField.value
		objectValueDeb = objectValue.substring( 0 , oField.selectionStart )
		objectValueFin = objectValue.substring( oField.selectionEnd , oField.textLength )
		objectSelected = objectValue.substring( oField.selectionStart , oField.selectionEnd )
		oField.value = objectValueDeb+"<q>"+objectSelected+"</q>"+objectValueFin
  } else {
   alert ("zaznacz tekst lub fragment tekstu...")
  }
} else {
  var str = document.selection.createRange().text
  if (document.selection.createRange().text) {
   var sel = document.selection.createRange()
   sel.text = "<q>" + str + "</q>"
  } else {
   alert ("zaznacz tekst lub fragment tekstu..")
  }
}
}
// strong ///////////////
function strongThis() {
if (isMozilla) {
  oField = document.getElementById('tekst')
	if (oField.selectionStart != oField.selectionEnd) {
		objectValue = oField.value
		objectValueDeb = objectValue.substring( 0 , oField.selectionStart )
		objectValueFin = objectValue.substring( oField.selectionEnd , oField.textLength )
		objectSelected = objectValue.substring( oField.selectionStart , oField.selectionEnd )
		oField.value = objectValueDeb+"<strong>"+objectSelected+"</strong>"+objectValueFin
  } else {
   alert ("zaznacz tekst lub fragment tekstu...")
  }
} else {
  var str = document.selection.createRange().text
  if (document.selection.createRange().text) {
   var sel = document.selection.createRange()
   sel.text = "<strong>" + str + "</strong>"
  } else {
   alert ("zaznacz tekst lub fragment tekstu..")
  }
}
}
// em ///////////////
function emThis() {
if (isMozilla) {
  oField = document.getElementById('tekst')
	if (oField.selectionStart != oField.selectionEnd) {
		objectValue = oField.value
		objectValueDeb = objectValue.substring( 0 , oField.selectionStart )
		objectValueFin = objectValue.substring( oField.selectionEnd , oField.textLength )
		objectSelected = objectValue.substring( oField.selectionStart , oField.selectionEnd )
		oField.value = objectValueDeb+"<em>"+objectSelected+"</em>"+objectValueFin
  } else {
   alert ("zaznacz tekst lub fragment tekstu...")
  }
} else {
  var str = document.selection.createRange().text
  if (document.selection.createRange().text) {
   var sel = document.selection.createRange()
   sel.text = "<em>" + str + "</em>"
  } else {
   alert ("zaznacz tekst lub fragment tekstu..")
  }
}
}
// bold ///////////////
function boldThis() {
if (isMozilla) {
  oField = document.getElementById('tekst')
	if (oField.selectionStart != oField.selectionEnd) {
		objectValue = oField.value
		objectValueDeb = objectValue.substring( 0 , oField.selectionStart )
		objectValueFin = objectValue.substring( oField.selectionEnd , oField.textLength )
		objectSelected = objectValue.substring( oField.selectionStart , oField.selectionEnd )
		oField.value = objectValueDeb+"<b>"+objectSelected+"</b>"+objectValueFin
  } else {
   alert ("zaznacz tekst lub fragment tekstu...")
  }
} else {
  var str = document.selection.createRange().text
  if (document.selection.createRange().text) {
   var sel = document.selection.createRange()
   sel.text = "<b>" + str + "</b>"
  } else {
   alert ("zaznacz tekst lub fragment tekstu..")
  }
}
}
// italic ///////////////
function italicThis() {
if (isMozilla) {
  oField = document.getElementById('tekst')
	if (oField.selectionStart != oField.selectionEnd) {
		objectValue = oField.value
		objectValueDeb = objectValue.substring( 0 , oField.selectionStart )
		objectValueFin = objectValue.substring( oField.selectionEnd , oField.textLength )
		objectSelected = objectValue.substring( oField.selectionStart , oField.selectionEnd )
		oField.value = objectValueDeb+"<i>"+objectSelected+"</i>"+objectValueFin
  } else {
   alert ("zaznacz tekst lub fragment tekstu...")
  }
} else {
  var str = document.selection.createRange().text
  if (document.selection.createRange().text) {
   var sel = document.selection.createRange()
   sel.text = "<i>" + str + "</i>"
  } else {
   alert ("zaznacz tekst lub fragment tekstu..")
  }
}
}
//-->

