var ns3 = null;
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
	
browser = (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3 )) || ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 )))


if ( browser) {
	ns3 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) < 4 ))	
}

        if ((browser) && (thissite == "fm")) {
                over = new MakeArray(14)    
                var picpath = stylepath + thisstyle;
                if (thisstyle == ""){ var picpath = "images"}
              over[1].src =  picpath + "/whatwedo_ro.gif"
              over[2].src =  picpath + "/testdrive_ro.gif"
              over[3].src =  picpath + "/examples_ro.gif"
              over[4].src =  picpath + "/history_ro.gif"
              over[5].src =  picpath + "/pricing_ro.gif"
              over[6].src =  picpath + "/signup_ro.gif"
              over[7].src =  picpath + "/whatwedoon_ro.gif"
              over[8].src =  picpath + "/testdriveon_ro.gif"
              over[9].src =  picpath + "/exampleson_ro.gif"
              over[10].src =  picpath + "/historyon_ro.gif"
              over[11].src =  picpath + "/pricingon_ro.gif"
              over[12].src =  picpath + "/signupon_ro.gif"
              over[13].src =  picpath + "/Partnerson_ro.gif"
              over[14].src =  picpath + "/Partners_ro.gif"
               }
                
function MakeArray(n) {
    this.length = n
    for (var i = 1; i<=n; i++) {
        this[i] = new Image()
     }
    return this
}

//alert(thispath);

function glow (BTNid){
     if (browser) {
        current_overID = BTNid;	
	var picpath = stylepath + thisstyle;
	if (thisstyle == ""){ var picpath = "images"}
		if (BTNid.indexOf("editleft") != -1){
			document.images[current_overID].src = picpath + "/editleft_ro.gif";	
			} else {
			document.images[current_overID].src =  picpath + "/" + BTNid + "_ro.gif";	
			}
 		}
}

function fade (BTNid){
     if (browser) {
        current_overID = BTNid;	
	var picpath = stylepath + thisstyle;
	if (thisstyle == ""){ var picpath = "images"}
		if (BTNid.indexOf("editleft") != -1){
			document.images[current_overID].src =  picpath + "/editleft.gif";	
			} else {
			document.images[current_overID].src =  picpath + "/" + BTNid + ".gif";	
			}       
		}
}

// parameters are actually: pageid, admin, do, id, path, template, thissite, subdo) 
// the id variable is contentid, the identifyer for that content record

function editor (a1, a2, a3, a4, a5, a6, a7, a8){
	var gURL = fmtools + 'editor.cfm?siteid=' + a7 + '&pageid=' + a1 + '&admin=' + a2 + '&do=' + a3 + '&subdo=' + a8 + '&id=' + a4 + '&path=' + a5 + '&template=' + a6 + '&thissite=' + thissite;
//	alert('subdo is ' + a8);
	win = window.open(gURL, 'editor','scrollbars,resizable,status=yes,left=250,top=400,height=300,width=650');
	win.focus();
	return;
}

// parameters are actually: pageid, admin, do, id, path, template, area, subdo, siteid) 

function othereditor (a1, a2, a3, a4, a5, a6, a7, a8, a9){
	var gURL = fmtools + 'editor.cfm?pageid=' + a1 + '&admin=' + a2 + '&do=' + a3 + '&id=' + a4 + '&path=' + a5 + '&template=' + a6 + '&area=' + a7 + '&subdo=' + a8 + '&siteid=' + a9 + '&thissite=' + thissite;

	win = window.open(gURL, 'editor','scrollbars,resizable,status=yes,left=250,top=400,height=300,width=650');
	win.focus();
	return;
}

function uploaded (a1, a2, a3, a4, a5, a6, a7, a8){
	var gURL = fmpath + 'fmtools/editor.cfm?pageid=' + a1 + '&admin=' + a2 + '&do=' + a3 + '&objectid=' + a4 + '&path=' + a5 + '&template=' + a6 + '&filename=' + a7 + '&siteid=' + a8;

	win = window.open(gURL, 'editor','scrollbars,resizable,status=yes,left=250,top=400,height=300,width=650');
	win.focus();
	return;
}
function justdoit(editme){
	document.editme.submit();
//	window.close();				this closes the popup but cancels the submit!
//	if (!win.closed){win.close();}     this generates an error - win has no properties...it is not remembering it.
}

function hideHilite(hideme){
	hidehilite = "hilite" + hideme + "Div";
	if (is.ns) {
		showhilite = parent.frames[0].document.layers["holderDiv"].document.layers[hidehilite];
		showhilite.visibility = "hide";
		}
	if (is.ie) {
		showhilite = parent.frames[0].document.all[hidehilite].style;
		showhilite.visibility = "hidden";
	}	
}

function popHelp (whichhelp, thissite, thispath){
	var gURL = thispath + 'fmtools/pophelp.cfm?whichhelp=' + whichhelp + '&thissite=' + thissite;
	win = window.open(gURL, 'pophelp','scrollbars,resizable,status=yes,left=100,top=100,height=300,width=300');
	win.focus();
	return;
}

function goUrl (goWhere){
	var gURL = goWhere;
	win = window.open(gURL);
	win.focus();
	return;
}

function gotoUrl (goWhere){
	var gURL = goWhere;
	location = gURL;
	return;
}

function editPic (fmpath, fmtools, thissite, thispic){
	var gURL = fmtools + 'editpic.cfm?thissite=' + thissite + '&thispic=' + thispic + '&fmpath=' + fmpath;
	win = window.open(gURL, 'pophelp','scrollbars,resizable,status=yes,left=50,top=50,height=750,width=750');
	win.focus();
	return;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

var newwinOLD;
function launchwin1(winurl,winname,winfeatures){
	newwin = window.open(winurl,winname,winfeatures);
	if(javascript_version > 1.0){
 		setTimeout('newwin.focus();',250);
	  }
  }

var wid="790";
var hei="522";
if(screen) {
	if(screen.width>1000) {
		swf2Load="preloader.swf";
		wid="1016";
		hei="690";
	}

}

var newwin;
function launchwin(winurl,winname,winfeatures){
	newwin = window.open(winurl,winname,winfeatures+",height="+hei+",width="+wid+",left=0,top=0");
	if(javascript_version > 1.0){
 		setTimeout('newwin.focus();',250);
	}
}

function pop(hiddenrow) {
  if (document.getElementById(hiddenrow).style.display == 'none') {
    document.getElementById(hiddenrow).style.display = '';
	}
  else {
     document.getElementById(hiddenrow).style.display = 'none';
	}
  }


var cnumok = "";
var shipprice = "";

function format(string) {
		var offset = 0;
		var length = 0;
//   	string = parseInt(string);
	string = Math.round(string);
	string = string/100;
  	string = eval("string");
  		string = "$" + string;
  	offset = string.indexOf(".")
  	length = string.length
    	offset = parseInt(offset);
    	length = parseInt(length);

	if (offset == -1){
	  	string = string + ".00";
	}else if ((length - offset) == 2){
  		string = string + "0";
  	}
  	return string;
  }


function calculate(form,shipcheck) {
	var shipping_method = "";
	var shipping_price = "0";
	var subtotal = eval(form.subtotal.value);
	var total = 0;
		
		for (var i = 0; i < form.shipping_method.length; i++){
			if (form.shipping_method.options[i].selected){
				shipping_method = form.shipping_method.options[i].value;

				if (shipping_method == "Ground"){
					shipping_price = 7;
					shipprice = "yes";
				}else if (shipping_method == "3day"){
					shipping_price = 11;
				}else if (shipping_method == "2day"){
					shipping_price = 17;
					shipprice = "yes";
				}else if (shipping_method == "AK2day"){
					shipping_price = 25;
					shipprice = "yes";
				}else{
					shipping_price = 0;
				}
			}
		}

		var shipping = eval(shipping_price);
		total = subtotal + shipping;
		
		showshipping_price = format(shipping_price*100);
		form.shipping_price.value = showshipping_price;

		showtotal = format(total*100);
		form.total.value = showtotal;

}

function visamc (form){
		if ((form.ccnum.value.charAt(0) == '4') || (form.ccnum.value.charAt(0) == '5')){
			cnumok = "yes";

		} else {
			cnumok = "no";
		 	alert('Please enter a Visa or Mastercard number.');
			form.ccnum.value = "";
		}
}


function check (shipform){
     if (calculate(document.shipform,'yes')){
     	if (cnumok == "yes"){
     		if (shipprice == "yes"){
     			alert('submitting!');
		 	document.shipform.submit();
		} else {
		 alert('Please select a shipping method.');
		 }
	} else {
	 alert('Please enter a Visa or Mastercard number.');
	}
      }
}


/*
 * FOLLOWING CODE IS FROM:
 * PROJECT:   mygosuMenu
 * VERSION:   1.1.0
 * COPYRIGHT: (c) 2003,2004 Cezary Tomczak
 * LINK:      http://gosu.pl/software/mygosumenu.html
 * LICENSE:   BSD (revised)
 */

var menuTimeout = 400;
var menuOffsetWidth = 0;
var menuOffsetHeight = -1;

var menuId = 'menu';
var menuTree = new Array();
var menuSections = new Array();
var menuSectionsCountHide = new Array();
var menuSectionsVisible = new Array();

var menuBrowser = navigator.userAgent.toLowerCase();
var menuBrowserIsOpera = menuBrowser.indexOf('opera') != -1;
var menuBrowserIsIE = menuBrowser.indexOf('msie') != -1 && !menuBrowserIsOpera;
    
function menuInit() {
    menuMakeIds(document.getElementById(menuId).childNodes, menuTree, menuId, 0);
    for (var i = 0; i < menuSections.length; i++) {
        menuSectionsCountHide[menuSections[i]] = 0;
    }
    for (var i = 0; i < menuSections.length; i++) {
        menuInitSection(menuSections[i], menuGetTreeById(menuSections[i]));
    }
}

function menuMakeIds(nodes, tree, id, offsetWidth) {
    for (var i = 0; i < nodes.length; i++) {
        switch (nodes[i].className) {
            case "top":
            case "box-right":
                id = id + "-" + tree.length;
                nodes[i].id = id;
                tree[tree.length] = new Array();
                tree = tree[tree.length - 1];
                break;
            case "box":
                nodes[i].id = id + "-" + tree.length;
                tree[tree.length] = new Array();
                break;
        }
        var className = new String(nodes[i].className);
        if (className == "section") {
            if (!menuBrowserIsIE) {
                nodes[i].style.width = "100%";
            }
            nodes[i].style.left = offsetWidth + menuOffsetWidth;
            nodes[i].style.top = menuOffsetHeight;
        }
        if (className.substr(0, 7) == "section") {
            menuSections[menuSections.length] = id;
            nodes[i].id = id + "-section";
            offsetWidth = nodes[i].offsetWidth;
        }
        if (nodes[i].childNodes) {
            menuMakeIds(nodes[i].childNodes, tree, id, offsetWidth);
        }
    }
}

function menuInitSection(id_section, tree) {
    eval("document.getElementById('"+id_section+"').onmouseover = function() {"+
        "menuShow('"+id_section+"');"+
        "if (document.getElementById('"+id_section+"').className == 'box-right') {"+
            "document.getElementById('"+id_section+"').className = 'box-right-hover';"+
        "}"+
    "}");
    eval("document.getElementById('"+id_section+"').onmouseout = function() {"+
        "setTimeout(\"menuTryHide('"+id_section+"', \"+menuSectionsCountHide['"+id_section+"']+\")\", menuTimeout);"+
        "if (document.getElementById('"+id_section+"').className == 'box-right-hover') {"+
            "document.getElementById('"+id_section+"').className = 'box-right';"+
        "}"+
    "}");
    for (var i = 0; i < tree.length; i++) {
        var id = id_section + "-" + i;
        if (tree[i].length == 0) {
            eval("document.getElementById('"+id+"').onmouseover = function() {"+
                "menuShow('"+id_section+"');"+
                "document.getElementById('"+id+"').className = 'box-hover';"+
            "}");
            eval("document.getElementById('"+id+"').onmouseout = function() {"+
                "setTimeout(\"menuTryHide('"+id_section+"', \"+menuSectionsCountHide['"+id_section+"']+\")\", menuTimeout);"+
                "document.getElementById('"+id+"').className = 'box';"+
            "}");
        }
    }
}

function menuShow(id_section) {
    var sections = menuGetIdParentsArrById(id_section, true);
    for (var i = 0; i < sections.length; i++) {
        menuSectionsCountHide[sections[i]]++;
    }
    for (var i = 0; i < menuSectionsVisible.length; i++) {
        if (!menuArrayContains(sections, menuSectionsVisible[i])) {
            menuHide(menuSectionsVisible[i]);
        }
    }
    document.getElementById(id_section + "-section").style.zIndex = 1;
    document.getElementById(id_section + "-section").style.visibility = 'visible';
    menuSectionsVisible = sections;
}

function menuTryHide(id_section, count) {
    if (count == menuSectionsCountHide[id_section]) {
        var sections = menuGetIdParentsArrById(id_section, true);
        if (menuArraysEqual(sections, menuSectionsVisible)) {
            for (var i = 0; i < sections.length; i++) {
                menuHide(sections[i]);
            }
        } else {
            menuHide(id_section);
        }
    }
}

function menuHide(id_section) {
    document.getElementById(id_section + "-section").style.visibility = 'hidden';
    document.getElementById(id_section + "-section").style.zIndex = -1;
}

function menuGetTreeById(id) {
    var a = id.split("-");
    a.shift();
    var s = "";
    for (var i = 0; i < a.length; i++) {
        s += ("[" + a[i] + "]");
    }
    return eval("menuTree" + s);
}

function menuGetIdParentsArrById(id, includeSelf) {
    var a = id.split("-");
    var ret = new Array();
    if (includeSelf) {
        ret[ret.length] = id;
    }
    while (a.length > 2) {
        a.pop();
        ret[ret.length] = a.join("-");
    }
    return ret;
}

function menuArrayContains(a, s) {
    var found = false;
    for (var i = 0; i < a.length; i++) {
        if (a[i] == s) {
            found = true;
            break;
        }
    }
    return found;
}

function menuArraysEqual(a1, a2) {
    if (a1.length != a2.length) {
        return false;
    }
    for (var i = 0; i < a1.length; i++) {
        if (a1[i] != a2[i]) {
            return false;
        }
    }
    return true;
}

// next bit is for itransact submissions
numberoftimes = 0;

function onlyonce() {
numberoftimes += 1;
if (numberoftimes > 1) { 

        var themessage = "Please be patient. You have already submitted this form. Pressing submit multiple times will result in your account being billed multiple times. You will receive a response momentarily.";
        if (numberoftimes == 3) {
                themessage = "DO NOT PRESS SUBMIT MULTIPLE TIMES!!! YOUR ACCOUNT WILL BE BILLED EACH TIME YOU PRESS SUBMIT!!! Processing may take up to one minute.";
        }
         alert(themessage);
         return false; 
} 
else
{
         return true;
}

}
