/* Browser sensing */
/* Set up boolean variables to record the browser type */
var isNS4 = 0;
var isIE4 = 0;
var isNew = 0;
var docObj, styleObj, currObj

/* Determines the browser name and browser version */
var brow = ((navigator.appName) + (parseInt(navigator.appVersion)));

/* reassign variable depending on the browser */
if (parseInt(navigator.appVersion >= 5)) {
	isNew = 1
} else if (brow == "Netscape4") {i
	sNS4 = 1;
} else if (brow == "Microsoft Internet Explorer4") {
	isIE4 = 1;
}

if (isNS4||isIE4||isNew) {
	docObj = (isNS4) ? 'document' : 'document.all';
	styleObj = (isNS4) ? '' : '.style';
}

// open external links in a new window
function externalLinkHandler() {
        if(document.getElementById) {
                linkTarget="other";

                for (var i=0; i<=(document.links.length-1); i++) {
                	isExternal=((document.links[i].href.indexOf("http://")!=-1)&&(document.links[i].href.indexOf("outsi.com")==-1))

                        if(isExternal) {
                                document.links[i].target = linkTarget;
                        }
                }
        }
}
	
function toggleVis(currElem) {
	list = document.calculatorForm.colSoftware
	var listValue=list.options[list.selectedIndex].value
	dom = eval(docObj +  '.' + currElem + styleObj)
	if (listValue=="Other") {
		dom.visibility = "visible"
		document.calculatorForm.colOtherSoftware.value='Please specify'
	} else {
		dom.visibility = "hidden"
	}
}

function Get_Cookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;

	if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}

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

var today = new Date();
var expires = new Date(today.getTime() + (56 * 86400000));
 
function set() {
    if (document.forms[0].save.checked) {
        Set_Cookie("username",document.forms[0].username.value,expires);
        Set_Cookie("password",document.forms[0].password.value,expires);
    }
    if (document.forms[0].save.checked==false) {
        Set_Cookie("username","",expires);
        Set_Cookie("password","",expires);
    }
}

function get() {
    username = Get_Cookie("username")
    if (username != null) {
        document.forms[0].username.value = username;
        document.forms[0].save.checked = true;
    }

	password = Get_Cookie("password")
    if (password != null) {
        document.forms[0].password.value = password;
        document.forms[0].save.checked = true;
    }
}

function whatIsThis() {
	alert("Checking this box will put a cookie on your computer that will remember your UserName and Password. Use this feature only if you are sure your computer is secure.")
}

function submit1() {
	document.ccoptin.action = "http://ccprod.roving.com/roving/d.jsp"
	document.ccoptin.target = "_blank"
	document.ccoptin.submit();
}

function submit2() {
	document.ccoptin.action = "/scripts/newsletter.asp"
	document.ccoptin.target = ""
	document.ccoptin.submit();
}
