
//isNS4 = (document.layers) ? true : false;
//isIE4 = (document.all && !document.getElementById) ? true : false;
//isIE5 = (document.all && document.getElementById) ? true : false;
//isNS6 = (!document.all && document.getElementById) ? true : false;
isGecko = false;
if(navigator){
	if(navigator.userAgent){
		if(navigator.userAgent.indexOf("Gecko/") != -1){
			isGecko = true;
		}
	}
}


function changeDisplay(id) {
	var tb = xoopsGetElementById(id);

	if (tb.style.display == 'none' ) {
		tb.style.display = 'block';
	} else {
		tb.style.display = 'none';
	}
}


function confirmDelete() {
	if (window.confirm('"削除してもよろしいですか？"')) {
		return true;
	} else {
		return false;
	}
}

function confirmAuth() {
	if (window.confirm('"承認してもよろしいですか？"')) {
		return true;
	} else {
		return false;
	}
}

function openWithSelfMain(url, name, width, height, returnwindow) {
    var options = "width=" + width + ",height=" + height + "toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=no,left=" + (window.screen.width - width);
    new_window = window.open(url, name, options);
    window.self.name = "main";
    new_window.document.clear();
    new_window.focus();
    if (returnwindow != null) {
        return new_window;
    }
}


function insertStr(e, str) {
    if(document.selection) {
        e.focus();
        var r = document.selection.createRange();
        r.text = str;
        e.focus();
    } else if(isGecko){
		var start = e.selectionStart;
		var head = e.value.substring(0, start);
		var foot = e.value.substring(start, e.textLength);
		e.value = head + str + foot;
	} else {
		e.value = e.value + str;
	}
}


