(function($){
   //Loaging Logo
  $.fn.Loading = function(size,stat){
	if(stat == true){var valStat = '_loading.gif';}else{var valStat = '.png';}
	var htmlImg = '<img src="template/logo'+size+valStat+'" width="'+size+'" height="'+size+'" border="0" alt="">';
    return this.html(htmlImg);
  };

})(jQuery);
$(document).ready(function(){	
		
		// Cufon
		Cufon.replace('.font-helvetica');
		
		// Config min-height monitor
		var pageMinHeight = 1000;
		if($('#sidebar_main').height() <= pageMinHeight){
			$('#wrapper,#sidebar_main').height(pageMinHeight);
		}else{
			$('#wrapper,#sidebar_main').height($('#sidebar_main').height());
		}

		/* Chang type Password */
		$('#password_clear').show();
		$('#password_password').hide();
		$('#password_clear').focus(function() {
			$('#password_clear').hide();
			$('#password_password').show();
			$('#password_password').focus();
			$('#password_password').blur(function () {
			    if ($('#password_password').val() == '') {
					$('#password_clear').show();
					$('#password_password').hide();
				}
			});
		});

		//Tab login/signUp
		$('.logsign_tab').click(function(){
			if(!$(this).attr('id')){
				$('.logsign_tab').removeAttr('id');
				$(this).attr('id','act');
				if($(this).hasClass('login')){
					$('#wrapper_signup').hide(0,function(){$('#wrapper_login').stop().fadeIn(350);});
					
				}
				if($(this).hasClass('signup')){
					$('#wrapper_login').hide(0,function(){$('#wrapper_signup').stop().fadeIn(350);});
					
				}
			}
			return false;
		});
		
		$('.butteffect').each(function(){
			//alert($(this).width());
			$(this).wrap('<div class="wrapbutt_effect" style="position:relative;height:25px;width:'+$(this).width()+'px;background-color:#F1F1F1;overflow: hidden;"><div style="position:absolute;left:0;top:0px;z-index:2;">').css('background','none');
			$(this).parents('.wrapbutt_effect').append('<div class="bg_butt" style="margin-left:-100%;background-color:#C11B33;width:100%;height:100%;"></div>');
		});
		$('#wrapper').delegate('.wrapbutt_effect','hover', function(event){
			if (event.type == 'mouseover' || event.type == 'mouseenter'){
				$(this).find('.bg_butt').stop().animate({"margin-left": "0px"}, 350).parents('.wrapbutt_effect').find('input').css('color','#fff');
			}else{
				$(this).find('.bg_butt').stop().animate({"margin-left": "-100%"}, 350).parents('.wrapbutt_effect').find('input').css('color','#282727');
			}
		 });

		// gender button
		$('.gender_radio > div').click(function(){
			$('.gender_radio > div').removeClass('current');
			$(this).addClass('current').parent().find('input').val($(this).attr('rel'));
			//alert($(this).parent().find('input').val()); //Debug.
		});
		//Select Box Style.
		$('.selectbox').selectbox();
		$('#scrollbar1 .stylescroll_dropdown').tinyscrollbar();
		$('#scrollbar2 .stylescroll_dropdown').tinyscrollbar();

	
		//$('#logo').Loading(28,true); //Loading...

			/* 
			malihu custom scrollbar function parameters: 
			1) scroll type (values: "vertical" or "horizontal")
			2) scroll easing amount (0 for no easing) 
			3) scroll easing type 
			4) extra bottom scrolling space for vertical scroll type only (minimum value: 1)
			5) scrollbar height/width adjustment (values: "auto" or "fixed")
			6) mouse-wheel support (values: "yes" or "no")
			7) scrolling via buttons support (values: "yes" or "no")
			8) buttons scrolling speed (values: 1-20, 1 being the slowest)
			*/
		//$("#mcs3_container").mCustomScrollbar("vertical",900,"easeOutCirc",1.05,"auto","yes","no",0); 
		

});// END document ready.
