/**
 * Simple license thing
 *
 *	Ben Adida - ben@mit.edu
 *  2006-03-21
 *
 *	licensed under GPL v2
 */


// EXPECTING __RDFA_BASE
if (typeof(__RDFA_BASE) == 'undefined')
  __RDFA_BASE = 'http://www.w3.org/2006/07/SWD/RDFa/impl/js/20080817/';

// configuration information
var RDFA = new Object();
RDFA.url = __RDFA_BASE + 'rdfa.js';

RDFA.CALLBACK_DONE_PARSING = function() {
    var CC = new Namespace('http://creativecommons.org/ns#');
    var cc_license = CC('license');

    var XHTML = new Namespace('http://www.w3.org/1999/xhtml/vocab#');
    var xhtml_license = XHTML('license');

    var current_page = RDFA.triplestore.sym(Util.uri.join('', RDFA.BASE));
    
    var license = RDFA.triplestore.the(current_page,cc_license);
    if (!license)
        license = RDFA.triplestore.the(current_page,xhtml_license);

    if (license) {
        if (confirm('This document is licensed under a copyright license. Click OK to see the license.')) {
            document.location = license.uri;
        }
    } else {
        alert ('no copyright license');
    }
}

//
// Everything below is used only for loading the RDF/A javascript.
// You probably don't need to look at it.
//

// callback when the RDF/A parsing is done.
RDFA.CALLBACK_DONE_LOADING = function() {
    RDFA.parse();
}

RDFA.load = function()
{
    var s = document.createElement("script");
    s.type = 'text/javascript';
    s.src = RDFA.url;

    // add it to the document tree, load it up!
    document.getElementsByTagName('head')[0].appendChild(s);
}

RDFA.load();