//**password strengh function */
(function(a){ function b(){
var d=a("#password").val(),
	c=a("#login").val(),e;
	
	a("#strength-param").removeClass("short bad good strong");
	if(!d){
		a("#strength-param").html(pwsL10n.empty);
		return
	}
	
	e=passwordStrength(d,c);
	switch(e){
		case 2:a("#strength-param").addClass("bad").html(pwsL10n.bad);
	break;
		case 3:a("#strength-param").addClass("good").html(pwsL10n.good);
	break;
		case 4:a("#strength-param").addClass("strong").html(pwsL10n.strong);
	break;
		default:a("#strength-param").addClass("short").html(pwsL10n["short"])
	}
}
	a(document).ready(function(){
		a("#password").val("").keyup(b);
	});
})(jQuery);

function passwordStrength(i,f){
var h=1,e=2,b=3,a=4,d=0,g,c;
	if(i.length<4){
		return h;
	}
	if(i.toLowerCase()==f.toLowerCase()){
		return e;
	}
	if(i.match(/[0-9]/)){d+=10}
	
	if(i.match(/[a-z]/)){d+=26}
	
	if(i.match(/[A-Z]/)){d+=26}
	
	if(i.match(/[^a-zA-Z0-9]/)){d+=31}
		
		g=Math.log(Math.pow(d,i.length));
		
		c=g/Math.LN2;
	
	if(c<40){
		return e;
	}
	
	if(c<56){
		return b;
	}
	return a;
};

//** table hover and atachment field array*/
(function(k){
	function l(){
		var m=k("#tickjava").find("tr");
		m.hover(function(){
			var n = k(this).find(".ownlink");
			n.css("display", "block");
		}, function(){
			var n = k(this).find(".ownlink");
			n.css("display", "none");
		});
	};
	
	function pp(){
		var field = k('.attach_p:last');
		var bt = k('#jq_attach');
		
		bt.click(function(){
			var toIn = field.clone();
			
			toIn.insertAfter(field);
			k('#fns').val( k('.attach_p').length );
			
			return false;
		});
	}
k(document).ready(function(){
	l();
	pp();
})})(jQuery);

//** alert function, closed, reopen, delete ticket and delete user */
(function(z){
	function alertClose(){
		var a = z('.jq');
		
		a.each(function(){
			z(this).click(function(){
				var text;
				if(z(this).attr('rel') == "closethis"){
					text = "Are you sure want to close this ticket?";
				} else if (z(this).attr('rel') == "openthis") {
					text = "Are you sure want to re-open this ticket?";
				} else if (z(this).attr('rel') == "bannedthis") {
					text = "Are you sure want to banned this account?";
				} else if (z(this).attr('rel') == "deletethis") {
					text = "Are you sure want to delete this account? All tickets and responds from this user will deleted too!";
				} else if (z(this).attr('rel') == "deldep") {
					text = "Are you sure want to delete this department?";
				}
				
				var r=confirm(text);
				if (r==true)
				  {
				  return true;
				  }
				else
				  {
				  return false;
				  }
			});
		});
	}
z(document).ready(function(){
	alertClose();
})})(jQuery);