﻿$(document).ready(function() {
//dropmenu
	$(".dd_content").each(function() {
		
		var status = "closed"
		var mouse = "off"
		var timer = 0
		var content = $(".dd_content");
		$(".dd_img").click(function () {	
			mouse = "on"
			clearTimeout(timer);
			if(status == "closed")
			{
				$(content).slideDown();
				
				status = "opened";
				
				$(".dd_img").addClass("dd_img_active");
				
				mouse = "off"
			}
			else {
				$(content).slideUp();
				
				status = "closed";	
				
				$(".dd_img").removeClass("dd_img_active");
			}
		});
		
		$(content).hover(function() {
			mouse = "on"								
		});
		
		$(content).mouseleave(function () {
			mouse = "off"
			if ( mouse = "off")
			{	
				timer = setTimeout(function() 
				{
					if ( mouse == "off" ) 
					{ 	
						$(content).slideUp();
							
						status = "closed";
						
						$(".dd_img").removeClass("dd_img_active");
					}
				}, 1500);
			}	
		});
	});
//nav
	$("#nav ul li a").hover(function() {
		var y = this.offsetTop - 1
		$(this).animate({left:4},300);
		$('#arrow').stop().animate({top: y}, { duration: 600, easing: "easeOutBack" });
    },function()
    {
		$(this).animate({left:0},300);
		$('#arrow').stop().animate({top: 0 }, { duration: 900, easing: "easeInOutBack" });
    });
//gallery
	$(".gl_content").hover(function() {
		$(".gl_zoom").fadeOut(100);								
	}, function() {
		$(".gl_zoom").fadeIn(100);								
	});
//forum
	$(".fnews").hover(function() {
		$(".skill_cat").fadeIn();
		setTimeout(function() {
			$(".skill_head").fadeIn();
		},300);
		setTimeout(function() {
			$(".skill_stick").fadeIn();
		},600);
		
	}, function() {
		$(".skill_cat").fadeOut();
		setTimeout(function() {
		$(".skill_head").fadeOut();
		},300);
		setTimeout(function() {
		$(".skill_stick").fadeOut();
		},600);
	});
//login
$("#profile").each(function() {
	var mouse = "off";
	$("#profile").hover(function() {
		mouse = "on"								 
	}, function() {
		mouse = "off"
	});
	$("#password-password, #login-login, #captcha-captcha").focus(function() {
		$("#login").animate({opacity:1},600);
	});
	$("#password-password, #login-login, #captcha-captcha").blur(function() {
		if(mouse == "off") {
			$("#login").animate ({opacity: 0.6});
		}
	});
	$("body").click(function() {
		if(mouse == "off") {
			$("#login").animate ({opacity: 0.6});
		}
	});
});
//donate
	$("#dn_meter").each(function() {
		if( parseInt($("#scale").css('height'))/1.94<9 ) h = 0;
		else if( ( parseInt($("#scale").css('height'))/1.94>=9 ) && ( parseInt($("#scale").css('height'))/1.94<24) ) h = 10;
		else if( ( parseInt($("#scale").css('height'))/1.94>=24 ) && ( parseInt($("#scale").css('height'))/1.94<34) ) h = 25;
		else if( ( parseInt($("#scale").css('height'))/1.94>=34 ) && ( parseInt($("#scale").css('height'))/1.94<49) ) h = 35;
		else if( ( parseInt($("#scale").css('height'))/1.94>=49 ) && ( parseInt($("#scale").css('height'))/1.94<74) ) h = 50;
		else if( parseInt($("#scale").css('height'))/1.94>=74 ) h = 75;

		//alert($("#scale").css('height'))

		$("#dn_meter").css('backgroundImage', 'url({THEME}/images/donate'+h+'.jpg)');
	});
});

