$(function(){
	
    $("#avatarList2").hide();
    
//	$("#chooseAvatar span").mouseover(function(){
//		$(this).addClass("avDropOver");
//	});
	
//	$("#chooseAvatar span").mouseout(function(){
//		$(this).removeClass("avDropOver");
//	});

	$("#chooseAvatar2 span").click(function(){
		if ($("#avatarList2").css("display")!="block")
		{
			$("#avatarList2").slideDown();
			$(this).addClass("avDropSel");		
		}
		else
		{
			$("#avatarList2").slideUp();
			$(this).removeClass("avDropSel");	
		}
	});
	
	$("#avatarList2 img").click(function(){
		$("#avatarList2 img").removeClass("avatarSelected")
		$(this).addClass("avatarSelected");
		$("#ctl00_CRightColumn1_userAvatar2").attr("src", $(this).attr("src"));
		
		/* Assign hidden input value with ID of image */
		$("#ctl00_CRightColumn1_avatarIDSetupExtra").val($(this).attr("rel"));
		
		$("#avatarList2").slideUp();
		$("#avatarList2").hide();
		$("#chooseAvatar2 span").removeClass("avDropSel");
		
	});

	$("#avatarList2 img").mouseover(function(){
		$(this).addClass("avatarMouseOver");
	});
	
	$("#avatarList2 img").mouseout(function(){
		$(this).removeClass("avatarMouseOver");
	});
});
//#################################################################################
//Normal
$(function(){
	
    $("#avatarList").hide();
    
//	$("#chooseAvatar span").mouseover(function(){
//		$(this).addClass("avDropOver");
//	});
	
//	$("#chooseAvatar span").mouseout(function(){
//		$(this).removeClass("avDropOver");
//	});

	$("#chooseAvatar span").click(function(){
		if ($("#avatarList").css("display")!="block")
		{
			$("#avatarList").slideDown();
			$(this).addClass("avDropSel");		
		}
		else
		{
			$("#avatarList").slideUp();
			$(this).removeClass("avDropSel");	
		}
	});
	
	$("#avatarList img").click(function(){
		$("#avatarList img").removeClass("avatarSelected")
		$(this).addClass("avatarSelected");
		$("#ctl00_CRightColumn1_userAvatar").attr("src", $(this).attr("src"));
		
		/* Assign hidden input value with ID of image */
		$("#ctl00_CRightColumn1_avatarIDSetup").val($(this).attr("rel"));
		
		$("#avatarList").slideUp();
		$("#avatarList").hide();
		$("#chooseAvatar span").removeClass("avDropSel");
		
	});

	$("#avatarList img").mouseover(function(){
		$(this).addClass("avatarMouseOver");
	});
	
	$("#avatarList img").mouseout(function(){
		$(this).removeClass("avatarMouseOver");
	});
});

//#################################################################################
//Profile setup
$(function() {

$("#avatarListProfile").hide();

    //	$("#chooseAvatar span").mouseover(function(){
    //		$(this).addClass("avDropOver");
    //	});

    //	$("#chooseAvatar span").mouseout(function(){
    //		$(this).removeClass("avDropOver");
    //	});

    $("#chooseAvatarProfile span").click(function() {
    if ($("#avatarListProfile").css("display") != "block") {
        $("#avatarListProfile").slideDown();
            $(this).addClass("avDropSel");
        }
        else {
            $("#avatarListProfile").slideUp();
            $(this).removeClass("avDropSel");
        }
    });

    $("#avatarListProfile img").click(function() {
    $("#avatarListProfile img").removeClass("avatarSelected")
        $(this).addClass("avatarSelected");
        $("#ctl00_CRightColumn1_tabMemberProfile_tab1_imgProfileImage").attr("src", $(this).attr("src"));

        /* Assign hidden input value with ID of image */
        $("#ctl00_CRightColumn1_tabMemberProfile_tab1_avatarIDProfile").val($(this).attr("rel"));

        $("#avatarListProfile").slideUp();
        $("#avatarListProfile").hide();
        $("#chooseAvatarProfile span").removeClass("avDropSel");

    });

    $("#avatarListProfile img").mouseover(function() {
        $(this).addClass("avatarMouseOver");
    });

    $("#avatarListProfile img").mouseout(function() {
        $(this).removeClass("avatarMouseOver");
    });
});