// JavaScript Document

function confirmAction(msg, ac) {
	if(confirm(msg+'\nDo you wish to continue?')) {
		location.href=ac;
	}
}


function ShowLinks(obj, field) {
	this.id = '__show_links'+(Math.round(Math.random()*new Date().getTime()));
	this.obj = obj;
	this.field = field;
	window[this.id] = this;
}

ShowLinks.prototype = {
	getObject:function() {
		if(!this.div) {
			var frm = document.createElement('IFRAME');
			var div = document.createElement('DIV');
			div.id = this.id + '_div';
			div.style.cssText = 'border:1px solid black; padding:5px; position:absolute; background-color:white; width:300px;';
			div.style.position = 'absolute';
			frm.border = 0;
			frm.frameBorder = 0;
			frm.width = '100%';
			frm.heigth = 200;
			frm.src = 'browse.links.php?objRef='+this.id;
			div.appendChild( frm );
			document.body.appendChild( div );
			this.div = div;
		} 
	},
	
	show:function () {
		var o = typeof(this.obj) == 'string' ? $(this.obj) : this.obj;
		var f = typeof(this.field) == 'string' ? $(this.field) : this.field;
		
		this.getObject();
		var frm = this.div;
		setPosition(frm, getPosition(o).x + getSize(o).width, getPosition(o).y);
		setVisible(frm, true);
	},
	
	set:function(opt) {
		var f = typeof(this.field) == 'string' ? $(this.field) : this.field;
		f.value = opt;
		this.close();
	},
	
	close:function() {
		setVisible(this.div, false);
	}
}


function indicate(url) {
	var w=window.open("indicate.php?url="+escape(url),"indcate","width=470,height=300");
	w.focus();
}

function $(d) { return document.getElementById(d); }

function imprimir() {
	var w=window.open('print.php?divname=conteudo');
	w.focus();
}
