/**
 * interwoven Sitelib 1.0
 * by wes modes, March 2000
 * Copyright (c) 2000 Interwoven, Inc.
 *
 */

// Browser detection
var isIE = (document.all) ? true : false;
var isNav = (document.layers) ? true : false;
var isOff = false;
if (navigator.appName == "Microsoft Internet Explorer" &&
navigator.appVersion.indexOf("Mac") != -1 ) { 
    var isOff = true;
}

// Defines a new image for preloading
function newImage(arg) {
    if (document.images) {
        rslt = new Image();
        rslt.src = arg;
        return rslt;
    }
}

// Preloads images (mostly nav images)
var preloadFlag = false;
function preloadImages() {
    if (document.images) {
        nav_prod_over = newImage("/images/navbar/nav-prod-over.gif");
        nav_supp_over = newImage("/images/navbar/nav-supp-over.gif");
        nav_serv_over = newImage("/images/navbar/nav-serv-over.gif");
        nav_dev_over = newImage("/images/navbar/nav-dev-over.gif");
        nav_part_over = newImage("/images/navbar/nav-part-over.gif");
        nav_cust_over = newImage("/images/navbar/nav-cust-over.gif");
        nav_comp_over = newImage("/images/navbar/nav-comp-over.gif");
        nav_invest_over = newImage("/images/navbar/nav-invest-over.gif");
        nav_news_over = newImage("/images/navbar/nav-news-over.gif");
        nav_news_over = newImage("/images/navbar/nav-news-over.gif");
	more_over = newImage("/images/more-over.gif");
        preloadFlag = true;
    }
}

// Opens a new browser window (without controls) for external links
function win(URL) {
    var win;
    var windowName = "";
    var features =
        "resizable=1," +
	"toolbar=1," +
	"location=0," +
	"directories=0," +
	"status=0," +
	"scrollbars=1," +
	"menubar=0," +
	"copyhistory=0," +
	"width=720," +
	"height=420"; 
    win = window.open(URL, windowName, features); 
    // win.location = URL;
    win.focus();
}

// Opens a new browser window (without controls) for external links
function vertwin(URL) {
    var win;
    var windowName = "artwin";
    var features =
        "resizable=1," +
	"toolbar=0," +
	"location=0," +
	"directories=0," +
	"status=0," +
	"scrollbars=1," +
	"menubar=0," +
	"copyhistory=0," +
	"width=580," +
	"height=580"; 
    win = window.open(URL, windowName, features); 
    // win.location = URL;
    win.focus();
}

// Opens a new browser window (without controls) for external links
function horzwin(URL) {
    var win;
    var windowName = "artwin";
    var features =
        "resizable=1," +
	"toolbar=0," +
	"location=0," +
	"directories=0," +
	"status=0," +
	"scrollbars=1," +
	"menubar=0," +
	"copyhistory=0," +
	"width=840," +
	"height=580"; 
    win = window.open(URL, windowName, features); 
    // win.location = URL;
    win.focus();
}

// Opens a new browser window (without controls) for external links
function bigwin(URL) {
    var win;
    var windowName = "";
    var features =
        "resizable=1," +
	"toolbar=1," +
	"location=0," +
	"directories=0," +
	"status=0," +
	"scrollbars=1," +
	"menubar=0," +
	"copyhistory=0," +
	"width=800," +
	"height=600"; 
    win = window.open(URL, windowName, features); 
    // win.location = URL;
    win.focus();
}

// Opens a new browser window (without controls) for external links
var win;
function tinywin(URL) {
    var win;
    var windowName = "tinywin";
    var features =
        "resizable=0," +
	"toolbar=0," +
	"location=0," +
	"directories=0," +
	"status=0," +
	"scrollbars=0," +
	"menubar=0," +
	"copyhistory=0," +
	"width=360," +
	"height=300"; 
    win = window.open(URL, windowName, features); 
    // win.location = URL;
    win.focus();
}

// Opens a new browser window (without controls) for external links
var win;
function camwin(URL) {
    var win;
    var windowName = "camwin";
    var features =
        "resizable=0," +
	"toolbar=0," +
	"location=0," +
	"directories=0," +
	"status=0," +
	"scrollbars=0," +
	"menubar=0," +
	"copyhistory=0," +
	"width=360," +
	"height=300"; 
    win = window.open(URL, windowName, features); 
    // win.location = URL;
    win.focus();
}

// Passes the current url to a cgi that emails it to a friend
function send2friend(form) {
    document.location.href=("/cgi-bin/send2friend?" + "mailto=" + form.to.value + "?url=" + document.location.href);
}

// Swaps out an image 
// the arguments are:
//    1) the NAME of the image, and 
//    2) the location of the image file
function changeImages() {
    if (document.images && (preloadFlag == true)) {
        for (var i=0; i<changeImages.arguments.length; i+=2) {
            document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
        }
    }
}

// Next two functions flip a mouseover image on and off
// Pass it a single param representing the image to be fliped
// The NAME value of the image should be the same as the navbar gif
// The mouseover image should be the navbar image name plus "over"
//    Example:  <IMG NAME="nav-news" SRC="/images/navbar/nav-news.gif">
//    Mouseover:  nav-prod-over.gif
function onImage(arg) {
   changeImages(arg, "/images/navbar/" + arg + "-over.gif"); 
}
function offImage(arg) {
   changeImages(arg, "/images/navbar/" + arg + ".gif"); 
}

function loadMenus() {

    window.prodMenu = new Menu();
    prodMenu.addMenuItem("TeamSite", "location='/products/teamsite/'");
    prodMenu.addMenuItem("OpenDeploy", "location='/products/opendeploy/'");
    prodMenu.addMenuItem("Templating", "location='/products/templating/'");
    prodMenu.addMenuItem("Demos", "location='/products/livedemo/'");
    prodMenu.disableDrag = true;

    window.suppMenu = new Menu();
    suppMenu.addMenuItem("Knowledge&nbsp;Base", "location='http://support.interwoven.com/kb/kb.asp'");
    suppMenu.addMenuItem("Case&nbsp;Center", "location='http://support.interwoven.com/cts/cts.asp'");
    suppMenu.addMenuItem("Library", "location='http://support.interwoven.com/library/library.asp'");
    suppMenu.addMenuItem("Download", "location='http://support.interwoven.com/download/download.asp'");
    suppMenu.addMenuItem("Contact", "location='http://support.interwoven.com/contact/contact.asp'");
    suppMenu.disableDrag = true;

    window.servMenu = new Menu();
    servMenu.addMenuItem("Consulting", "location='/services/consulting.html'");
    servMenu.addMenuItem("Education", "location='/services/training/'");
    servMenu.addMenuItem("Courses", "location='/services/training/course-descriptions.html'");
    servMenu.addMenuItem("Schedule", "location='/services/training/schedule.html'");
    servMenu.addMenuItem("Register", "location='/services/training/howtoregister.html'");
    servMenu.disableDrag = true;

    window.devMenu = new Menu();
    devMenu.addMenuItem("Best&nbsp;Practices", "location='/developer/expertise/'");
    devMenu.addMenuItem("Library", "location='/developer/library/'");
    devMenu.addMenuItem("Community", "location='/developer/community/'");
    devMenu.addMenuItem("Downloads", "location='/developer/download/'");
    devMenu.addMenuItem("Ask&nbsp;the&nbsp;Experts", "location='/developer/ask/'");
    devMenu.addMenuItem("Support", "location='/support/'");
    devMenu.disableDrag = true;

    window.partMenu = new Menu();
    partMenu.addMenuItem("Program", "location='/partners/ultrateam.html'");
    partMenu.addMenuItem("Member&nbsp;Login", "location='/pteam/'");
    partMenu.addMenuItem("Registration", "location='/cgi-bin/partreg'");
    partMenu.addMenuItem("Contact", "location='/partners/contact.html'");
    partMenu.disableDrag = true;

    window.custMenu = new Menu();
    custMenu.addMenuItem("Customer&nbsp;List", "location='/customers/customers.html'");
    custMenu.addMenuItem("Success&nbsp;Stories", "location='/customers/profiles/'");
    custMenu.disableDrag = true;

    window.compMenu = new Menu();
    compMenu.addMenuItem("Point&nbsp;of&nbsp;View", "location='/company/view/'");
    compMenu.addMenuItem("Management", "location='/company/mngmnt.html'");
    compMenu.addMenuItem("Investors", "location='http://www.corporate-ir.net/ireye/ir_site.zhtml?ticker=IWOV&script=2100&layout=-6'");
    compMenu.addMenuItem("Contact", "location='/company/contact.html'");
    compMenu.addMenuItem("Careers", "location='/company/careers/'");
    compMenu.disableDrag = true;

    window.investMenu = new Menu();
    investMenu.addMenuItem("Officers", "location='/company/mngmnt.html'");
    investMenu.addMenuItem("Stock&nbsp;Chart", "location='http://www.corporate-ir.net/ireye/ir_site.zhtml?ticker=iwov&script=350'");
    investMenu.addMenuItem("Stock&nbsp;Quote", "location='http://www.corporate-ir.net/ireye/ir_site.zhtml?ticker=iwov&script=200'");
    investMenu.addMenuItem("Financial Press", "location='http://www.corporate-ir.net/ireye/ir_site.zhtml?ticker=iwov&script=400'");
    investMenu.addMenuItem("Analysts", "location='http://www.corporate-ir.net/ireye/ir_site.zhtml?ticker=iwov&script=11937&item_id=&quot;analysts.htm&quot;'");
    investMenu.addMenuItem("SEC&nbsp;Filings", "location='http://www.corporate-ir.net/ireye/ir_site.zhtml?ticker=iwov&script=1901'");
    investMenu.addMenuItem("Calendar", "location='http://www.corporate-ir.net/ireye/ir_site.zhtml?ticker=iwov&script=1000'");
    investMenu.addMenuItem("Info&nbsp;Request", "location='http://www.corporate-ir.net/ireye/ir_site.zhtml?ticker=iwov&script=2300'");
    investMenu.addMenuItem("Email&nbsp;Alert", "location='http://www.corporate-ir.net/ireye/ir_site.zhtml?ticker=iwov&script=1900'");
    investMenu.disableDrag = true;

    window.newsMenu = new Menu();
    newsMenu.addMenuItem("Press", "location='/news/press.html'");
    newsMenu.addMenuItem("Events", "location='/news/events.html'");
    newsMenu.addMenuItem("Awards", "location='/news/awards.html'");
    newsMenu.addMenuItem("Coverage", "location='/news/presscov.html'");

    newsMenu.fontSize = 10;
    newsMenu.fontWeight = "plain";
    newsMenu.fontFamily = "verdana, arial, helvetica, sans-serif";
    newsMenu.fontColor = "#336699";
    newsMenu.fontColorHilite = "#FF9933";
    newsMenu.bgColor = "#336699";
    newsMenu.menuLiteBgColor = "#336699";
    newsMenu.menuItemBgColor = "#FFFFFF";
    newsMenu.menuHiliteBgColor = "#FFFFFF";
    newsMenu.menuBorder = 0;
    if (isIE) {
	newsMenu.menuWidth = 100;
	newsMenu.menuItemWidth = 100;
    }
    //newsMenu.menuItemBorder = 0;
    newsMenu.menuItemIndent = 5;
    newsMenu.menuItemHeight = 15;
    newsMenu.menuContainerBgColor = "#FFFFFF";
    newsMenu.disableDrag = true;

    //unused, but available
    //newsMenu.menuBorderBgColor = "#000000";
    //newsMenu.enableHideOnMouseOut = true;
    //newsMenu.disableHide = true;

    newsMenu.prototypeStyles = newsMenu;

    newsMenu.writeMenus();

}

function onLoad() {
    window.preloadImages();
    if (! isOff)
        window.loadMenus();
}
