// COIS Specific js scripts
// JavaScript Document
// CONSTANTS: 
var sProtocol = location.protocol;
var sHost = location.hostname;
var testDir = "";
var site = getSite();

function getSite() {
	var myRegExp = new RegExp("-(dev|staging|qa)");
	var sVal = sProtocol + '//' + sHost + "/";
	
	if (myRegExp.test(sHost) && testDir.length > 0) {
		return sVal + testDir;
		} else {
		return sVal;
	}	
}

function initPage() {
	footnoteLinks('accessContent','accessContent');
}
// Custom script to apply a style to the current page link in nav area
// FF
function initNav() {
	var i = 0;
	
	// Find the unordered list that contains the navigtion links
		
	// Get all ULs within this one
	
	// We will loop through the array of anchors in this UL
	
	// Determine how many items are in the list
	
	// Loop through the links until we find the one that corresponds to the current
	// page. It's new style will be applied and it will apply the style to its
	// "parent" links.
	
	
	// Now the styles are applied so we can hide all ULs that do not have any
	// styled anchors or a styled parent anchor


}

// findNonFeaturedUL
// Finds the first UL in the "nav" div that is not within the 'news' section
// this is only for 2+ column templates

function findNonNewsUL() {
	var i=0;
	var newsObj = document.getElementById('news');
	var navObj = document.getElementById('nav');
	
	if (navObj == null)
	{
		alert("Page Error: 'nav' div not found.");
		return null;
	}
	if (featuredObj == null)
	{
		alert("Developer alert: Your page does not have the 'featured' div tag. "+
			  "Even if you do not have featured links it is recommended that you leave the featured div tag in your page.");
		return navObj.getElementsByTagName("ul")[0];
	}
	
	// Get the list of ULs within the featured section
	var featuredULs = featuredObj.getElementsByTagName("ul");
	if (featuredULs.length == 0)
	{
		return navObj.getElementsByTagName("ul")[0];
	}
	// else...
	
	var ullist = navObj.getElementsByTagName("ul");
	while (ullist[i] === featuredULs[0])
	{
		i++;	
	}
	return ullist[i];
}
// script.a.li.cious re-write - Only use when site is served by IIS 6

/*
	Custom javascript used to test Prototype on COIS

window.onload=function(){
    if($("name_info")) {
        $("name_info").onblur=function(  ){
            if($F("name_info")){
                _url="http://localhost:8080/hacks/proto";
                showInfo(_url);
            }
        }
    }
};

function showInfo(go_url){
    if($("display_area") && go_url){
        var xmlHttp= new Ajax.Request(go_url, {method: "post",
                parameters: Form.serialize(document.forms[0]),
                onComplete:function(  ){
            if(xmlHttp.responseIsFailure(  )) {
                var sts = xmlHttp.transport.status ? xmlHttp.
                transport.status : "undefined";
                $("display_area").value=
                "XMlHttpRequest returned response status "+sts;
                document.getElementById("msg").innerHTML=
                "HTTP response and server information; "+
                "response status="+
                xmlHttp.transport.status;
            } else {
                $("display_area").value=xmlHttp.transport.responseText;
                document.getElementById("msg").innerHTML=
                "HTTP response and server information; "+
                "response status="+
                xmlHttp.transport.status;
            }
        }});
    }
}
*/

