/* Copyright 2004 EasySpeedy ApS, All Rights Reserved. */

//includes: x_object.js,x_misc.js, x_slide.js

/*  Parameters

sTmrType'timeout' or 'interval'
uTimeouttime in ms
sPos1on show, slides from this cp
sPos2on show, slides to this cp
sPos3on hide, slides to this cp
sStyleapplied to the iframe
sIdapplied to the iframe
sUrlgets loaded int
// 'Position' is one of the following:
// 'n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw', 'cen', 'cenh' or 'cenv'o the newly created iframe*/
var winArray = new Array();
function popup(showUrl, width, height) {
    var url = "";
    if (-1 == showUrl.indexOf('?')) {
        url = "?";
    } else {
        url = "#";
    }
    ;
    var url = showUrl + url + "url=" + location.href;
    var aw = screen.availWidth;
    var ah = screen.availHeight;
    var top = Math.round((ah - height) * 0.5);
    var left = Math.round((aw - width) * 0.5);
    var param = '"toolbar,scrollbars=1,statusbar=1,menubar=0,resizable=0,' + 'width=' + width + ',height=' + height + ',left=' + left + ',top=' + top + '"';
    var name = "o" + width + "o" + height + "o";
    // IE fix
    if (typeof( winArray[name] ) != "object") {
        winArray[name] = window.open(url, name, param);
    } else {
        if (!winArray[name].closed) {
            winArray[name].location.href = url;
        } else {
            winArray[name] = window.open(url, name, param);
        }
        ;
    }
    winArray[name].focus();
}
;
function forwardEvents(from, to, onEv, func) {
    // forward events from one object to another
    // forwardEvents("fromObject","toObject","Event","function");
    var f = document.getElementById(from);
    if (f) {
        f.to = document.getElementById(to);
        if (f.to) {
            eval("f." + onEv + "=" + func + ";");
        }
        ;
    }
    ;
}
;
function moveValue() {
    this.to.value = this.value;
}
;
function isEquel() {
    if (this.to.value != this.value) {
        alert("xxx");
    }
}
;
function idDisabled(id, boo, color) {
    f = document.getElementById(id);
    if (f) {
        f.disabled = boo;
        f.style.backgroundColor = color;
        if (boo == true)
            f.value = '';
        return true;
    } else {
        return false;
    }
}
function findMailtoLink(text) {
    for (var i = 0; i < document.links.length; i++)
        if (document.links[i].href == text) return i;
    return null;
}
function emailAddress(address) {
    var to = '';
    var body = '';
    var subject = '';
    if (address == "mailto:sales") {
        to = 'sales@easyspeedy.com';
    } else if (address == "mailto:friend") {
        body = "Goto:  " + document.URL;
        subject = 'EasySpeedy dedicated server';
    } else {
        alert("wrong address");
    }
    for (var i = 0; i < document.links.length; i++) {
        if (address.indexOf(document.links[i].href) == 0) {
            document.links[i].href = 'mailto:' + to + '?subject=' + subject + '&body=' + body;
        }
    }
}
function rotategif() {
    image1 = new Image();
    image1.src = "/jira/images/icons/ref_16_rotate.gif";
    function refreshProjectFilter() {
        document.images['refimg'].src = '/jira/images/icons/ref_16_rotate.gif';
        eval(document.forms['filterform'].elements['refreshFilter'].value = true);
        document.forms['filterform'].submit();
    }
}
