$(document).ready(function() {

    var myInterval = 0; // STARTS and Resets the loop if any
    //    var hpindex = 0;
    //    var hplinks = ["/news-events/signature-events/prevention-roundtables.aspx", "/solutions/higher-education/professional-development-institute.aspx"];
    //    var hpimages = ["/Upload/homepage/roundtable_home.jpg", "/Upload/homepage/PDIBENTLEY_home.jpg"];

    $("#menu h4:contains('About')").addClass("aboutLink");
    $("#menu h4:contains('About')").show();

    $("#menu h4:contains('News')").addClass("aboutLink");
    $("#menu h4:contains('News')").show();

    if ($(".aboutLink").length) {
        $(".subMenu").addClass("aboutNav");
        $(".secondary .box").addClass("aboutBox");
    }

    /*$(#menu_contactus).mouseover(function() {
	$(this).css('cursor', 'pointer');
    });*/

    $("#menu_contactus").click(function() {
            window.location.href("/about/contact.aspx"); 
        });




    /*For some reason this is messing up the APCompass sub-page nav*/
    $("#tabButtons li:last").addClass("last");
    $(".subMenu ul").addClass("linkStyle");
    $(".subMenu ul .linkStyle").hide();
    $(".aboutNav .linkStyle").hide();

    if ($(".current").length) {
        $(".current").parent().show();
        $(".current").children().show();
    } else {
        $(".trail").children().show();
    }

    /*Coalition Site JavaScript */
    if ($("#APCMenu").length) {
        /* PV: Coalition tab should always be in "on" state, even on mouseout */
        $("#menu_coalition a img").attr("src", "/App_Themes/OTC/coalition_over.jpg");
        $("#menu_coalition a img").bind("mouseout", function(event) {
            $(event.target).attr("src", "/App_Themes/OTC/coalition_over.jpg");
        });

        /* PV temporary JS to set proper images. Delete once source has been updated */
        $("#aboutimg").attr("src", "/App_Themes/OTC/C2_OurMission.jpg");
        $("#partnersimg").attr("src", "/App_Themes/OTC/C2_CoalitionPartners.jpg");
        $("#toolsimg").attr("src", "/App_Themes/OTC/C2_ResearchAndTools.jpg");
        $("#bulletinimg").attr("src", "/App_Themes/OTC/C2_TheBulletin.jpg");
        $("#leadershipimg").attr("src", "/App_Themes/OTC/C2_nav_09.jpg");

        $("#aboutimg").bind("mouseover", function(event) {
            $(event.target).attr("src", "/App_Themes/OTC/C2_OurMission_ON.jpg");
        });
        $("#partnersimg").bind("mouseover", function(event) {
            $(event.target).attr("src", "/App_Themes/OTC/C2_CoalitionPartners_ON.jpg");
        });
        $("#toolsimg").bind("mouseover", function(event) {
            $(event.target).attr("src", "/App_Themes/OTC/C2_ResearchAndTools_ON.jpg");
        });
        $("#bulletinimg").bind("mouseover", function(event) {
            $(event.target).attr("src", "/App_Themes/OTC/C2_TheBulletin_ON.jpg");
        });
        $("#leadershipimg").bind("mouseover", function(event) {
            $(event.target).attr("src", "/App_Themes/OTC/C2_navON_09.jpg");
        });

        $("#aboutimg").bind("mouseout", function(event) {
            $(event.target).attr("src", "/App_Themes/OTC/C2_OurMission.jpg");
        });
        $("#partnersimg").bind("mouseout", function(event) {
            $(event.target).attr("src", "/App_Themes/OTC/C2_CoalitionPartners.jpg");
        });
        $("#toolsimg").bind("mouseout", function(event) {
            $(event.target).attr("src", "/App_Themes/OTC/C2_ResearchAndTools.jpg");
        });
        $("#bulletinimg").bind("mouseout", function(event) {
            $(event.target).attr("src", "/App_Themes/OTC/C2_TheBulletin.jpg");
        });
        $("#leadershipimg").bind("mouseout", function(event) {
            $(event.target).attr("src", "/App_Themes/OTC/C2_nav_09.jpg");
        });
        $("#moLink1").bind("mouseover", function(event) {
        $("#moLinkImage").attr("src", "/Upload/coalitionimages/newimages/AlcoholFreeOptions-01-01-01.png");
        $("#moLink1").addClass("moActive");            
        });
        $("#moLink1").bind("mouseout", function(event) {
	$("#moLinkImage").attr("src", "/Upload/CoalitionImages/newImages/GreyBubbles-01.png");
        $("#moLink1").removeClass("moActive");
        });
        $("#moLink2").bind("mouseover", function(event) {
        $("#moLinkImage").attr("src", "/Upload/coalitionimages/newimages/MedicalAmnesty-01-01-01.png");
        $("#moLink2").addClass("moActive");
        });
        $("#moLink2").bind("mouseout", function(event) {
	$("#moLinkImage").attr("src", "/Upload/CoalitionImages/newImages/GreyBubbles-01.png");
        $("#moLink2").removeClass("moActive");
        });
        $("#moLink3").bind("mouseover", function(event) {
            $("#moLinkImage").attr("src", "/Upload/coalitionimages/newimages/RBSTraining-01-01-01.png");
            $("#moLink3").addClass("moActive");
        });
        $("#moLink3").bind("mouseout", function(event) {
	$("#moLinkImage").attr("src", "/Upload/CoalitionImages/newImages/GreyBubbles-01.png");
        $("#moLink3").removeClass("moActive");
        });
        

        /* make sure the sub-menu item is selected based on the path*/
        var pathname = ((window.location).toString()).toLowerCase();
        //var pathname = "http://www.outsidetheclassroom.com/coalition/about.aspx";
        if (pathname.indexOf("mission") >= 0) {
            /*set the about sub-menu tab to on*/
            $("#aboutimg").attr("src", "/App_Themes/OTC/C2_OurMission_ON.jpg");
            $("#aboutimg").unbind("mouseout");
            $("#aboutimg").bind("mouseout", function(event) {
                $(event.target).attr("src", "/App_Themes/OTC/C2_OurMission_ON.jpg");
            });
        } else if (pathname.indexOf("coalitionpartners") >= 0) {
            $("#partnersimg").attr("src", "/App_Themes/OTC/C2_CoalitionPartners_ON.jpg");
            $("#partnersimg").unbind("mouseout");
            $("#partnersimg").bind("mouseout", function(event) {
                $(event.target).attr("src", "/App_Themes/OTC/C2_CoalitionPartners_ON.jpg");
            });
        } else if (pathname.indexOf("researchandtools") >= 0) {
            $("#toolsimg").attr("src", "/App_Themes/OTC/C2_ResearchAndTools_ON.jpg");
            $("#toolsimg").unbind("mouseout");
            $("#toolsimg").bind("mouseout", function(event) {
                $(event.target).attr("src", "/App_Themes/OTC/C2_ResearchAndTools_ON.jpg");
            });
        } else if (pathname.indexOf("thebulletin") >= 0) {
            $("#bulletinimg").attr("src", "/App_Themes/OTC/C2_TheBulletin_ON.jpg");
            $("#bulletinimg").unbind("mouseout");
            $("#bulletinimg").bind("mouseout", function(event) {
                $(event.target).attr("src", "/App_Themes/OTC/C2_TheBulletin_ON.jpg");
            });
        } else if (pathname.indexOf("leadershipinstitute") >= 0) {
            $("#leadershipimg").attr("src", "/App_Themes/OTC/C2_navON_09.jpg");
            $("#leadershipimg").unbind("mouseout");
            $("#leadershipimg").bind("mouseout", function(event) {
                $(event.target).attr("src", "/App_Themes/OTC/C2_navON_09.jpg");
            });
        }
        $(".page").css("margin-top", "0px")
    }

    if ($("#menu_coalition").length) {
        $(".topMenu li").css("margin", "0px 20px")
        /*.topMenu li { float:left; margin:0px 38px; display:inline;}*/
    }



    /* PV ... outdated  HRH uncommented on 1/11 tofix bug*/
    var current = $(".topMenu .current img").attr("alt");
    $(".topMenu .current img").attr("src", "/App_Themes/OTC/" + current + "_over.jpg");
	$(".topMenu .current img").unbind("mouseout");
	$(".topMenu .current img").bind("mouseout", function(event) {
        $(event.target).attr("src", "/App_Themes/OTC/" + current + "_over.jpg");});
    var trail = $(".topMenu .trail img").attr("alt");
    $(".topMenu .trail img").attr("src", "/App_Themes/OTC/" + trail + "_over.jpg");
    	$(".topMenu .trail img").unbind("mouseout");
	$(".topMenu .trail img").bind("mouseout", function(event) {
        $(event.target).attr("src", "/App_Themes/OTC/" + trail + "_over.jpg");});


    /*this will fix the site map (remove images added for the nav)*/
    if ($("#sitemap").length) {
        $("#sitemap").find("img").each(function(i) {
            $(this).closest("a").text($(this).attr("alt"));
        })
    }

    /*This will start the loop on the news page but only if we're on the news page*/
    if ($('#rotateImg').length) {
        runNewsLoop(0);
    }
    if ($('#rotateImg2').length) {
        runNewsLoop2(0);
    }

    function newsItemNext() {
        var SelectedDiv = $(".selected").attr("id"); //
        $("#sTab div").removeClass("selected");
        if ($("#" + SelectedDiv).next("div").length) {
            $("#" + SelectedDiv).next("div").addClass("selected");
        } else {
            $("#sTab").children(":first").addClass("selected")
        }
	if ($("#rImg").attr("src") == "Upload/images/news/newsitem13.png") {
	$("#rImg").attr("src", "/Upload/images/news/" + $(".selected").attr("id") + ".png");
	}
	else   {
        $("#rImg").attr("src", "/Upload/images/site/" + $(".selected").attr("id") + ".jpg");
	}
        $("#rImg").click(function() {
            window.clearInterval(intvarM); // this method returns undefined
        });
        $("#sTab div").click(function() {
            window.clearInterval(intvarM); // this method returns undefined
        });
    }

    function newsItemNext2() {
        var SelectedDiv = $(".selected").attr("id"); //
        $("#sTab div").removeClass("selected");
        if ($("#" + SelectedDiv).next("div").length) {
            $("#" + SelectedDiv).next("div").addClass("selected");
        } else {
            $("#sTab").children(":first").addClass("selected")
        }
	$("#rImg").attr("src", "/Upload/images/news/" + $(".selected").attr("id") + ".png");
	
        $("#rImg").click(function() {
            window.clearInterval(intvarM); // this method returns undefined
        });
        $("#sTab div").click(function() {
            window.clearInterval(intvarM); // this method returns undefined
        });
    }

    function runNewsLoop(myInterval) {
        // alert("calling the looping function");
        var iFrequency = 5000; // expressed in miliseconds
        intvarM = window.setInterval(function() {
            newsItemNext();
        }, 5000);
    }
    function runNewsLoop2(myInterval) {
        // alert("calling the looping function");
        var iFrequency = 5000; // expressed in miliseconds
        intvarM = window.setInterval(function() {
            newsItemNext2();
        }, 5000);
    }
    /*This handles the click on the news story and loads the image in the window*/
    $("#sTab div").click(function() {
        $("#sTab div").removeClass("selected");
        $(this).closest("div").addClass("selected");
/*TODO: Change this path to /upload/images/news....png*/
        $("#rImg").attr("src", "/Upload/images/site/" + $(this).attr("id") + ".jpg");
    });

//High Risk Drinking Mouseover
$("#enrollImg").bind("mouseover", function() {
                $("#imgBanner").attr("src", "/Upload/images/mouseover/enrollment_b.png");
            });
$("#enrollImg").bind("mouseout", function() {
                $("#imgBanner").attr("src", "/Upload/images/mouseover/default.png");
            });
$("#enrollImg").click(function() {
		$("#enrollImg").unbind("mouseout");
                $("#imgBanner").attr("src", "/Upload/images/mouseover/enrollment_b.png");
            });
$("#arepImg").bind("mouseover", function() {
                $("#imgBanner").attr("src", "/Upload/images/mouseover/academicrep_b.png");
            });
$("#arepImg").bind("mouseout", function() {
                $("#imgBanner").attr("src", "/Upload/images/mouseover/default.png");
            });
$("#arepImg").click(function() {
		$("#arepImg").unbind("mouseout");
                $("#imgBanner").attr("src", "/Upload/images/mouseover/academicrep_b.png");
            });
$("#seImg").bind("mouseover", function() {
                $("#imgBanner").attr("src", "/Upload/images/mouseover/studentEngage_b.png");
            });
$("#seImg").bind("mouseout", function() {
                $("#imgBanner").attr("src", "/Upload/images/mouseover/default.png");
            });
$("#seImg").click(function() {
		$("#seImg").unbind("mouseout");
                $("#imgBanner").attr("src", "/Upload/images/mouseover/studentEngage_b.png");
            });
$("#retentionImg").bind("mouseover", function() {
                $("#imgBanner").attr("src", "/Upload/images/mouseover/retention_b.png");
            });
$("#retentionImg").bind("mouseout", function() {
                $("#imgBanner").attr("src", "/Upload/images/mouseover/default.png");
            });
$("#retentionImg").click(function() {
		$("#retentionImg").unbind("mouseout");
                $("#imgBanner").attr("src", "/Upload/images/mouseover/retention_b.png");
            });
$("#costImg").bind("mouseover", function() {
                $("#imgBanner").attr("src", "/Upload/images/mouseover/costMgmt_b.png");
            });
$("#costImg").bind("mouseout", function() {
                $("#imgBanner").attr("src", "/Upload/images/mouseover/default.png");
            });
$("#costImg").click(function() {
		$("#costImg").unbind("mouseout");
                $("#imgBanner").attr("src", "/Upload/images/mouseover/costMgmt_b.png");
            });
$("#brandImg").bind("mouseover", function() {
                $("#imgBanner").attr("src", "/Upload/images/mouseover/brand_b.png");
            });
$("#brandImg").bind("mouseout", function() {
                $("#imgBanner").attr("src", "/Upload/images/mouseover/default.png");
            });
$("#brandImg").click(function() {
		$("#brandImg").unbind("mouseout");
                $("#imgBanner").attr("src", "/Upload/images/mouseover/brand_b.png");
            });

//Created 1/10 for redesign

    /*This will start the new home page loop of feature images*/
    if ($('#scrollbox').length) {
        runfeatureLoop(0);
    }

    function featureItemNext() {
        var SelectedDiv = $(".selected").attr("id"); //
        $("#scrollBtns div").removeClass("selected");

        if ($("#" + SelectedDiv).next("div").length) {
            $("#" + SelectedDiv).next("div").addClass("selected");
        } else {
            $("#scrollBtns").children(":first").addClass("selected")
   	$("#scrollBtns").children(":first").addClass("selected")
        }
        $("#scrollFeature").attr("src", "http://www.outsidetheclassroom.com/Upload/images/redesign/" + $(".selected").attr("id") + ".png");

        //$("#scrollFeature").click(function() {
         //   window.clearInterval(intvarM); // this method returns undefined
        //});
        $("#scrollBtns div").click(function() {
                 window.clearInterval(intvarM);
    });
	}


    function runfeatureLoop(myInterval) {
        // alert("calling the looping function");
        var iFrequency = 5000; // expressed in miliseconds
        intvarM = window.setInterval(function() {
            featureItemNext();
        }, 4000);
    }

    /*This handles the click on the news story and loads the image in the window*/
    $("#scrollBtns div").click(function() {
        $("#scrollBtns div").removeClass("selected");
        $(this).closest("div").addClass("selected");

        $("#scrollFeature").attr("src", "http://www.outsidetheclassroom.com/Upload/images/redesign/" + $(this).attr("id") + ".png");
    });





    //This will run the home page discussion through a loop
    if ($('#startMedia').length) {
        //commenting out the loop when putting the image fade in place.
        //runHomePageLoop(0);

        //This will run the what's new images through a loop
        //banner_rotate();
        //	$("#startMedia IMG:first").show();
        //	$("#startMedia img:first").show();
        $("#startMedia img:first").show();
        if ($("#startMedia img").length > 1) {
            runStartAnimation($("#startMedia img:first"), 2000, 1000);
        }

    }


    function runHomePageLoop(myInterval) {
        // alert("calling the looping function");
        var iFrequency = 5000; // expressed in miliseconds
        intvarH = window.setInterval(function() {
            contentItemNext();
        }, 5000);
    }


    function contentItemNext() {
        var SelectedDiv = $(".tabItem.selected").attr("id"); //
        $("#midLeft div").removeClass("selected");
        if ($("#" + SelectedDiv).next("div").length) {
            $("#" + SelectedDiv).next("div").addClass("selected");
        } else {
            $("#midLeft").children(":first").addClass("selected")
        }
        $("#tabButtons li").removeClass("selected");
        $("#tabButtons li").eq($("#midLeft div").index($("#midLeft div.selected"))).addClass("selected");


        //find out if we're supposed to pause the loop if they click inside the div?
        $("#midLeft div").click(function() {
            window.clearInterval(intvarH); // this method returns undefined
        });
        $("#tabButtons li").click(function() {
            window.clearInterval(intvarH); // this method returns undefined
        });
    }

    //This is the functionality of the home page tabs (discussion topics)
    $("#tabButtons li").click(function() {
        $("#tabButtons li").removeClass("selected");
        $(this).closest("li").addClass("selected");
        $("#midLeft div").removeClass("selected");

        $("#midLeft div").eq($("#tabButtons li").index(this)).addClass("selected");
        //window.clearInterval(myInterval);
    });

    //This is the functionality of the discussion page tabs (not as good as above code, improve later)
    $("div.bTabs").click(function() {
        $("div.bTabs").removeClass("selected");
        $(this).addClass("selected");
        $("div.blogStory ").removeClass("selected");
        varTab = $(this).attr("id") + "story";
        $("#" + varTab).addClass("selected");
    });

    //This will show/hide the right story depending on the URL (to handle clicks from home and other pages)
    //TODO: only run this on the Discussion page (put in function? or use URL to trigger?)
    var tabItem = getQuerystring("tabItem", "0");
    if ((tabItem == "2") || (tabItem == "3") || (tabItem == "4")) {
        //show the appropriate story
        $("div.bTabs").removeClass("selected");
        $("div.blogStory ").removeClass("selected");
        $("#blogTab" + tabItem).addClass("selected");
        $("#blogTab" + tabItem + "story").addClass("selected");
    }


    //This will hide the date on News Items inside the Community section
    if (($('body.newsContainer').length) || ($('body.news').length)) {
        //alert("This is a news page!");
        if ($('#menu_community.trail').length) {
            //alert("this is a news page in the community section!!");
            //Now hide the date class
            $('.date').hide();
        }
    }

    //This will show the error message on the Ecommerce pages if the login fails
    if ($('#invalidLogin').length) {
        //alert("This is an ecommerce page!");
        if (getQuerystring("err", "0") == "invalid") {
            $('#invalidLogin').addClass("display");
        }
    }



    if ($('#glass').length) {
        //We're on the student blog page
        if ($('#commentDesc').length) {
            //It has a comment form, modify it to the student version
            $('#commentDesc').text("If you are responding to a particular blog entry, please indicate this in your response, thanks!");
            $('#ctl00_PageWrapper_ContentAndSidebar_ctl03_lblTitle').hide();
            $('#ctl00_PageWrapper_ContentAndSidebar_ctl03_txtTitle').hide();
        }
    }

    //Need to add click function to the image that will change window location to the img title attr.
    function runStartAnimation(jElement, delay, fadeTime) {
        $(jElement).delay(delay, function() {
            $(jElement).fadeOut(fadeTime, function() {
                if ($(this).parent().next().children("img").length > 0) {
                    $(this).parent().next().children("img").fadeIn(fadeTime, function() {
                        runStartAnimation($(this), delay, fadeTime);
                    });
                } else {
                    $("#startMedia img:first").fadeIn(fadeTime, function() {
                        runStartAnimation($(this), delay, fadeTime);
                    });
                }
            });
        });
    }

    function addToFavorites(url, title) {
        if (window.sidebar) { // Mozilla Firefox Bookmark
            window.sidebar.addPanel(title, url, "");
        } else if (window.external) { // IE Favorite
            window.external.AddFavorite(url, title);
        }
    }

    function checkTerms() {
        if ($("#IAgreeCheckBox").attr("checked") != true) {
            alert(TRANSLATE_YOU_NEED_TO_AGREE_TO_TERMS);
            return false;
        }
    }


    $(function() {
        $("#sbutton").click(function() {
            var txtPassword = $("input#txtPassword").val();
            var txtEmail = $("input#txtEmail").val();
            document.forms[0].action = "/ui/SendToPost.aspx?";
            document.forms[0].method = "POST";
            document.forms[0].submit();
        });
    });
    $(function() {
        $("#loginbutton").click(function() {
            document.forms[0].action = "/ui/SendToPost.aspx?login=1";
            document.forms[0].method = "POST";
            document.forms[0].submit();
            // return false;
        });
    });


    /* show the nav on the APCompass sub-pages*/
    if ($("#APCMenu").length) {
        if ($(".subMenu .current").length) {
            $(".subMenu ul .linkStyle").show();
        } else {
            $(".trail").children().show();
        }
    }

    if ($("#APCMenu").length) {
        $(".PopUp").popup();
    }


	$.urlParam = function(name){
		var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
		if (!results) { return 0; }
		return results[1] || 0;
	}

if ($("#youthInstr").length) {
//Show login info on youth instruction page

	var custType = $.urlParam('type');
	var custPassword = $.urlParam('pwd');
	var custLogin = $.urlParam('login');
	var LoginInfoText = "Use this Unique ID: " + custLogin + " and <br>Password: " + custPassword + "<br><br>";

$("#loginInfo").html(LoginInfoText);

//alert($("#loginInfo").text); 


	if (custType == "1") {
	//Not sure which coursetype this is
	 $("#loginInfo").removeClass("hideDiv");

 	} else if (custType =="2"){
	 $("#youthInstr").removeClass("hideDiv");
         $("#loginInfo").removeClass("hideDiv");

} else if (custType =="4") {
	$("#tdInstr").removeClass("hideDiv");
	$("#loginInfo").removeClass("hideDiv");
}



}//end check for youthInstr div



});  //closes document ready


  //Fix the IE getElementByID Bug (what will this do to IE that works?)
  if (/msie/i.test (navigator.userAgent)) //only override IE
{
	document.nativeGetElementById = document.getElementById;
	document.getElementById = function(id)
	{
		var elem = document.nativeGetElementById(id);
		if(elem)
		{
			//make sure that it is a valid match on id
			if(elem.id == id)
			{
				return elem;
			}
			else
			{
				//otherwise find the correct element
				for(var i=1;i<document.all[id].length;i++)
				{
					if(document.all[id][i].id == id)
					{
						return document.all[id][i];
					}
				}
			}
		}
		return null;
	};
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;


   for (i = 0; i < sText.length && IsNumber == true; i++)
      {
      Char = sText.charAt(i);
      if (ValidChars.indexOf(Char) == -1)
         {
         IsNumber = false;
         }
      }
   return IsNumber;

   }

   function readLoginInfo(){
                //alert( $.cookie("iRole") );
                var iRole = $.cookie("iRole");

                if ((iRole == "1") || (iRole == "2")){
                //get hub link from cookie
                $("a[href='/hublink.html']").attr('href', $.cookie("hublink"))
                var hubLink = document.getElementById("showHublink");
                hubLink.style.display="block";
                }
                if ((iRole == "3") || (iRole == 3)) {
                     var hubLink = document.getElementById("showHublink");
                hubLink.style.display="none";
                }

                if (iRole != "4") {
                    //show the PIP link
                    var pipLink = document.getElementById("showPip");
                   pipLink.style.display="block";
                }
            }


   function hideLogin(){
   var myBox = document.getElementById("loginBox"); //srchBox
   var myLogout = document.getElementById("showLogout");
   myBox.style.display = "none";
   myLogout.style.display="block";
   readLoginInfo();
   }

   function getQuerystring(key, default_)
{
  if (default_==null) default_="";
  key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  var qs = regex.exec(window.location.href);
  if(qs == null)
    return default_;
  else
    return qs[1];
}



   function loginError(){

    var myBox = document.getElementById("loginBox");
    myBox.style.display = "none";

   var msg = getQuerystring("msg", "0");
   var myError = document.getElementById("showError");
   var errorText = "";
   var bError = false;

    switch (msg) {
        case "1":
            errorText = "Invalid login.";
            bError = true;
            break;
        case "2":
            errorText = "Error in login.";
            bError = true;
            break;
        case "3":
            errorText = "Role error. ";
            bError = true;
            break;
    }

    if (bError) {
        myError.innerHTML = errorText;
        myError.style.visibility="visible";
    } else {
        myError.style.visibility="hidden";
    }
}



function searchHdr() {
   		var qtext = $("#ctl00_Top_qText").attr('value');
   		window.location = "/search.aspx?q=" + qtext;
		}






// Delay Plugin for jQuery
// - http://www.evanbot.com
// - © 2008 Evan Byrne

jQuery.fn.delay = function(time,func){
	return this.each(function(){
		setTimeout(func,time);
	});
};
