// check frame

function CheckFrame ()
{	if (parent.location.href == self.location.href || self.name != 'main')
	{	requested_id = self.location.search.replace (/.*?article_id=([0-9]*).*/, "$1");
		if (requested_id > 0)
			window.top.location.replace ('index.php?' + 'req=' + requested_id);
	}
};


// print article

function PrintArticle (aid)
{	attributes = 'width=500,height=600' +
	             ',menubar=no, location=no, toolbar=no, statusbar=no' +
	             ',scrollbars=yes, resizable=yes';
	w = window.open ('/index.php?article_id=' + aid, 'print', attributes);
	w.focus ();
}


// open info popup

function OpenInfo (event)
{	source = (event.target) ? event.target : event.srcElement;

	x = window.screenX + 30;
	y = window.screenY + 30;
	if (! x>0 && ! y>0)
	{	x = window.screenLeft + 30;
		y = window.screenTop - 50;
	}
	attributes = 'width=440,height=350,left=' + x + ',top=' + y +
	             ',menubar=no,location=no,toolbar=no,status=no' +
	             ',resizable=no,scrollbars=yes';
	w = window.open (event.href, 'info', attributes);
	w.focus ();
};

// open picture popup

function OpenPicture (event)
{	source = (event.target) ? event.target : event.srcElement;

	x = window.screenX + 30;
	y = window.screenY + 30;
	if (! x>0 && ! y>0)
	{	x = window.screenLeft + 30;
		y = window.screenTop - 50;
	}
	attributes = 'width=150,height=150,left=' + x + ',top=' + y +
	             ',menubar=no,location=no,toolbar=no,status=no' +
	             ',resizable=no';
	w = window.open ('/index.php?article_id=189&val='+event.href, 'picture', attributes);
	w.focus ();
};

// open PDF

function OpenPdf (link)
{	attributes = 'menubar=no, location=no, toolbar=no, statusbar=no' +
	             ',scrollbars=yes, resizable=yes';
	w = window.open (link, 'pdf', attributes);
	w.focus ();
}

// print mailto URL

function PrintMailto (part1, part2, part3)
{	rcpt = part3 + part1 + part2;
	document.write ('<a href="mailto:' + rcpt + '">' + rcpt + '</a>');
}
