Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var currentPage = "main";
- var currentDiv = "content";
- var noticeID;
- var disconnected = false;
- var noticesRead = 0;
- var loginOpened = false;
- var loginBoxWritten = false;
- function login() {
- xajax_login(xajax.getFormValues("loginForm"));
- loginOpened = false;
- }
- function show_registration_form() {
- if(noticeOpened) {
- document.getElementById('noticeBox').style.display='none';
- }
- if(loginBoxWritten) {
- document.getElementById('loginBox').style.display='none';
- }
- if(blackBoxWritten) {
- document.getElementById('blackLitebox').style.display='none';
- }
- display('register', 'content');
- noticeOpened = true;
- loginOpened = true;
- }
- function register() {
- xajax_register(xajax.getFormValues("registerForm"));
- }
- function hide(anchorID, divID, name, link) {
- var anchorID = anchorID;
- var divID = divID;
- var name = name;
- var link = link;
- document.getElementById(divID).style.display='none';
- if(link == 1) {
- xajax.$(anchorID).innerHTML = "<a href=\"#\" onclick=\"show('" + anchorID + "', '" + divID + "', '" + name + "', '" + link +"');\">Show " + name + "</a><br />";
- }
- if(link == 0) {
- imglink = name + "show.gif";
- xajax.$(anchorID).innerHTML = "<a href=\"#\" onclick=\"show('" + anchorID + "', '" + divID + "', '" + name + "', '" + link +"');\"><img src=\"" + imglink + "\"></a><br />";
- }
- }
- function show(anchorID, divID, name, link) {
- var anchorID = anchorID;
- var divID = divID;
- var name = name;
- var link = link;
- document.getElementById(divID).style.display='block';
- if(link == 1)
- {
- xajax.$(anchorID).innerHTML = "<a href=\"#\" onclick=\"hide('" + anchorID + "', '" + divID + "', '" + name + "', '" + link +"');\">Hide " + name + "</a><br />"
- }
- if (link == 0) {
- imglink = name + "hide.gif"
- xajax.$(anchorID).innerHTML = "<a href=\"#\" onclick=\"hide('" + anchorID + "', '" + divID + "', '" + name + "', '" + link +"');\"><img src=\"" + imglink + "\"></a><br />";
- }
- }
- function update(updatecontent) {
- if(disconnected == true || currentPage == "register") {
- return false;
- }
- xajax_update(currentPage, currentDiv, updatecontent, noticesRead);
- setTimeout("update(false);", 20000);
- }
- function display(page, divID) {
- if (page === undefined) {
- page = null;
- }
- if (divID === undefined) {
- divID = null;
- }
- xajax_display(page, divID);
- currentPage = page;
- currentDiv = divID;
- }
- function changeskin() {
- xajax.$('skinButton').disabled=true;
- xajax.$('skinButton').value="Changing Skin...";
- xajax_changeskin(xajax.getFormValues("skinselector"), currentpage);
- }
- function writeLoginBox() {
- var wrap = document.createElement('div');
- wrap.id = 'loginBox';
- wrap.style.display = 'none';
- wrap.style.zIndex = '100';
- wrap.style.width = '500px';
- wrap.style.position = "absolute";
- if(ie4) {
- Winwidth = document.body.clientWidth;
- Winheight = document.body.clientHeight;
- } else {
- Winwidth = window.innerWidth;
- Winheight = window.innerHeight;
- }
- var title = document.createElement('div');
- var p2 = document.createElement('span');
- p2.className = 'floatright';
- title.appendChild(p2);
- p2.innerHTML += "<a href=\"javascript:closeLoginBox()\">Close</a>";
- var body = document.createElement('div');
- body.className = 'body1';
- wrap.appendChild(body);
- body.id = "loginFormBox";
- var obj = getById('login');
- wrap.style.left = (Winwidth / 4) + 'px';
- wrap.style.top = '50px';
- obj.parentNode.appendChild(wrap);
- document.getElementById('loginFormBox').innerHTML = "<form id=\"loginForm\">" +
- "Username:<input type=\"text\" id=\"username\" name=\"username\"><br>" +
- "Password:<input type=\"password\" id=\"password\" name=\"password\"><br>" +
- "</form>" +
- "<a href=\"#\" class=\"button\" onclick=\"login(); this.blur();\"><span>Login</span></a>" +
- "<a href=\"#\" class=\"button\" onclick=\"closeLoginBox(); this.blur();\"><span>Cancel</span></a><br />" +
- "Don't have an account? Register <a href=\"show_registration_form();\">here</a>";
- obj.onclick = toggleLitebox;
- loginboxWritten = true;
- }
- function showLoginBox() {
- if (loginOpened && currentPage == 'register') {
- return false;
- }
- if(loginBoxWritten) {
- writeLoginBox();
- }
- if(blackBoxWritten) {
- writeBlackLitebox();
- }
- document.getElementById('noticeBox').style.display='none';
- document.getElementById('loginBox').style.display='block';
- openBlackLitebox();
- loginOpened = true;
- }
- function closeLoginBox() {
- if (loginOpened) {
- return false;
- } else {
- document.getElementById('blackLitebox').style.display='none';
- document.getElementById('loginBox').style.display='none';
- loginOpened = false;
- }
- }
- function register(step) {
- xajax_register(xajax.getFormValues("registerForm"), step);
- }
Add Comment
Please, Sign In to add comment