﻿///////////////////////////////////////////
//
// TOP NAVIGATION MOUSEOVER - for IE6
//
var topNavigationMouseovers = function() {
	if (document.all && document.getElementById) {
		var navRoot = document.getElementById("topNavigation");
		for (i = 0; i < navRoot.childNodes.length; i++) {
			var node = navRoot.childNodes[i];
			if (node.nodeName == "LI") {
				node.onmouseover = function() {
					this.className += " over";
				}
				node.onmouseout = function() {
					this.className = this.className.replace(" over", "");
				}
			}
		}
	}
}

///////////////////////////////////////////
//
// CHANGE ROTATING BANNER CONTENT ON HOMEPAGE
//
$(document).ready(function() {
    $(".auto .jCarouselLite").jCarouselLite({
        btnNext: ".auto .next",
        btnPrev: ".auto .prev",
        auto: 10000,
        speed: 800, 
        visible: 1
    });
});

///////////////////////////////////////////
//
// CHANGE ROTATING BANNER CONTENT ON HOMEPAGE
//
function overviewNav(key) {
    section = key + "_overview";
    nav = key + "_nav";

    // hide all
    document.getElementById("ttc_overview").style.display = "none";
    document.getElementById("sm_overview").style.display = "none";
    document.getElementById("em_overview").style.display = "none";
    document.getElementById("wam_overview").style.display = "none";
    document.getElementById("ntm_overview").style.display = "none";
    document.getElementById("pm_overview").style.display = "none";

    document.getElementById("ttc_nav").style.backgroundPosition = "bottom";
    document.getElementById("sm_nav").style.backgroundPosition = "bottom";
    document.getElementById("em_nav").style.backgroundPosition = "bottom";
    document.getElementById("wam_nav").style.backgroundPosition = "bottom";
    document.getElementById("ntm_nav").style.backgroundPosition = "bottom";
    document.getElementById("pm_nav").style.backgroundPosition = "bottom";

    // show
    document.getElementById(section).style.display = "block";
    document.getElementById(nav).style.backgroundPosition = "top";
}

///////////////////////////////////////////
//
// SUBPAGE: PRODUCTS TAB SELECTION
//
function productsTabSelection(tabName, thisLink) {
    // hide them all
    document.getElementById("ProductDetails_Overview").style.display = "none";
    document.getElementById("ProductDetails_Features").style.display = "none";
    document.getElementById("ProductDetails_Reporting").style.display = "none";
    document.getElementById("ProductDetails_Benefits").style.display = "none";

    // reset list item classes
    document.getElementById("Tab_Overview").className = "";
    document.getElementById("Tab_Features").className = "";
    document.getElementById("Tab_Reporting").className = "";
    document.getElementById("Tab_Benefits").className = "";

    var div = document.getElementById("ProductDetails_" + tabName).style.display = "block";
    thisLink.parentNode.className = "active";
}

///////////////////////////////////////////
//
// SHOW AND HIDE "MORE INFORMATION" DIVS ON DOWNLOADS.ASPX
//
function toggleDisplay(divID) {
	var div = document.getElementById(divID);
	var divDisplayStatus = document.getElementById(divID).style.display;
	if (divDisplayStatus == "none") {
		div.style.display = "block";
	}
	else {
		div.style.display = "none";
	}
}

function init() {
	topNavigationMouseovers();
}
window.onload = init;


///////////////////////////////////////////
//
// ARCHIVE: CONTENT RATING BOX
//
function loadContentRatingDescriptions() {
    preloadImages();

    rating = document.getElementById('ctl00_cphSubContent_hfContentRating').value;
    newImage = 'url(../images/archive/aboutRatingsTab_' + rating + '2.gif) no-repeat';
    textArea = document.getElementById('aboutRatingsText').innerHTML;

    document.getElementById('aboutRatingsTabs').style.background = newImage;

    if (rating == 'g') {
        document.getElementById('aboutRatingsText').innerHTML = "<strong>G-Rated Content</strong><br />Deemed suitable for viewers of all ages. Includes education, family, business, search, shopping, sports, computers, travel, etc.";
    }
    if (rating == 'pg') {
        document.getElementById('aboutRatingsText').innerHTML = "<strong>PG-Rated Content</strong><br />Includes some material that may be deemed unsuitable, and parental guidance is advised. Includes alcohol, sex education, personals, music, etc.";
    }
    if (rating == 'r') {
        document.getElementById('aboutRatingsText').innerHTML = "<strong>R-Rated Content</strong><br />May be suitable for high schoolers under the supervision of an adult. Includes adult material, drugs, violence, gambling, un-moderated forums, social networking sites like MySpace, Facebook, Orkut, blogs, and dating";
    }
    if (rating == 'x') {
        document.getElementById('aboutRatingsText').innerHTML = "<strong>X-Rated Content</strong><br />Suitable for adults only and includes sexually explicit, vulgar or obscene material";
    }
    if (rating == 's') {
        document.getElementById('aboutRatingsText').innerHTML = "<strong>S-Rated Content</strong><br />Contain security risks. These sites spread viruses, adware, and/or spyware. The content may also be X-rated. ";
    }
}

function contentRatingDescriptions(rating) {

    newImage = 'url(../images/archive/aboutRatingsTab_' + rating + '2.gif) no-repeat';
    textArea = document.getElementById('aboutRatingsText').innerHTML;

    document.getElementById('aboutRatingsTabs').style.background = newImage;

    if (rating == 'g') {
        document.getElementById('aboutRatingsText').innerHTML = "<strong>G-Rated Content</strong><br />Deemed suitable for viewers of all ages. Includes education, family, business, search, shopping, sports, computers, travel, etc.";
    }
    if (rating == 'pg') {
        document.getElementById('aboutRatingsText').innerHTML = "<strong>PG-Rated Content</strong><br />Includes some material that may be deemed unsuitable, and parental guidance is advised. Includes alcohol, sex education, personals, music, etc.";
    }
    if (rating == 'r') {
        document.getElementById('aboutRatingsText').innerHTML = "<strong>R-Rated Content</strong><br />May be suitable for high schoolers under the supervision of an adult. Includes adult material, drugs, violence, gambling, un-moderated forums, social networking sites like MySpace, Facebook, Orkut, blogs, and dating";
    }
    if (rating == 'x') {
        document.getElementById('aboutRatingsText').innerHTML = "<strong>X-Rated Content</strong><br />Suitable for adults only and includes sexually explicit, vulgar or obscene material";
    }
    if (rating == 's') {
        document.getElementById('aboutRatingsText').innerHTML = "<strong>S-Rated Content</strong><br />Contain security risks. These sites spread viruses, adware, and/or spyware. The content may also be X-rated. ";
    }
}

function preloadImages() {
    if (document.images) {
        picG = new Image(44, 182);
        picG.src = "../images/archive/aboutRatingsTabG2.gif";

        picPG = new Image(44, 182);
        picPG.src = "../images/archive/aboutRatingsTabPG2.gif";

        picR = new Image(44, 182);
        picR.src = "../images/archive/aboutRatingsTabR2.gif";

        picX = new Image(44, 182);
        picX.src = "../images/archive/aboutRatingsTabX2.gif";

        picS = new Image(44, 182);
        picS.src = "../images/archive/aboutRatingsTabS2.gif";
    }
}

///////////////////////////////////////////
//
// ARCHIVE: TAB NAVIGATION FOR WEBSITE DETAILS
//
function gotoWebsiteDetailsSection(id) {
    detailsLayer = "Details_" + id.toString();
    detailsLink = "Link_" + id.toString();

    //Hide all layers first
    document.getElementById("Details_General").style.display = "none";
    document.getElementById("Details_Reason").style.display = "none";
    document.getElementById("Details_SiteLinks").style.display = "none";
    document.getElementById("Details_Labels").style.display = "none";
    document.getElementById("Details_UniqueWords").style.display = "none";

    //Reset tab styles
    document.getElementById("Link_General").parentNode.id = "";
    document.getElementById("Link_Reason").parentNode.id = "";
    document.getElementById("Link_SiteLinks").parentNode.id = "";
    document.getElementById("Link_Labels").parentNode.id = "";
    document.getElementById("Link_UniqueWords").parentNode.id = "";

    //Show the requested layer and style tab
    document.getElementById(detailsLayer).style.display = "block";
    document.getElementById(detailsLink).parentNode.id = "current";

}


///////////////////////////////////////////
//
// ARCHIVE: SUBMIT FOR REVIEW BOX
//
function showHideReviewForm() {
    if (document.getElementById('reviewForm').style.display == "none") {
        document.getElementById('reviewForm').style.display = "block";
        document.getElementById('reviewLink').innerHTML = "Cancel";
    }
    else {
        document.getElementById('reviewForm').style.display = "none"
        document.getElementById('reviewLink').innerHTML = "Submit this website for review";
    }
   }

///////////////////////////////////////////
//
// DISPLAY ERROR FEEDBACK ON TRAINING REGISTRATION PAGE
//
function registrationWaitText() {
	var messageText = document.getElementById("ctl00_cphSubContent_lblFormIncompleteMessage");
	messageText.innerHTML = "<img src=\"../images/ajax-loader.gif\"/>";
}

///////////////////////////////////////////
//
// VIRUS PROCESS
//
function waitForVirusProcess() {
	var message = document.getElementById("ctl00_cphSubContent_lblMessage");
	message.innerHTML = "Please wait while we process your file...";
	message.className = "message wait";

	document.getElementById("ctl00_cphSubContent_pnlVirusDetails").innerHTML = "";

	document.getElementById("ctl00_cphSubContent_lblError").innerHTML = "";
	document.getElementById("ctl00_cphSubContent_lblError").className = "";
}

function clearVirusDetails() {
	document.getElementById("ctl00_cphSubContent_pnlVirusDetails").innerHTML = "";
}

/*function addFileUpload() {
	var fileHolder = document.getElementById("fileUploadHolder");
	var fileUpload = "<br /><input type=\"file\">";
	fileHolder.innerHTML += fileUpload;
}*/
