function ShowOrHide(d1, d2) {
if (d1 != '') DoDiv(d1);
if (d2 != '') DoDiv(d2);
}

function DoDiv(id) {
var item = null;
if (document.getElementById) {
item = document.getElementById(id);
} else if (document.all){
item = document.all[id];
} else if (document.layers){
item = document.layers[id];
}
if (!item) {
}
else if (item.style) {
if (item.style.display == "none"){ item.style.display = ""; }
else {item.style.display = "none"; }
}else{ item.visibility = "show"; }
}

function check_uncheck_all(area) {
var frm = area;
for (var i=0;i<frm.elements.length;i++) {
var elmnt = frm.elements[i];
if (elmnt.type=="checkbox") {
if(frm.master_box.checked == true){ elmnt.checked=true; }
else{ elmnt.checked=false; }
}
}
if(frm.master_box.checked == true){ frm.master_box.checked = true; }
else{ frm.master_box.checked = false; }
}

function showpreview(image,name){
if (image != ""){
document.images[name].src = image;
} else {
document.images[name].src = "skins/images/blank.gif";
}
}

function insertext(open, close, area){
if (area == "short"){
	msgfield = document.form.contentshort
}
else if (area == "full") {
	msgfield = document.form.contentfull
}
else if (area == "" || !area) {
	msgfield = document.form.content
}
// IE support
if (document.selection && document.selection.createRange){
msgfield.focus();
sel = document.selection.createRange();
sel.text = open + sel.text + close;
msgfield.focus();
}

// Moz support
else if (msgfield.selectionStart || msgfield.selectionStart == "0"){
var startPos = msgfield.selectionStart;
var endPos = msgfield.selectionEnd;

msgfield.value = msgfield.value.substring(0, startPos) + open + msgfield.value.substring(startPos, endPos) + close + msgfield.value.substring(endPos, msgfield.value.length);
msgfield.selectionStart = msgfield.selectionEnd = endPos + open.length + close.length;
msgfield.focus();
}

// Fallback support for other browsers
else {
msgfield.value += open + close;
msgfield.focus();
}

return;
}

function setCookie(name, value){
document.cookie = name + "=" + value + "; path=/;" + " expires=Wed, 1 Jan 2020 00:00:00 GMT;";
}

function deleteCookie(name){
document.cookie = name + "=" + "; path=/;" + " expires=Sut, 1 Jan 2000 00:00:01 GMT;";
}

function insertimage(text, area){
if (area == "short"){
opener.document.forms['form'].contentshort.focus();
opener.document.forms['form'].contentshort.value += text;
opener.document.forms['form'].contentshort.focus();
}
else if (area == "full"){
opener.document.forms['form'].contentfull.focus();
opener.document.forms['form'].contentfull.value += text;
opener.document.forms['form'].contentfull.focus();
}
else if (area == "" || !area){
opener.document.forms['form'].content.focus();
opener.document.forms['form'].content.value += text;
opener.document.forms['form'].content.focus();
}
}

function confirmit(url, text){
	var agree = confirm(text);

	if (agree) {
		document.location=url;
	}
}

function changeDescr(caller,first,second){
if(caller.value == first){caller.value = second}
}
