// Javascript by Specific Impulse, Inc.

// This opens the Virtual Corporate Lobby child window at any time

var thisWindow
var thisPort

function openSesame() {
	if (!thisWindow || thisWindow.closed) {
	   thisWindow = window.open("../vcl/vclnav.html","sesameseed","resizeable=no,alwaysRaised=yes,height=150,width=400");
	} else {
	thisWindow.focus();
	}
}

function openSesameHome() {
	if (!thisWindow || thisWindow.closed) {
	   thisWindow = window.open("vcl/vclnav.html","sesameseed","resizeable=no,alwaysRaised=yes,height=150,width=400");
	} else {
	thisWindow.focus();
	}
}

function openPortfolio(showOff) {
	if (!thisPort || thisPort.closed) {
	   thisPort = window.open(showOff,"portinastorm","resizable=yes,alwaysRaised=yes,scrollbars=yes,height=400,width=600");
	} else {
	thisPort.focus();
	thisPort.location.href=showOff;
	}
}


// This is used to load different body content in frames

function goThere(windowName) {
  parent.trinav1.location.href=windowName;
}

// Sets cookie values (generic).

function setCookie(name, value, expires, path, domain, secure) {
	document.cookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");

}

    function register() {
          var today = new Date()
          var expires = new Date()
          var okuser = "haspassword"
          expires.setTime(today.getTime() + 1000*60*60*24*30);
          setCookie("SI_visitor", okuser, expires);
    }

    function getCookie(Name) {
          var search = Name + "="
          if (document.cookie.length > 0) { // if there are any cookies
                    offset = document.cookie.indexOf(search)
                    if (offset != -1) { // if cookie exists
                              offset += search.length
                              // set index of beginning of value
                              end = document.cookie.indexOf(";", offset)
                              // set index of end of cookie value
                              if (end == -1)
                                        end = document.cookie.length
                              return unescape(document.cookie.substring(offset, end))
                    }
            }
    }



function hiLite(imgName,imgArrayName) {
    	document.images[imgName].src = eval(imgArrayName + ".src");
}

// Author: Joan Walton, Specific Impulse, December 1999
// WriteInfoFields
// 	Adds hidden customer information fields to a form.
// 	To use, do the following:
// 		(1) include this file:
//			<HEAD>
//			<SCRIPT SRC="controls/arbitrary.js"></SCRIPT>
//			</HEAD>
//		(2) Call the WriteInfoFields between your form tags:
//			<SCRIPT> <!--
//			WriteInfoFields();
//  			//-->
//			</SCRIPT>
//

function WriteInfoFields() {
	document.writeln('<INPUT TYPE="HIDDEN" NAME="appName" VALUE="' + navigator.appName + '">');
	document.writeln('<INPUT TYPE="HIDDEN" NAME="appVersion" VALUE="' + navigator.appVersion + '">');
	document.writeln('<INPUT TYPE="HIDDEN" NAME="language" VALUE="' + navigator.language + '">');
	document.writeln('<INPUT TYPE="HIDDEN" NAME="platform" VALUE="' + navigator.platform + '">');
	document.writeln('<INPUT TYPE="HIDDEN" NAME="userAgent" VALUE="' + navigator.userAgent + '">');
	document.writeln('<INPUT TYPE="HIDDEN" NAME="javaEnabled" VALUE="' + navigator.javaEnabled() + '">');
	document.writeln('<INPUT TYPE="HIDDEN" NAME="cookies" VALUE="' + (document.cookie.length > 0) + '">');
}

// CheckRequiredFields
// 	Checks that the user entered something in the given required fields.
// 	The first argument is the form and the remaining arguments (as many as
// 	needed) are the names of the required fields.
// 	Use as on submit routine for the form. Example:
//		<form action="scripts/client_input.cgi" method="POST"
//			onSubmit="return CheckRequiredFields(this, "firstname", "lastname", "Title");">
// Author: Joan Walton, December 1999

function CheckRequiredFields(theForm) {
	for (var i=1; i < CheckRequiredFields.arguments.length; i++) {
		if (eval("theForm." + CheckRequiredFields.arguments[i] +
				".value.length") == 0) {
			alert("Please enter your " + CheckRequiredFields.arguments[i]);
			return false;
		}
	}
	return true;
}




var supported = (((navigator.appName == "Netscape") &&
(parseInt(navigator.appVersion) >= 4 )) || ((navigator.userAgent.indexOf("MSIE")!=-1) && (parseInt(navigator.appVersion)>=4)));

if (!(supported)) {
        if (navigator.appName == "Netscape"){
                document.location = "legacy_home.html";}
        if (navigator.appName == "Microsoft Internet Explorer"){
                document.location.href = "legacy_home.html";}
}

var isNav, isIE;
var coll = "";
var styleObj = "";
var rapperdiv = "";
if (parseInt(navigator.appVersion) >= 4) {
        if (navigator.appName == "Netscape") {
                isNav = true;
                rapperdiv = "document.parentdiv."
        } else {
                isIE = true;
                coll = "all.";
                styleObj = ".style";
        }
}

/* ELEMENT1 */
var hoo = new Array("one", "two", "three", "four");
/* ELEMENT2 */
var com = new Array("two", "one", "three", "four");
/* ELEMENT3 */
var ser = new Array("three", "one", "two", "four");
/* ELEMENT4 */
var lob = new Array("four", "one", "two", "three");

// Rollover enabled via visibility property
function RollOver(name) {
	// alert(name[1]);
        var obj = eval(rapperdiv + "document." + coll + name[0] + styleObj);
        obj.visibility = "visible";
        var obj = eval(rapperdiv + "document." + coll + name[1] + styleObj);
  //      obj.visibility = "hidden";
        var obj = eval(rapperdiv + "document." + coll + name[2] + styleObj);
        obj.visibility = "hidden";
        var obj = eval(rapperdiv + "document." + coll + name[3] + styleObj);
        obj.visibility = "hidden";
}

// secondary navigation angle bracket selected script

	// image array

    clickthis0 = new Image;
    clickthis0.src = "../images/lt.gif";
    clickthis1 = new Image;
    clickthis1.src = "../images/gt.gif";
    clickthis2 = new Image;
    clickthis2.src = "../images/angle_off.gif";

	// button selected

function turnOn(imgName) {

	// re-initialize the image array

	for (var i = 2; i < document.images.length; i++) {
	document.images[i].src = eval("clickme2.src");
	}

	// now turn the new image on

 	document.images[imgName].src = clickme2.src;
}

 function wahoo(imgName,imgArrayName,buttonName,buttonArrayName) {
    document.images[imgName].src = eval(imgArrayName + ".src");
    document.images[buttonName].src = eval(buttonArrayName + ".src");
}



// This closes a child window and returns focus to the opener window
// In IE we get an error if the opener is already closed; since we can't
// determine whether the opener is closed, we just close the child

function goAway() {
	if (navigator.appName == "Netscape") {
	window.close();
	window.opener.focus();
	}
        if (navigator.appName == "Microsoft Internet Explorer") {
	window.close();
	}
}

// This is the navigation for the Virtual office; it returns focus
// to the opener. On Netscape, if the opener is closed, we open it.
// In IE we get an error if the opener is closed; since we can't
// determine whether the opener is closed, we just open another window.


function openDoor(Here) {
        if (navigator.appName == "Netscape") {
	var thatWindow = self.opener.href
		if (thatWindow == null) {
		window.open(Here,"contentWindow");
		}
		else {
		window.opener.focus();
		window.opener.location.href=Here;
		}
        }
        if (navigator.appName == "Microsoft Internet Explorer") {
		window.open(Here,"contentWindow");
// this throws a confirm dialog	//	window.opener.close();
	}
}


function openFloor(Here) {
		window.opener.focus();
		window.opener.location.href=Here;
}


function focusVCL() {
	setTimeout('self.focus()', '0');
}


// This closes a child window and returns focus to the parent window AFTER X milliseconds

function reFocus() {
	setTimeout('window.opener.focus(); window.close()', '3000');
}

// Determines which marketing ploy the visitor used to enter the home page


// Determines which landing page the visitor used to enter the promo page

function whoamI(cookie_value) {
	  var today = new Date()
	  var expires = new Date()
	  expires.setTime(today.getTime() + 1000*60*60*24*21)  // 3 weeks
	  setCookie("marketing", cookie_value, expires, "/");
}

function Iamnomore(cookie_value) {
	  var today = new Date()
	  var expires = new Date()
	  expires.setTime(today.getTime() - 1000)  // one second
	  setCookie("marketing", cookie_value, expires, "/");
}

function pickForm() {
	if (navigator.appName == "Netscape"){
		location.href = "promo_form_n.html";
		} else {
		location.href = "promo_form_ie.html";
	}
}













