function hideBox(boxName) {
	var Slide = new Fx.Slide(boxName);
	Slide.hide();
}

function toggleBox(boxName) {
	var Slide = new Fx.Slide(boxName);
	Slide.toggle();
}

function ajaxCallInDiv(ajax_url, ajax_method, ajax_div, ajax_data, scrollWindow, successFunction, failureFunction) {
	if(scrollWindow == undefined) {
		scrollWindow = true;
	}
	var ajax = new Request.HTML({ url: ajax_url, method: ajax_method, evalScripts:true, data: ajax_data, update: ajax_div,
								onSuccess: function(html) {
									$('loader').style.display = 'none';
                                    if(successFunction !== null)
                                        eval(successFunction);
									if(scrollWindow) {
										var scroller = new Fx.Scroll(window).toTop(); }
                                    Custom.init();
									return true;
								},
								
								onFailure: function(){
									$('loader').style.display = 'none';
                                    if(failureFunction !== null)
                                        eval(failureFunction);
									return false;
                                    Custom.init();
								}				
				});
	$('loader').style.display = 'inline';
	ajax.send();
}

function ajaxCallInWindow(ajax_url, ajax_method, ajax_data, win) {
	win.setAjax(''+ajax_url+'');
	win.show();
}

function ajaxCallForBool(ajax_url, ajax_method, ajax_data, successFunction, failureFunction) {
	var ajax = new Request({
					url: ajax_url, method: ajax_method, evalScripts:true, data: ajax_data,

				onSuccess: function(txt){
					$('loader').style.display = 'none';	
					if(txt === 'true') {
						eval(successFunction);	
					} else {
						eval(failureFunction);	
					}
				},
				
				onFailure: function(){
					$('loader').style.display = 'none';	
					eval(failureFunction);
				}
	});
	$('loader').style.display = 'inline';
	ajax.send();
}

function pageCallInWindow(url, win) {
	win.setUrl(''+url+'');
	win.show();
}

/*
Script: PictureNotices.js
	Class for creating notices over pictures.
*/

var PictureNoticer = new Class({
	
	Implements: [Options],
	
	options: {
		pictureNotices: 0
	},
					
	// constructor
	initialize: function(options) {
		this.picture = $(options.picture);
		this.noticeBox = $(options.noticeBox);
		this.name = options.name;
	},
	
	// add function
	add: function(noticeId, x, y, width, height, pictureBoxContent, noticeBoxContent, noticeBoxLink, deleteable, deleteLink) {
		pictureBox = new Element('div', {id: 'pictureBox_'+noticeId, 'class': 'div_pictureLinkMarkBox'});
		pictureBoxInner = new Element('div', {'class': 'div_pictureLinkMarkContent'});
		pictureBoxInner.set('text', pictureBoxContent);
		pictureBoxInner.injectInside(pictureBox);
		pictureBox.set('styles', {
					   'top': y+'px',
					   'left': x+'px',
					   'width': width+'px',
					   'height': height+'px'});
		pictureBox.injectInside(this.picture);
		
		noticeBox = new Element('div', {id: 'noticeBox_'+noticeId, 'class': 'div_noticeBox'});
		noticeBoxLink = new Element('a', {'href': noticeBoxLink});
		noticeBoxLink.set('text', noticeBoxContent);
		noticeBoxLink.set('styles', {'float': 'left'});
		if(deleteable) {
			deleteLinkBox = new Element('a', {'class': 'rightLink'});
			deleteLinkBox.set('onclick', 'ajaxCallForBool(\''+deleteLink+'\', \'get\', null, \''+this.name+'.remove('+noticeId+')\')');
			deleteLinkBox.set('text', '[x]');
			deleteLinkBox.set('styles', {'float': 'right'});
			deleteLinkBox.injectInside(noticeBox);
		}
		noticeBoxLink.injectInside(noticeBox);
		noticeBox.set('events', {
					   'mouseover': function() { $('pictureBox_'+noticeId).set('class', 'div_pictureLinkMarkBox_active') },
					   'mouseout': function() { $('pictureBox_'+noticeId).set('class', 'div_pictureLinkMarkBox') }});
		noticeBox.injectInside(this.noticeBox);
		this.options.pictureNotices++;
		if(this.options.pictureNotices > 0) {
			this.noticeBox.set('styles', {'display': 'table'});
		}
	},
	
	// remove function
	remove: function(noticeId) {
		this.picture.removeChild($('pictureBox_'+noticeId));
		this.noticeBox.removeChild($('noticeBox_'+noticeId));
		this.options.pictureNotices--;
		if(this.options.pictureNotices == 0) {
			this.noticeBox.set('styles', {'display': 'none'});
		}
	}
});

/*
Script: Updater.js
	Class for pulling current informations
*/
var Updater = new Class({
	
	Implements: [Native, Options],
	
	options: {
		chatBoxes: 0,
		dashboardNum: 0,
		chatNum: 0,
		friendNum: 0
	},
					
	// constructor
	initialize: function(options) {
		this.options.url = options.url;
	},
	
	setFooterbarNums: function(dashboardNum, chatNum, friendNum) {
		this.options.dashboardNum = dashboardNum;
		this.options.chatNum = chatNum;
		this.options.friendNum = friendNum;
	},
	
	sendRequestFooterbar: function() {
		var request = new Request({
			url: ''+this.options.url+'&dashboardNum='+this.options.dashboardNum+'&chatNum='+this.options.chatNum+'&friendNum='+this.options.friendNum,
			method: 'get',
			onSuccess: function(json){
				// handle the response
				var jsonResponse = JSON.decode(json);	
				// dashboard num
				if(parseInt(jsonResponse.dashboardNum) > 0) {
					$('dashboardNum').set('html', jsonResponse.dashboardNum);
					$('dashboardNumWrapper').setStyle('display', 'inline');
				} else if(parseInt(jsonResponse.dashboardNum) == 0) {
					$('dashboardNumWrapper').setStyle('display', 'none');	
				}
				// friends online
				$('friendsOnline').set('html', jsonResponse.friendNum);
				// chat
				if(parseInt(jsonResponse.chatNum) > 0)
					$('chatOpenLink').set('class', 'subLinkActiv');
				// send it again
				updaterBasic.setFooterbarNums(jsonResponse.dashboardNum, jsonResponse.chatNum, jsonResponse.friendNum);
				updaterBasic.sendRequestFooterbar();
			}
		});
		request.send();
	},
	
	sendRequestChat: function(activeUserId) {
		chatRequest = new Request({
			url: ''+this.options.url+''+(activeUserId !== undefined ? '&direct=true' : ''),
			method: 'get',
			onSuccess: function(json){
				// handle the response
				var jsonResponse = JSON.decode(json);
				
				// reset user lists
				chat.resetUserLists();
				
				
				// conversations
				if(parseInt(jsonResponse.conversationNum) > 0)
					for(var chatId in jsonResponse.conversations)
						chat.addConversation(jsonResponse.conversations[chatId].UserId, jsonResponse.conversations[chatId].UserName, chatId, (jsonResponse.newMessages == chatId || jsonResponse.newMessages.indexOf(chatId) != -1 ? true : false));
				
				// friends online
				if(parseInt(jsonResponse.friendNum) > 0)
					for (var userId in jsonResponse.friends) 
						chat.addUserOnline(userId, jsonResponse.friends[userId]);
						
				// conversations
				if(parseInt(jsonResponse.messageNum) > 0)
					for(var messageId in jsonResponse.messages) {
						chat.addMessage(jsonResponse.messages[messageId].chatId, jsonResponse.messages[messageId].userId, jsonResponse.messages[messageId].userName, jsonResponse.messages[messageId].userImage, jsonResponse.messages[messageId].message);	
					}
			
				// load active conversation
				if(activeUserId != null)
					chat.loadConversation(activeUserId);
				chat.options.scroller.toBottom();
			
				// send it again
				if(chatPeriodical) {
					updater.sendRequestChat();
				}
			}
		});
		chatRequest.send();
	}
});

/*
Script: Chat.js
	Class for handling the chat component
*/
var Chat = new Class({
					
	Implements: [Options],
	
	options : {
		conversationUser: null,
		onlineUser: null,
		url: null,
		imagePath: null,
		activeUserId: null,
		emptyMessage: null,
		messageCount: 0,
		scroller: null,
		myUserId: null,
		userComponent: null
	},
	
	initialize: function(options) {
		this.onlineDiv = $('onlineDiv');
		this.conversationDiv = $('conversationDiv');
		this.options.conversationUser = new Object();
		this.options.onlineUser = new Object();
		this.options.url = options.url;
		this.options.imagePath = options.imagePath;
		this.options.emptyMessage = options.emptyMessage;
		this.options.scroller = new Fx.Scroll($('activeChat'));
		this.options.myUserId = options.myUserId;
		this.options.userComponent = options.userComponent;
	},
	
	resetUserLists: function() {
		this.onlineDiv.empty();
		this.options.onlineUser = new Object();
	},
	
	addUserOnline: function(userId, userName) {
		this.options.onlineUser[userId] = userName;
		var userBox = new Element('div', {'class': 'subLinkChat'});
		userBox.set('html', userName);
		userBox.addEvent('click', function() {
			chat.newConversation(userId);							   
		});
		userBox.injectInside(this.onlineDiv);
	},

	addConversation: function(userId, userName, chatId, newMessage) {
		if(!this.options.conversationUser[userId]) {
			this.options.conversationUser[userId] = new Conversation({'chatId': chatId, 'userName': userName});
			var userBox = new Element('div', {'class': 'subLinkChat'+((userId == this.options.activeUserId) || newMessage ? 'Activ' : '')});
			
			// add a live chat box to the hidden object
			var liveChatBox = new Element('div');
			liveChatBox.set('id', 'liveChat_'+chatId);
			liveChatBox.setStyle('display', 'none');
			liveChatBox.injectInside($('activeChat'));
			
			// load the history
			chat.loadHistory(chatId);
			
			// add the quit box
			userQuitBox = new Element('div', {'class': 'rightLink'});
			userQuitBox.set('html', '[x]');
			userQuitBox.addEvent('click', function() {
				chat.quitConversation(userId);								   
			});
			userQuitBox.injectInside(userBox);
			new Element('span', {'html': userName}).injectInside(userBox);
			userBox.set('id', 'conversation_'+userId);
			// add the user box to the list
			userBox.addEvent('click', function() {
				chat.loadConversation(userId);
			});
			userBox.injectInside(this.conversationDiv);	
		} else if(newMessage)
			chat.setActive(userId);	
	},
	
	newConversation: function(userId) {
		if(!this.options.conversationUser[userId]) {
			var request = new Request({
				url: ''+this.options.url+'&task=newConversation&userId='+userId,
				method: 'get',
				onSuccess: function(json){
					$('loader').style.display = 'none';
					// handle the response
					var jsonResponse = JSON.decode(json);
					chat.addConversation(userId, chat.options.onlineUser[userId], jsonResponse.chatId, false);
					chat.loadConversation(userId);
				},
				onFailure: function(){
					$('loader').style.display = 'none';	
				}
			});
			$('loader').style.display = 'inline';
			request.send();			
		} else
			chat.loadConversation(userId);
	},
	
	loadConversation: function(userId) {
		if(userId != this.options.activeUserId && this.options.conversationUser[userId]) {
			// load the conversation
			var conversationObject = this.options.conversationUser[userId];
			$('chatUserTitle').set('html', conversationObject.options.userName);
		
			// show the chatBox
			$('chatBox').setStyle('display', 'inline');
			
			// color the userBox
			$('conversation_'+userId).set('class', 'subLinkChatActiv');
			if(this.options.activeUserId != null)
				$('conversation_'+this.options.activeUserId).set('class', 'subLinkChat');
			
			// change the liveChat boxes
			if(this.options.activeUserId != null)
				$('liveChat_'+this.options.conversationUser[this.options.activeUserId].getChatId()).setStyle('display', 'none');
			$('liveChat_'+this.options.conversationUser[userId].getChatId()).setStyle('display', 'inline');
			
			// set the new userId as activ userId
			this.options.activeUserId = userId;
			$('currentChatId').set('value', this.options.conversationUser[userId].getChatId());
			
			this.options.scroller.toBottom.delay(1000, this.options.scroller);
			
			// send to server
			var request = new Request({
				url: ''+this.options.url+'&task=setActiveUser&userId='+userId,
				method: 'get'
			});
			request.send();
		}
	},
	
	quitConversation: function(userId) {
		// send quit command to the server
		if(this.options.conversationUser[userId]) {
			var request = new Request({
				url: ''+this.options.url+'&task=quitConversation&userId='+userId,
				method: 'get',
				onSuccess: function(json){
					$('loader').style.display = 'none';
					// handle the response
					var jsonResponse = JSON.decode(json);
					if(jsonResponse.success) {
						chat.removeConversation(userId);
						chat.resetChatBox();	
					}
				},
				onFailure: function(){
					$('loader').style.display = 'none';	
				}
			});
			$('loader').style.display = 'inline';
			request.send();		
		}	
	},
	
	removeConversation: function(userId) {
		// remove the conversation
		if(userId == this.options.activeUserId)
			this.options.activeUserId = null;
		$('conversation_'+userId).destroy();
		$('liveChat_'+this.options.conversationUser[userId].getChatId()).destroy();
		this.options.conversationUser[userId] = null;
	},

	resetChatBox: function() {
		$('chatBox').setStyle('display', 'none');
		$('chatUserTitle').set('html', this.options.emptyMessage);
	},
	
	addMessageToActive: function(userId, userName, userImage, message) {
		if(this.options.activeUserId != null) {
			userMessage = new Element('div', {'class': 'liveChat_own'});
			userMessage.set('html', '<div style="float:left;margin-right:10px">'+userImage+'</div><div style="float:left; width:310px"><a href="?componentId='+this.options.userComponent+'&userId='+userId+'" class="fontUser"><strong>'+userName+'</strong></a><br />'+message+'</div><div style="clear:both"></div>');
			userMessage.set('id', 'message_'+this.options.messageCount);
			userMessage.injectInside($('liveChat_'+this.options.conversationUser[this.options.activeUserId].getChatId()));
			this.options.messageCount++;
		}
	},
	
	addMessage: function(chatId, userId, userName, userImage, message, myMessage) {
		userMessage = new Element('div', {'class': 'liveChat_'+(myMessage ? 'own' : 'other')});
		userMessage.set('html', '<div style="float:left;margin-right:10px">'+userImage+'</div><div style="float:left; width:310px"><a href="?componentId='+this.options.userComponent+'&userId='+userId+'" class="fontUser"><strong>'+userName+'</strong></a><br />'+message+'</div><div style="clear:both"></div>');
		userMessage.set('id', 'message_'+this.options.messageCount);
		userMessage.injectInside($('liveChat_'+chatId));
		this.options.messageCount++;
	},
	
	setActive: function(userId) {
		if(this.options.conversationUser[userId])
			$('conversation_'+userId).set('class', 'subLinkChatActiv');
	},
	
	loadHistory: function(chatId) {
		var request = new Request({
			url: ''+this.options.url+'&task=loadHistory&chatId='+chatId,
			method: 'get',
			onSuccess: function(json){
				// conversations
				var jsonResponse = JSON.decode(json);
				if(parseInt(jsonResponse.messageNum) > 0) {
					for(var messageId in jsonResponse.messages)
						chat.addMessage(jsonResponse.chatId, jsonResponse.messages[messageId].userId, jsonResponse.messages[messageId].userName, jsonResponse.messages[messageId].userImage, jsonResponse.messages[messageId].message, (chat.options.myUserId == jsonResponse.messages[messageId].userId ? true : false));	
				}
			}
		});
		request.send();		
	}
});

var Conversation = new Class({
							
	Implements: [Options],
	
	initialize: function(options) {
		this.options = {'chatId': options.chatId, 'userName': options.userName}	
	},
	
	getChatId: function() {
		return this.options.chatId;	
	}
});

/*
Script: Background.js
	Class for generating a picture background
*/
var Background = new Class({

    Implements: [Options],

    options : {
		backgrounds: null,
        indexNum: 0,
        backgroundBox: null,
        backgroundImage: null
	},

    initialize: function(options) {

        this.options.path = options.path;

        this.options.backgrounds = new Object();

        // create background layer
        this.backgroundBox = new Element('div');
    	this.backgroundBox.set('id', 'mooBackgroundShow');
        this.backgroundBox.set('class', 'mooBackground');

        // create background image
        this.backgroundImage = new Element('img');
        this.backgroundImage.set('id', 'mooBackgroundImage');
        this.backgroundImage.setStyle('width', '100%');
        this.backgroundImage.setStyle('min-width', '1024px');


        // inject in body
		this.backgroundBox.injectInside(document.body);
        this.backgroundImage.injectInside(this.backgroundBox);

    },

    addBackground: function(backgroundName) {

        this.options.backgrounds[this.options.indexNum] = backgroundName;

        this.options.indexNum = this.options.indexNum + 1;

    },

    showBackground: function() {

        // set background by random, if not saved in cookie
        var bCookie = Cookie.read('mooBackground');

        if($defined(bCookie)) {

            this.setBackground(bCookie);

        } else {

            this.setBackground(this.options.backgrounds[$random(0, Object.size(this.options.backgrounds) - 1)]);

        }

    },

    setBackground: function(backgroundName) {

        $('mooBackgroundImage').set('src', this.options.path+backgroundName);

        Cookie.write('mooBackground', backgroundName, {'duration': 365});

    }

});

var ContentBar = new Class({

    Implements: [Options],

    options : {
        contentBar: null,
        contentBarButtons: null,
        hiddenContent: null,
        currentContent: null
	},

    initialize: function() {
        this.options.contentBar = $('mooContentBar');
        this.options.contentBarButtons = $('mooContentBarButtons');
        this.options.hiddenContent = $('mooHiddenContent');
    },

    addContentBar: function(color, buttonClass, title, content) {

        // create button
        var newButton = new Element('div');
        newButton.set('class', buttonClass);
        newButton.setStyle('background-color', color);
        newButton.set('html', title);

        // add functionality
        newButton.addEvent('click', function() {

            // check the current content
            if(this.options.currentContent !== content) {

                // hide the current content
                if($defined(this.options.currentContent)) {

                    $(this.options.currentContent).injectInside(this.options.hiddenContent)

                }

                // change color
                this.colorContentBar(color);

                // show content
                this.showContent(content);

                // set current content
                this.options.currentContent = content;

                // slide in
                new Fx.Slide(this.options.contentBar).slideIn();

            } else {

                // toggle the content bar
                new Fx.Slide(this.options.contentBar).toggle();

            }

        }.bind(this));

        newButton.injectInside(this.options.contentBarButtons);

        // add content to hidden field
        $(content).injectInside(this.options.hiddenContent);
    },

    colorContentBar: function(color) {

        this.options.contentBar.setStyle('background-color', color);

    },

    showContent: function(content) {

        $(content).injectInside(this.options.contentBar);

    }

});

/*
Script: Tabber.js
	Class for generating a small tabbers
*/
var Tabber = new Class({

    Implements: [Options],

    options : {
        frameDiv: null,
        emptyDiv: null,
        link: null,
        tabberId: null,
        i: null
    },

    initialize: function(options) {

        this.options.delLink = options.delLink;
        this.options.frameDiv = $(options.frameDiv);
        this.options.emptyDiv = $(options.frameDiv + '_empty');
        this.options.tabberId = options.tabberId;

    },

    addTabber: function(linkId, title) {

        if(!$defined($('tabber_' + this.options.tabberId + '_' + linkId))) {

            this.options.emptyDiv.setStyle('display', 'none');

            var newTabber = new Element('div');
            newTabber.set('id', 'tabber_' + this.options.tabberId + '_' + linkId);
            newTabber.set('class', 'tabber');

            var tabberTitle = new Element('span');
            tabberTitle.set('class', 'title');
            tabberTitle.set('html', title);

            var tabberDelete = new Element('div');
            tabberDelete.set('class', 'del');
            tabberDelete.set('id', 'tabberDel_' + this.options.tabberId + '_' + linkId);
            tabberDelete.set('onclick', 'ajaxCallForBool(\'' + this.options.delLink + linkId + '\', \'get\', null, \'' + this.options.tabberId + '.deleteTabber(' + linkId + ')\')');

            tabberDelete.injectInside(newTabber);
            tabberTitle.injectInside(newTabber);

            newTabber.injectInside(this.options.frameDiv);

            this.options.i++;

        }

    },

    deleteTabber: function(linkId) {

        this.options.i--;

        this.options.frameDiv.removeChild($('tabber_' + this.options.tabberId + '_' + linkId));

        if(this.options.i == 0)

            this.options.emptyDiv.setStyle('display', 'block');

    }

});


// Helper to get the length of an object
Object.size = function(obj) {
    var size = 0, key;
    for (key in obj) {
        if (obj.hasOwnProperty(key)) size++;
    }
    return size;
};

// Customized select, radio and checkboxes
/*

CUSTOM FORM ELEMENTS

Created by Ryan Fait
www.ryanfait.com

The only things you may need to change in this file are the following
variables: checkboxHeight, radioHeight and selectWidth (lines 24, 25, 26)

The numbers you set for checkboxHeight and radioHeight should be one quarter
of the total height of the image want to use for checkboxes and radio
buttons. Both images should contain the four stages of both inputs stacked
on top of each other in this order: unchecked, unchecked-clicked, checked,
checked-clicked.

You may need to adjust your images a bit if there is a slight vertical
movement during the different stages of the button activation.

The value of selectWidth should be the width of your select list image.

Visit http://ryanfait.com/ for more information.

*/

var checkboxHeight = "25";
var radioHeight = "25";
var selectWidth = "300";


/* No need to change anything after this */


document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: ' + selectWidth + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } .disabled { opacity: 0.5; filter: alpha(opacity=50); }</style>');

var Custom = {
	init: function() {
		var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
		for(a = 0; a < inputs.length; a++) {
            if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].isStyled !== true && inputs[a].className == "styled") {

                span[a] = document.createElement("span");
				span[a].className = inputs[a].type;
                inputs[a].isStyled = true;

				if(inputs[a].checked == true) {
					if(inputs[a].type == "checkbox") {
						position = "0 -" + (checkboxHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					} else {
						position = "0 -" + (radioHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					}
				}
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.clear;
				if(!inputs[a].getAttribute("disabled")) {
					span[a].onmousedown = Custom.pushed;
					span[a].onmouseup = Custom.check;
				} else {
					span[a].className = span[a].className += " disabled";
				}
			}
		}
		inputs = document.getElementsByTagName("select");
		for(a = 0; a < inputs.length; a++) {
			if(inputs[a].className == "styled" && inputs[a].isStyled !== true) {
			    inputs[a].isStyled = true;
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "select";
				span[a].id = "select" + inputs[a].id;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				if(!inputs[a].getAttribute("disabled")) {
					inputs[a].onchange = Custom.choose;
				} else {
					inputs[a].previousSibling.className = inputs[a].previousSibling.className += " disabled";
				}
			}
		}
		document.onmouseup = Custom.clear;
	},
	pushed: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px";
		} else if(element.checked == true && element.type == "radio") {
			this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
		} else if(element.checked != true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
		} else {
			this.style.backgroundPosition = "0 -" + radioHeight + "px";
		}
	},
	check: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 0";
			element.checked = false;
		} else {
			if(element.type == "checkbox") {
				this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else {
				this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
				group = this.nextSibling.name;
				inputs = document.getElementsByTagName("input");
				for(a = 0; a < inputs.length; a++) {
					if(inputs[a].name == group && inputs[a] != this.nextSibling) {
						inputs[a].previousSibling.style.backgroundPosition = "0 0";
					}
				}
			}
			element.checked = true;
		}
	},
	clear: function() {
		inputs = document.getElementsByTagName("input");
		for(var b = 0; b < inputs.length; b++) {
			if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			} else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
			} else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
		}
	},
	choose: function() {
		option = this.getElementsByTagName("option");
		for(d = 0; d < option.length; d++) {
			if(option[d].selected == true) {
				document.getElementById("select" + this.id).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
			}
		}
	}
}
window.onload = Custom.init;

