
var popupwin = null;

function openbookmarkwindow()
{
	if(BOOKMARK_URL != undefined)
	{
		if(BOOKMARK_URL != "")
		{
			openpopupwindow(BOOKMARK_URL);
		}
		else
		{
			alert("Not currently a book markable page");
		}
	}
}

function bookmarksite(title,url){
if (window.sidebar)
{
	 window.sidebar.addPanel(title, url, "");
}
else if(window.opera && window.print)
{
	var element = document.createElement('a');
	element.setAttribute('href',url);
	element.setAttribute('title',title);
	element.setAttribute('rel','sidebar');
	element.click();
} 
else if(document.all)
	window.external.AddFavorite(url, title);
}

function openpopupwindow(url)
{
	closepopupwindows();
	window.name = "rdssearchform";
	popupwin = window.open(url, 'rdslist',
		'height=500, width=1044, scrollbars=yes, directories=no, location=no, menubar=no, toolbar=no, status=no, resizable=yes');
}

function closepopupwindows()
{
	if(popupwin && !popupwin.closed)
	{
		popupwin.close();
	}	
}

function setformtargets()
{
	var theform = getElementById("journallookupform");
	if (theform)
	{
		theform.target = window.opener.name;
	}
	var siccodehrefs = document.getElementsBySelector("a.code");
	for (var i = 0; i < siccodehrefs.length; i++)
	{
		siccodehrefs[i].target = window.opener.name;
	}
}

function launchprint()
{
	closepopupwindows();
	window.name = "rdssearchform";
	popupwin = window.open('', 'rdslist',
		'width=1044, scrollbars=yes, directories=no, location=no, menubar=no, toolbar=no, status=no, resizable=yes');
	var theform = getElementById("resultsform");
	var thevar = getElementById("resultsaction");
	if (thevar)
		thevar.value="print";
	if (theform)
	{
		theform.target = popupwin.name;
		theform.submit();
	}
}

function launchemail()
{
	closepopupwindows();
	window.name = "rdssearchform";
	popupwin = window.open('', 'rdslist',
		'width=1044, scrollbars=yes, directories=no, location=no, menubar=no, toolbar=no, status=no, resizable=yes');
	var theform = getElementById("resultsform");
	var thevar = getElementById("resultsaction");
	if (thevar)
		thevar.value="email";
	if (theform)
	{
		theform.target = popupwin.name;
		theform.submit();
	}
}

function launchdownload()
{
	closepopupwindows();
	var theform = getElementById("resultsform");
	var thevar = getElementById("resultsaction");
	if (thevar)
		thevar.value="download";
	if (theform)
	{
		theform.submit();
	}
}

function checkrdsform()
{
}

addWindowLoadEvent(setformtargets);
addWindowUnLoadEvent(closepopupwindows);
