/*
 * szredirect.js
 *
 * Copyright (c) 2008 Pascal Perez (Arsène) - ReveMonde.net
 * http://outside.revemonde.net/szredirect.js
 *
 * This file is free software: you can redistribute it and/or modify
 * it freely for any use.
 *
 * This file is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * This notice MUST stay intact for legal use.
 * Visit http://outside.revemonde.net/
 */

function getBrowser() {
    var browser = navigator.userAgent.toLowerCase();

    if ((navigator.vendor) && (navigator.vendor.toLowerCase().indexOf('apple') != -1) && (browser.indexOf('safari') != -1)) {
        return 'Safari';
    }
    else if (browser.indexOf('msie') != -1) {
        return 'MSIE';
    }
    else if ((browser.indexOf('mozilla') != -1) || (browser.indexOf('firefox') != -1)) {
        return 'Netscape Family';
    }
    else {
        return '?';
    }
}

function setActualLocation(frame) {
    if (typeof(frame) == "string") {
        innerSetLocation(window.top.frames[frame].document);
    }
    else try {
        innerSetLocation(window.document);
    }
    catch (error) {
        innerSetLocation(window.top.frames["World"].document);
    }
}

function innerSetLocation(thisDocument) {
    contact3d = thisDocument.getElementById("Contact3D");
    contact3d.setNodeEventIn("szLocator", "actualLocation", window.top.location);
}

function deployContact3D() {
    var browser = getBrowser();
    if (browser == "MSIE") {
        document.write("<object classid='clsid:4B6E3013-6E45-11D0-9309-0020AFE05CC8' "
            + " id='Contact3D' width='100%' height='100%'></object>");
    }
    else if (browser == "Netscape Family") {
        document.write("<embed type='model/vrml' id='Contact3D' width='100%' height='100%'></embed>");
    }
}

