/*
 * alert.js - javascript alert replacement v2.1
 *
 * (c) 2009-2011 Naden Badalgogtapeh - http://www.naden.de/blog/javascript-alert
 *
 */
window.alert=function(){var G=2.1;var D={button_title:"ok",left:-1,top:-1,width:-1,height:-1};if(arguments.length==2&&typeof arguments[1]=="object"){D=I(arguments[1],D)}else{if(arguments.length==3){D=I(arguments[2],D)}}var A=document.getElementById("alert");if(A){document.body.removeChild(A)}A=document.createElement("DIV");A.id=A.className="alert";document.body.appendChild(A);if(arguments.length==1||(arguments.length==2&&typeof arguments[1]!="string")){arguments=["",arguments[0]]}A.innerHTML=(arguments[0]==""?"":'<div class="title">'+arguments[0]+"</div>")+'<div class="body">'+arguments[1]+'</div><div class="button"><a href="" onclick="document.body.removeChild(document.getElementById(\'alert\'));return false;">'+D.button_title+"</a></div>";var B=F(),J=Math.max(H(arguments[0]),H(arguments[1]))*6,C=0,E=0;if(D.width==-1){D.width=J}else{C=D.width}if(D.left==-1){D.left=parseInt((B[0]+B[2]-J-C)/2)}if(D.top==-1){D.top=parseInt((B[1]+B[3]-(A.offsetHeight||A.pixelHeight))/2)}A.style.width=D.width+"px";if(D.height>0){A.style.height=D.height+"px"}A.style.left=D.left+"px";A.style.top=D.top+"px";A.style.display="block";function I(L,K){for(var M in K){if(M in L){continue}L[M]=K[M]}return L}function H(N){var O=N.split("<br />");if(O.length<=1){O=N.split("<br>")}if(O.length<=1){return N.replace(/<(?:.|\s)*?>/g,"").length}var K=0;for(var M=0;M<O.length;M++){var L=O[M].replace(/<(?:.|\s)*?>/g,"");if(L.length>K){K=L.length}}return K}function F(){var L=0,M=0,K=0,N=0;if(typeof window.innerWidth=="number"){L=window.innerWidth;M=window.innerHeight}else{if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){L=document.documentElement.clientWidth;M=document.documentElement.clientHeight}else{if(document.body&&(document.body.clientWidth||document.body.clientHeight)){L=document.body.clientWidth;M=document.body.clientHeight}}}if(typeof window.pageYOffset=="number"){N=window.pageYOffset;K=window.pageXOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){N=document.body.scrollTop;K=document.body.scrollLeft}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){N=document.documentElement.scrollTop;K=document.documentElement.scrollLeft}}}return[K,N,L,M]}};
