
			//  Preload images for alert popup 
jQuery.preloadImages = function(){
			for(var i = 0; i<arguments.length; i++)
			{
				jQuery('<img>').attr('src',arguments[i]);
			}
		}
$.preloadImages('images/confirm_bg_wide.gif','images/btn_continue_editing.gif','images/btn_cancel_without_saving.gif','images/confirm_bg.gif','images/btn_continue_confirm.gif','images/btn_cancel_confirm.gif');

$(document).ready(function() {
						   
	$("#enroll_2").find("input:text, input:password").focus(function () {
		if ($(this).attr("accept")!=null && $(this).attr("accept")!="") {
			var lItem;
			($(this).attr("id")=="enroll_captcha") ? lItem=$(this).parents("li").find("img:last") :  lItem= $(this).parents("li").find("input:last"); 
			
			var p = lItem.position();
			
			$("div#toolTip").show().css({
				"top": p.top + "px",
				"left": p.left + lItem.width() + 20 + "px"
			}).find("p").html($(this).attr("accept"));	
		}
	});
	
	
	
	$("#profile").find("input:text, input:password").focus(function () {
		if ($(this).attr("accept")!=null && $(this).attr("accept")!="") {
			var lItem;
			($(this).attr("id")=="enroll_captcha") ? lItem=$(this).parents("div").find("img:last") :  lItem= $(this).parents("div").find("input:last"); 
			
			var p = lItem.position();
			
			$("div#toolTip").show().css({
				"top": p.top + "px",
				"left": p.left + lItem.width() + 20 + "px"
			}).find("p").html($(this).attr("accept"));	
		}
	});
		
	$("#enroll_2").find("input:text, input:password").blur(function () {
		$("div#toolTip").hide();
	});
	
	$("#profile").find("input:text, input:password").blur(function () {
		$("div#toolTip").hide();
	});
	
	
	$("#enroll_cancel").click( function(evt) {
	evt.preventDefault();
	var linkHref = $(this).attr('href');
		
		if ($.browser.msie && $.browser.version < 7) 
			{
				
              	$("select").removeAttr("enabled");
                $("select").attr("disabled","disabled"); 
			}
										
		jConfirm('Are you sure? This will cancel the entire process.', 'Confirmation Dialog', function(r) {
			if (r== true) {
				document.location = linkHref;
				
			}
				
			else {
				//
				
			}
               $("select").removeAttr("disabled");
                $("select").attr("enabled","enabled");
		});
	});
		
/*  Edit Profiles Alert  */
	$(".prompt_button_profile").click( function() {
			var linkHref = $(this).attr('name');  //  Gets href from name of span	
		if ($.browser.msie && $.browser.version < 7) 
			{
				
              	$("select").removeAttr("enabled");
                $("select").attr("disabled","disabled"); 
			}
										
		jConfirm('Are you sure? Your changes have not been saved', 'Confirmation Dialog', function(r) {
			if (r== true) {
				
				
			}
				
			else {
				//dalert(Loc);
				document.location = linkHref;
			}
               $("select").removeAttr("disabled");
                $("select").attr("enabled","enabled");
        
		});
	});
	
$(".rollovers").bind('mouseover', function() {
	rollovers(this)									   
});
	
$(".rollovers").bind('mouseout', function() {
	rollovers(this)									   
});

$('#enroll_cardPref_all').click( function() {
	 
	if (this.checked == true) {
		
		$('.select_prefs input').each(function () {
        	this.checked = true;
    	});
		
		
	}
		
	else {
		
		$('.select_prefs input').each(function () {
			this.checked = false;
		});
		
		
	}
});

$('#all_checkbox').click( function() {
	 
	if (this.checked == true) {
		
		
		$('.select_preference input').each(function () {
        	this.checked = true;
    	});
	}
		
	else {
		
		$('.select_preference input').each(function () {
			this.checked = false;
		});
	}
});


$('.select_preference input[id!=all_checkbox]').click( function() { 
	
	$('#all_checkbox').attr('checked', false);
	
	
});
});




function rollovers(objImg)
{
	
var strImageSrc = objImg.src;
var strImageClass = objImg.className;
var strNewImage = "";
		//  if else statement to stop image change in active state
if (strImageClass.indexOf("inactive") != -1) 
	{}
else
	{
	if (strImageSrc.indexOf("_off") != -1)
		{
		strNewImage = strImageSrc.replace(/_off/ , "_over");
		}
	else
		{
		strNewImage = strImageSrc.replace(/_over/ , "_off");
		}
		objImg.src =  strNewImage;
	}
}