/**
  * BLOG:CMS - http://blogcms.com
  * Copyright (C) 2003-2004 Radek HULAN
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
  * (see nucleus/documentation/index.html#license for more info)
  *
  * This file contains functions to allow adding items from inside the weblog.
  * Also contains code to avoid submitting form data twice.
  */

var local = document.URL.substring(0,document.URL.lastIndexOf('/'));
var exception = "";
var destinationFrame = "_blank";

function setOpenNewWindow(newWin) {
	if (newWin) {
		from = ""; to = destinationFrame;
	} else {
		from = destinationFrame; to = "";
	}

	for (var i=0; i<=(document.links.length-1); i++) {
		if (document.links[i].target == from) {

			var href = document.links[i].href;
			var isLocal = (href.indexOf(local) != -1);
			if (isLocal && ((exception=="") || (href.indexOf(exception) != -1)))
				isLocal = false;
			if (!isLocal)
				document.links[i].target = to;
		}
	}
}