MSGAlert = {
	antiripper:function(voce){
		return "Se "+voce+" for ripar, lembre-se dos meus creditos! powered by poste9 © kionux";
	},
	show:function(str,link){
		this.width = 200;
		this.height = 90;
		this.link = link;
		this.str = document.createTextNode(str);
		if (this.div) {
			document.body.removeChild(this.div);
		}
		this.createDiv();
		this.count = 0;
		this.scrollDiv();
	},
	createDiv:function(){
		this.div = document.createElement("DIV");
		this.div.id = "MSGAlert";
		this.div.className = "MSGAlert";
		this.createHeader("<img style='float:left;overflow:hidden' src='pix.png' alt='' /> Pixlog.us",this.div);
		
		this.createAlertMsg(this.str,this.div);
		this.createOption('Opções',this.div);
		
		this.div.style.position = "absolute";
		this.div.style.width = parseInt(this.width)+"px";
		this.div.style.overflow = "hidden";
		this.div.style.height = "0px";
		this.div.style.zIndex = "1000";
		this.dimensions = this.getWindowSize();
		//this.div.style.marginLeft = this.dimensions.w - parseInt(this.width)+"px";
		this.div.style.left = "0px";
		this.div.style.top = "0px";
		document.body.appendChild(this.div);
	},
	createHeader:function(str,objParent){
		this.header = document.createElement("H6");
		this.createCloseButton("x",this.header);
		var title = document.createElement("SPAN");
		title.innerHTML = str;
		this.header.appendChild(title);
		
		objParent.appendChild(this.header);
	},
	createCloseButton:function(str,objParent){
		this.closeButton = document.createElement("A");
		this.closeButton.setAttribute("href","javascript:;");
		this.closeButton.onclick = function() {	MSGAlert.div.style.display = "none"; }
		this.closeButton.innerHTML = str;
		objParent.appendChild(this.closeButton);
	},
	createAlertMsg:function(str,objParent){
		this.paragraph = document.createElement("P");
		this.paragraph.appendChild(str);
		this.paragraph.style.textAlign="center";
		objParent.appendChild(this.paragraph);
		
		this.paragraph.onmouseup   = function(event) {
			setTimeout('MSGAlert.div.style.display = "none";',100);
			return false;
		}
		this.paragraph.onmousedown = function(event) {
			if (!event) event = window.event;
			if (!(event.button == 2 || event.which == 3)) {
				window.location.href = MSGAlert.link;
			}
			return false;
		}
		this.paragraph.oncontextmenu=new Function("return false")
	},
	createOption:function(str,objParent){
		this.options = document.createElement("A");
		this.options.setAttribute("href","http://www.pixlog.us/home/user_admin/user_permissoes.php");
		this.options.target = "_blank";
		this.options.innerHTML = str;

		objParent.appendChild(this.options);
				
		setTimeout('MSGAlert.options.marginTop = "20px";',1000);
	},
	scrollDiv:function(){
		if (this.count >= parseInt(this.height)+10) {
			this.div.style.marginTop = this.dimensions.h - this.height - 10 + "px";
			this.div.style.height    = this.height + "px";
			return true;
		}
		this.count += 5;
		this.div.style.marginTop = this.dimensions.h - this.count + "px";
		this.div.style.height    = this.count + "px";
		setTimeout("MSGAlert.scrollDiv()",10);
	},
	getWindowSize:function(){
		retorno = {};
		if (parseInt(navigator.appVersion)>3) {
			if (navigator.appName=="Netscape") {
				retorno.w = window.innerWidth-16;
				retorno.h = window.innerHeight + 7;
			}
			if (navigator.appName.indexOf("Microsoft")!=-1) {
				retorno.w = screen.width-40;
				retorno.h = screen.height-156;
			}
		}
		return retorno;
	}
}
