function autopopup(href, rel) {
	var options = {
		selector: '.popup',
		popupId: 'easy_popup',
		preloadText: 'Cargando...',
		errorText: 'Ha ocurrido un problema con su solicitud, por favor haga click fuera de esta ventana para cerrarla.',
		closeText: 'Cerrar'
	};
	if ($.browser.opera) $.support.opacity = true;
	var ie6 = $.browser.msie && $.browser.version.substr(0, 1) < 7;
	var opera95 = $.browser.opera && $.browser.version <= 9.5;
	var w = $(window).width();
	var h = $(document).height();
	var w2 = $(window).width() / 2;
	var h2 = $(window).height() / 2;
	show = function () {
		$('#' + options.popupId + 'preloader').remove();
		if (cw != 0) $('#' + options.popupId + 'content').css('width', cw + 'px');
		if (ch != 0) $('#' + options.popupId + 'content').css('height', ch + 'px');
		set($('#' + options.popupId + 'content'));
		$('img', '#' + options.popupId + 'content').css('visibility', 'visible')
	};
	set = function (obj) {
		$(obj).css({
			'padding': '10px',
			'background': '#fff',
			'color': '#333',
			'text-align': 'left',
			'float': 'left',
			'position': 'fixed',
			'z-index': '10001',
			'visible': 'hidden'
		});
		var left = w2 - $(obj).width() / 2;
		var top = h2 - $(obj).height() / 2;
		$(obj).css({
			'left': left,
			'top': top,
			'display': 'none'
		}).fadeIn('1000');
		if (ie6) $(obj).css({
			'position': 'absolute',
			'top': (top + $(window).scrollTop()) + 'px'
		});
		if (opera95) $(obj).css({
			'position': 'absolute',
			'top': (document.body['clientHeight'] / 2 - $(obj).height() / 2 + $(window).scrollTop()) + 'px'
		})
	};
	if (ie6) $('embed, object, select').css('visibility', 'hidden');
	error = function () {
		$('#' + options.popupId + 'content').text(options.errorText);
		show()
	};
	remove = function () {
		$('#' + options.popupId).remove();
		$('#' + options.popupId + 'content').remove();
		$('#' + options.popupId + 'preloader').remove();
		if (ie6) $('embed, object, select').css('visibility', 'visible')
	};
	$('<div id="' + options.popupId + '"></div>').appendTo('body').css({
		'width': w,
		'height': h,
		'background': '#000',
		'position': 'absolute',
		'top': '0',
		'left': '0',
		'z-index': '10000',
		'opacity': .7
	}).click(function () {
		remove()
	});
	var extension = href.substr(href.lastIndexOf('.')).toLowerCase();
	var content;
	var cw = 0;
	var ch = 0;
	var showOk = false;
	$('<div id="' + options.popupId + 'preloader">' + options.preloadText + '</div>').appendTo('body');
	set($('#' + options.popupId + 'preloader'));
	$('<div id="' + options.popupId + 'content"></div>').appendTo('body');
	
	$('<iframe frameborder="0" scrolling="auto" style="width:100%;height:100%" src="' + href + '" />').appendTo('#' + options.popupId + 'content');
	cw = 900;
	ch = 500;
	showOk = true
	
	var rel = rel.split(';');
	$.each(rel, function (i) {
		if (rel[i].indexOf('width') != - 1) cw = rel[i].split(':')[1];
		if (rel[i].indexOf('height') != - 1) ch = rel[i].split(':')[1]
	});
	if (showOk) show();
	$('<small>' + options.closeText + '</small>').appendTo('#' + options.popupId + 'content').css({
		'position': 'absolute',
		'float': 'left',
		'left': '0',
		'top': '-24px',
		'color': '#fff',
		'cursor': 'pointer'
	});
	$('#' + options.popupId + ', #' + options.popupId + 'content small').click(function () {
		remove()
	})
}

$(document).ready(function(){	
	autopopup('/escuela_relaciones_laborales_2010/index.php', 'width:800;');
});

