/************************************************************
 * Draws attention to the login box							*
 ************************************************************/
 
 var stcComLog = function() {
 	// Constructor
 }
 
 stcComLog.prototype = {
 	
 	logBox: "",
 	
 	init: function() {
 		this.logBox = YAHOO.util.Dom.getElementsByClassName("mod_external_login")[0];
 		var comBox = document.getElementById("bcPostCommentTextContainer");
 		var comTxt = comBox.getElementsByTagName("textarea")[0];
 		YAHOO.util.Event.addListener(comTxt, "click", this.showMe, this, true);
 	},
 	
 	showMe: function(e) {
 		var targ = YAHOO.util.Event.getTarget(e);
 		targ.blur();
 		var lbReg = YAHOO.util.Dom.getRegion(this.logBox);
 		var scope = this;
 		var scInt = setInterval(function(){
 			if(YAHOO.util.Dom.getDocumentScrollTop() <= lbReg.top){
 				clearInterval(scInt);
 				scope.flashLog.call(scope, YAHOO.util.Dom.getDocumentScrollTop()); 
 			} else {
 				window.scrollBy(0,-100);
 			}
 		}, 10);
 	},
 	
 	flashLog: function(toppos) {
 		YAHOO.util.Dom.setStyle(this.logBox, 'position', 'relative');
 		YAHOO.util.Dom.setStyle(this.logBox, 'z-index', '10000');
		var dark = document.createElement("div");
		dark.id = "darkBG";
		YAHOO.util.Dom.setStyle(dark, "background-color", "black");
		YAHOO.util.Dom.setStyle(dark, "position", "absolute");
		YAHOO.util.Dom.setStyle(dark, "top", toppos+"px");
		YAHOO.util.Dom.setStyle(dark, "left", "0px");
		YAHOO.util.Dom.setStyle(dark, "width", "100%");
		YAHOO.util.Dom.setStyle(dark, "height", "100%");
		YAHOO.util.Dom.setStyle(dark, "opacity", "0");
		document.body.appendChild(dark);
		var newAttributes = {
		   opacity: { from:0, to: 0.8 }
		};
		
		var newAnim = new YAHOO.util.Anim(dark, newAttributes);
		newAnim.onComplete.subscribe(function(){
			var fadeoutTimer = setTimeout(function(){
				var fadeoutattribs = {
					opacity: {to:0}
	 			};
	 			var fadeoutanim = new YAHOO.util.Anim(dark, fadeoutattribs);
	 			fadeoutanim.onComplete.subscribe(function() {
	 				dark.parentNode.removeChild(dark);
	 			});
	 			fadeoutanim.duration = .5;
	 			fadeoutanim.animate();
			}, 2000);
		});
		newAnim.duration = .5;
		newAnim.animate();
 	}
 	
 }
 
 YAHOO.util.Event.onDOMReady(function(){
 	var comLog = new stcComLog();
 	comLog.init();
 });