// NAVIGATION
Nwait = 100;
Ndelay = 350;
NimgPath = "media_features/img/nav/";
NsublevelOn = false;

function showSublevel(NavID) {
  // shows subnav + highlight mainnav
  NoldSNhtml = typeof(NoldSNhtml) == 'undefined' ? document.getElementById("subnav").innerHTML : NoldSNhtml;
  for(var i=0; i<NavIDs.length; i++) {
    document[NavData[NavIDs[i]]["name"]].src = NavIDs[i]==NavID ? NimgPath+NavData[NavIDs[i]]["active"] : NimgPath+NavData[NavIDs[i]]["inactive"];
  }
  document.getElementById("subnav").innerHTML = NavID==NavCurrent ? NoldSNhtml : NavData[NavID]["snhtml"];
}
function revertNav() {
  NoldSNhtml = typeof(NoldSNhtml) == 'undefined' ? document.getElementById("subnav").innerHTML : NoldSNhtml;
  // reset nav + subnav
  if(!NsublevelOn) {
    document.getElementById("subnav").innerHTML = NoldSNhtml;
    for(var i=0; i<NavIDs.length; i++) {
      document[NavData[NavIDs[i]]["name"]].src = NavIDs[i]==NavCurrent ? NimgPath+NavData[NavIDs[i]]["active"] : NimgPath+NavData[NavIDs[i]]["inactive"];
    }
  }
}
function rollOverMN(NavID) {
		Ntimeout = setTimeout("showSublevel('"+NavID+"')",Ndelay);
  NsublevelOn = true;
}
function rollOverSN() {
  NsublevelOn = true;
}
function hideSublevel() {
		if(NsublevelOn){
			clearTimeout(Ntimeout);
			NsublevelOn = false;
		}
}
function rollOutMNSN(){
		setTimeout("revertNav()",Ndelay);
		NsublevelOn = false;
}


// WINOPEN CODE
function winOpen(f, n, w, h) {
  w = window.open(f,n,'width='+w+',height='+h+',left='+(screen.width/2-w/2)+',top='+(screen.height/2-h/2)+',toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no');
  w.focus();
}
function winFlashOpen(f, n, w, h) {
  w = window.open(f,n,'width='+w+',height='+h+',left='+(screen.width/2-w/2)+',top='+(screen.height/2-h/2)+',toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
  w.focus();
}

function processform(origin) {
  if(origin=='cc') {
    document.donation_form.txtDonpurp.value = (document.donation_form.fv_100_donation_purpose_id) ? document.donation_form.fv_100_donation_purpose_id.options[document.donation_form.fv_100_donation_purpose_id.selectedIndex].text : document.donation_form.txtDonpurptxt.value;
    document.donation_form.txtTotal.value = document.donation_form.fv_100_donation_amount_fix.options[document.donation_form.fv_100_donation_amount_fix.selectedIndex].value;
    document.donation_form.submit();
  }
  else {
    myPurp = (document.donation_form.fv_100_donation_purpose_id) ? document.donation_form.fv_100_donation_purpose_id.options[document.donation_form.fv_100_donation_purpose_id.selectedIndex].value : document.donation_form.txtDonpurp.value;
    myurl = '/page2.php?pid=11000&fv_100_feature_id=878&fv_100_donation_mode=fix&fv_100_donation_amount='+document.donation_form.fv_100_donation_amount_fix.options[document.donation_form.fv_100_donation_amount_fix.selectedIndex].value+'&fv_100_donation_purpose_id='+myPurp;
    document.location = myurl;
  }
}

// flash hack
var bo_ns_id = 0;
function startIeFix() {
    if (isIE()) {
        document.write('<div id="bo_ns_id_' + bo_ns_id + '"><!-- ');
    }
}

function endIeFix() {  
    if (isIE()) {
        document.write('</div>');
        var theObject = document.getElementById("bo_ns_id_" + bo_ns_id++);
        var theCode = theObject.innerHTML;
        theCode = theCode.substring(4 ,9+theCode.indexOf("</object>"))
        document.write(theCode);
    }
}

function isIE() {
    var strBrwsr= navigator.userAgent.toLowerCase();
    if (strBrwsr.indexOf("msie") > -1 && strBrwsr.indexOf("mac") < 0) {
        if(parseInt(strBrwsr.charAt(strBrwsr.indexOf("msie")+5)) < 6) {
            return false;
        }
        if (strBrwsr.indexOf("win98") > -1
        || strBrwsr.indexOf("win 9x 4.90") > -1
        || strBrwsr.indexOf("winnt4.0") > -1
        || strBrwsr.indexOf("windows nt 5.0") > -1) {
            return false;
        }
        return true;
    } else {
        return false;
    }
}
