$(document).ready(function(){
						   $(".fade_rollover").hover(function(){
						   $(this).fadeTo("fast", 0.0); // This sets the opacity to 0% on hover
						   },function(){
						   $(this).fadeTo("slow", 1.0); // This sets the opacity back to 100% on mouseout
						   });
						   $(button).fadeTo("fast", 0.0); // This sets the current page to opacity 0%
						   
						   //This following section adds subButtons where necessary
						   
						   if (addSub==true) { 
							   $("#subButtonInner").fadeTo("fast", 0.0);
	                           $("#subButtons").css({'visibility' : 'visible'});
                               $("#subButtons").show("slide", { direction: "up" }, 2000);
                               $("#subButtonInner").fadeTo(3000, 1.0);
                           }
                           
                           if (staySub==true) { 
							   $("#subButtons").css({'visibility' : 'visible'});
                           }
                         
					});

var training = "<a href='train_healthandwellness.html'>Health & Wellness</a> : <a href='train_smokingcessation.html'>Smoking Cessation</a> : <a href='train_angermanagement.html'>Anger Management</a> : <a href='train_parenting.html'>Parenting</a> : <a href='train_gamblingtreatment.html'>Gambling Education and Treatment</a>";
var drug = " <a href='dfwp_becoming.html'>Become a Drug Free Workplace</a> : <a href='dfwp_education.html'>Employee Education</a> : <a href='dfwp_supervisor.html'>Supervisor Training</a> : <a href='dfwp_trainer.html'>Train The Trainer</a> : <a href='dfwp_grant.html'>DFSP Grant Program</a> ";
var counsel = "<a href='counsel_solutionfocused.html'>Solution-Focused Counseling</a> : <a href='counsel_financialcoaching.html'>Financial Coaching</a> : <a href='counsel_360wellness.html'>360 Personalized Wellness Service</a>"; 
var referral = "<a href='refer_referralprocess.html'>Referral Process</a> : <a href='refer_interactivewebsite.html'>Interactive Website</a>";
var mgmt = "<a href='mgmt_organizationaldevelopment.html'>Organizational Development</a> : <a href='mgmt_downsizeorrestructuring.html'>Organizational Restructuring</a>";
var critical = "<a href='cisd_providingservices.html'>AssistNOW CISD services</a> : <a href='cisd_supervisortraining.html'>Supervisor Training</a> : <a href='cisd_employeeawareness.html'>Employee Awareness & Prevention</a> : <a href='cisd_crisisintervention.html'>Crisis Intervention </a>";

function addTab(tabby) {
	$("#subButtons").css({'visibility' : 'visible'});
	
	if (tabby == 'train') {
		$('#subButtonInner').html(training);
	}
	
	if (tabby == 'drug') {
		$('#subButtonInner').html(drug);
	}
	
	if (tabby == 'counsel') {
		$('#subButtonInner').html(counsel);
	}
	
	if (tabby == 'referral') {
		$('#subButtonInner').html(referral);
	}
	
	if (tabby == 'mgmt') {
		$('#subButtonInner').html(mgmt);
	}
	
	if (tabby == 'critical') {
		$('#subButtonInner').html(critical);
	}
}

function stayTab() {
	$("#subButtons").css({'visibility' : 'visible'});
}

function removeTab() {
	$("#subButtons").css({'visibility' : 'hidden'});
}

    // Validator Object
    var valid = new Object();
    var flag = "";

    // REGEX Elements

              
        //matches Street
        valid.username = /[a-zA-Z0-9]/;
        valid.password = /[a-zA-Z0-9]/;
          
   
function validateAll(s,f,t) {

        var elArr = document.login.elements; 

        for(var i = s; i < f; i++) {

           with(elArr[i]) { 

              var v = elArr[i].name; 

              if(!v) continue; 
              
              var thePat = valid[v]; 

              var gotIt = thePat.exec(value); 

              if(! gotIt){
                 //alert(name + ": failure to match " + v + " to " + value);                  
                 elArr[i].style.background = "#FF0000"
                 elArr[i].style.color = "#FFFFFF"
                 elArr[i].select();
                 elArr[i].focus(); 
                 error.style.visibility = "visible";
                 flag = "stop";
                 return false;
              }
              
              else {
	             elArr[i].style.background = "#FFFFFF"
                 elArr[i].style.color = "#000000"
                 flag = "go";
             }
           }
        }
        
        if (t==1){
	    document.login.submit()
    }
        return true;

    }
						  
