﻿// the functions in this file require the supplementary library lib.js

// These defaults should be changed the way it best fits your site
// JavaScript Document
var _POPUP_FEATURES = '';


function popup(fichero,target,ancho,alto) {
    if (isUndefined(target)) target  = '_blank';
    if (isUndefined(alto)) alto = 480;
    if (isUndefined(ancho)) ancho = 640;
	MiVentana=open('','MiPropiaVentana','width=' + ancho + ',height=' + alto +',toolbar=no,directories=no,menubar=no,status=no');
	MiVentana.document.open();
	MiVentana.document.write('<html><head><title>VISTA | VIEW</title></head>');
	MiVentana.document.write('<style>');
	MiVentana.document.write('html { overflow: hidden; }');
	MiVentana.document.write('body { overflow: hidden; margin: 0; padding: 0;}');
	MiVentana.document.write('</style>');
	MiVentana.document.write('<body>');
	MiVentana.document.write('<img src="' + fichero + '"></body></html>');
	MiVentana.document.close();
    MiVentana.focus();
    return MiVentana;	  
    }

function abrir(src, horizontal, vertical,destino) {
    // to be used in an html event handler as in: <a href="..." onclick="link_popup(this,...)" ...
    // pops up a window grabbing the url from the event source's href
    return popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', horizontal, vertical);
}

function popupimagen(destino, imagen, ancho, alto) {
	// variables 
	var url = 'http://www.assescar.com/popup';
	var empresa = 'ASSESCAR';
	// comprobacion parametros
    if (isUndefined(ancho)) ancho = 300;
    if (isUndefined(alto)) alto = 200;
	// creando ventana
	ventanaSimple=window.open('', 'basico','location=0,statusbar=0,menubar=0,width='+ancho+',height='+alto+'\'');
	ventanaSimple.document.write('<html><head><title>'+empresa+'</title></head>');
	ventanaSimple.document.write('<body style="padding: 0px; margin: 0px; overflow: auto;">');
	// comprobando parametros no obligatorios
	if (isUndefined(destino)) {
		ventanaSimple.document.write('<img src="'+url+'/'+imagen+'" border="0">');
		}
	else {
		ventanaSimple.document.write('<a href="'+destino+'" target="_blank"><img src="'+url+'/'+imagen+'" border="0"></a>');
		}
	ventanaSimple.document.write('</body></html>');	
	ventanaSimple.document.close();
	ventanaSimple.focus();
	return ventanaSimple;	
}

function popupsimple(url, ancho, alto) {
	// comprobacion parametros
    if (isUndefined(ancho)) ancho = 300;
    if (isUndefined(alto)) alto = 200;
	// creando ventana
	ventanaSimple=window.open(url, 'basico','location=0,statusbar=0,menubar=0,width='+ancho+',height='+alto+'\'');
	ventanaSimple.focus();
	return ventanaSimple;	
}

