﻿// JScript File



$(function() { $("ul#newsticker").liScroll(); });

$(document).ready(
function() {
$('#promostic').innerfade({
animationtype: 'fade',
speed: 750,
timeout: 5000,
type: 'sequence',
containerheight: '1em'
});

$('.fade').innerfade({
speed: 'slow',
timeout: 2000,
type: 'sequence',
containerheight: '1.5em'
});
}
);


sfHover = function() {
var sfEls = document.getElementById("topnav_base").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=" sfhover";
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


function showDetails(whichDetail) {
    detailToShow = document.getElementById(whichDetail);
    currentClass = detailToShow.className;
    if(currentClass == "hiddenDetail") {
        detailToShow.className = "shownDetail";
    } else {
        detailToShow.className = "hiddenDetail";
    }
}

function checkExtrasStatus() {
    theForm = document.aspnetForm;
    inputElements = new Array();
    for(thing in theForm) {
        thingName = thing.toString();
        if(thingName.indexOf('article') != -1) {
            if(theForm[thing].tagName.toLowerCase() == 'input') {
                if(theForm[thing].type.toLowerCase() == 'checkbox') {
                    if(theForm[thing].checked) {
                        myParentNode = theForm[thing].parentNode;
                        mycode = myParentNode.title;
                        inputElements.push(mycode);
                    }
                }
            }
        }
    }
    theForm.selectedextras.value = inputElements.toString(); 
    getExtrasTotal();                    
}

function getExtrasTotal() {
    theForm = document.aspnetForm;
    extrasTotal = Number(0);
    inputElementsList = theForm.selectedextras.value.split(',');
    var rebate = theForm.rebate.value;
    if (rebate.indexOf(",") >= 0) 
        rebate = rebate.replace(/,/, ".");  
        
    if(inputElementsList != "") {
        for(i = 0; i <= inputElementsList.length - 1; i ++) {
            priceField = document.getElementById("price" + inputElementsList[i]);
            itemPrice = priceField.innerHTML;
            extrasTotal += Number(itemPrice);
        }
        document.getElementById('extrasDisp').innerHTML = extrasTotal;
        document.getElementById('totalDisp').innerHTML = Number(Number(Number(theForm.courseprice.value) + extrasTotal) - Number(rebate));
    } else {
        extrasTotal = Number(0);
        document.getElementById('extrasDisp').innerHTML = extrasTotal;
        document.getElementById('totalDisp').innerHTML = Number(Number(Number(theForm.courseprice.value) + extrasTotal) - Number(rebate));
    }
}         
  function submitForm(url)
  {
    theForm = document.aspnetForm;
    action = url;
    theForm.action = action;
    theForm.submit();
  }