function CheckBrowser() {
	var browsername=navigator.appName;
	if (browsername.indexOf("Netscape")!=-1) {browsername="NS"}
	else
	{if (browsername.indexOf("Microsoft")!=-1) {browsername="MSIE"}
	else {browsername="N/A"}};
	if (navigator.userAgent.indexOf("Opera")!=-1) {browsername="N/A"}
	if (navigator.userAgent.indexOf("Safari")!=-1) {browsername="N/A"}
	if (navigator.userAgent.indexOf("Firefox")!=-1) {browsername="NS"}
	if (browsername=="N/A") {
		if (document.getElementById) {
		// this is the way the standards work
			var style2 = document.getElementById('browserwarn').style;
		style2.display = style2.display? "":"block";
		} else if (document.all) {
		// this is the way old msie versions work
			var style2 = document.all['browserwarn'].style;
			style2.display = style2.display? "":"block";
		} else if (document.layers) {
		// this is the way nn4 works
			var style2 = document.layers['browserwarn'].style;
			style2.display = style2.display? "":"block";
		}
	}
	if (browsername!="NS") {
		if (document.getElementById) {
		// this is the way the standards work
			var style2 = document.getElementById('browsernotff').style;
		style2.display = style2.display? "":"block";
		} else if (document.all) {
		// this is the way old msie versions work
			var style2 = document.all['browsernotff'].style;
			style2.display = style2.display? "":"block";
		} else if (document.layers) {
		// this is the way nn4 works
			var style2 = document.layers['browsernotff'].style;
			style2.display = style2.display? "":"block";
		}
	}
}

function settitletxt() {
	document.getElementById("titletxt").value="";
}
function setbodytxt() {
	document.getElementById("bodytxt").value="";
}

function showRecentPosts() {
    var sList = null;
	var x = (window.screen.availWidth - 473) / 2;
	var y = (window.screen.availHeight - 530) / 2;
	var features = ",left=" + x + ",top=" + y;
	self.name = 'mainWin';
	sList = window.open("action/accounts.cgi","listposts",'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=473,height=485' + features);
}

function showFlickr() {
	var whattab = window.document.whichtoolbarfm.whichtoolbar.options[window.document.whichtoolbarfm.whichtoolbar.selectedIndex].text;
	if (whattab != "html") {
		var sList = null;
		var x = (window.screen.availWidth - 630) / 2;
		var y = (window.screen.availHeight - 400) / 2;
		var features = ",left=" + x + ",top=" + y;
		self.name = 'mainWinFR';
		sList = window.open("action/flickr_getphotos.cgi","showflickr",'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=630,height=400' + features);
	} else {
		alert("Sorry you can't insert photos from the Text/HTML view. Select either the Standard, Advanced or Customize tab first.");
	}
}

function showYouTube() {
	var whattab = window.document.whichtoolbarfm.whichtoolbar.options[window.document.whichtoolbarfm.whichtoolbar.selectedIndex].text;
	if (whattab != "html") {
		var sList = null;
		var x = (window.screen.availWidth - 630) / 2;
		var y = (window.screen.availHeight - 580) / 2;
		var features = ",left=" + x + ",top=" + y;
		self.name = 'mainWinYT';
		sList = window.open("action/youtube_getvideos.cgi","showyoutube",'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=630,height=580' + features);
	} else {
		alert("Sorry you can't insert video from the Text/HTML view. Select either the Standard, Advanced or Customize tab first.");
	}
}

function ShowAboutTags() {
	var showwin = window.open('abouttags.htm', 'abouttags', 'width=582, height=440, resizable=yes');
}

function openAndReturnPopup(href, window_name, width, height, is_resizable, show_scrollbars, centered) {
    if (!window_name || window_name == "") window_name = "popup";
    window_name = window_name.replace(/ /g, "_"); // ... window_name must not contain spaces
    var features = '';
    if (is_resizable) {
        features += ',resizable=yes'
    } else {
        features += ',resizable=no'
    }
    if (show_scrollbars) {
        width = parseInt(width) + 16; // ... the vertical scrollbar does need some place for itself
        features += ',scrollbars=yes'
    } else {
        features += ',scrollbars=no'
    }
        features += ',menubar=no'
        features += ',status=no'
    if (centered) {
        var x = (window.screen.availWidth - width) / 2;
        var y = (window.screen.availHeight - height) / 2;
	    features += ",left=" + x + ",top=" + y;
    }
    features += ',toolbar=no';
    features = 'width=' + width + ',height=' + height + features + ',dependent=yes,location=no,directories=no';
    var popup = window.open(href, window_name, features);
    popup.focus();
    return popup;
}

function openPreviewWindow() {
	var c = tinyMCE.getContent();
	window.document.previewfm.post.value = c;
	window.document.previewfm.previewtitle.value = window.document.previewfm.posttitle.value;
	var x = (window.screen.availWidth - 575) / 2;
	var y = (window.screen.availHeight - 590) / 2;
	var features = ",left=" + x + ",top=" + y;
	var preview_window = null;
	if ("fail2" == "fail") {
		return false;
	} else {
		preview_window = window.open('/action/preview.cgi','myPreWindow','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=565,height=590' + features);
	}
}

function showWindow(gotarget) {
    var sWin = null;
	self.name = 'mainWin';
	var x = (window.screen.availWidth - 630) / 2;
	var y = (window.screen.availHeight - 500) / 2;
	var features = ",left=" + x + ",top=" + y;
	sWin = window.open(gotarget, "theWindow",'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=630,height=500' + features);
}

function hov(loc,cls){
	if(loc.className)
    	loc.className=cls;
}

function logme(what) {
     if (what == "out") {
        var answer;
        var sList = null;
        answer = confirm("Are you sure you want to logout? It will remove all your account settings.");
        if (answer !=0) {
            //Yes logout...
            self.name = 'mainWin';
            sList = window.open("action/logout.cgi?logout=true&account=all", "logout", "width=250, height=150, resizable=yes");
        }
     //Else Login...
     } else {
        var x = (window.screen.availWidth - 473) / 2;
        var y = (window.screen.availHeight - 530) / 2;
        var features = ",left=" + x + ",top=" + y;
        self.name = 'mainWin';
        sList = window.open("action/accounts.cgi","listposts",'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=473,height=485' + features);
     }
}
function PreviewPage(thecontent) {
	var c = tinyMCE.getContent();
	window.document.previewfm.post.value = c;
	window.document.previewfm.previewtitle.value = window.document.previewfm.posttitle.value;
	return true;
}