(function($) {	$.fn.inputDefualts = function(options) {		var defaults = {			cl: 'inactive',			text: this.val()  		}, 	opts = $.extend(defaults, options);			this.addClass(opts['cl']);		this.val(opts['text']);		this.focus(function() {			if($(this).val() == opts['text']) $(this).val('');			$(this).removeClass(opts['cl']);		});		this.blur(function() {			if($(this).val() == '') {				$(this).val(opts['text']);				$(this).addClass(opts['cl']);			}		});	};})(jQuery);$(document).ready(function(){	var log = function(){		var lheight = $(document).height();		$('.sign-up').css({'height' : lheight +'px'});		$('.sign-up .bg').css({'height' : lheight +'px'});	};	log();	$('#main .login .username input').focus(function(){	$(this).parent().addClass('ausername');});	$('#main .login .username input').blur(function(){$(this).parent().removeClass('ausername');});	$('#main .login .password input').focus(function(){	$(this).parent().addClass('apassword');});	$('#main .login .password input').blur(function(){$(this).parent().removeClass('apassword');});		$('.sign-up form input, .bprofile form input, .bpayments form input').focus(function(){	$(this).parent().addClass('active');});	$('.sign-up form input, .bprofile form input, .bpayments form input').blur(function(){$(this).parent().removeClass('active');});	$('#main .login button, .sign-up form button, .bprofile form button, .bpayments form button').hover(		function(){			$(this).addClass('hover');		},		function(){			$(this).removeClass('hover');		}	);	$('#uname, #email').inputDefualts({text: 'nickname@gmail.com'});	$('#password, #fpassword, #repassword').inputDefualts({text: '************'});		$('.notamember .sign').click(function(){$('.sign-up').css({'display' : 'block'}); return false;});	$('.sign-up .close').click(function(){$('.sign-up').css({'display' : 'none'}); return false;});	$(document).not('div.select').click(function(){		$('.select ul').hide();		$('.select').removeClass('active-block');	});	$('div.select .choice a').click(function(){	if ($(this).parent().parent().hasClass('active-block')) {		$('.select ul').show();		$('.select').removeClass('active-block');	} else {		$('div.select ul').hide();		$(this).parent().parent().children('ul').show();		$(this).parent().parent().addClass('active-block');		return false		}	});	$('div.select li a').click(function(){		fs = $(this).text();		$(this).parent().parent().parent().children().children('a').text(fs);		$('.select ul li').removeClass('active');		$(this).parent().addClass('active');		ss = $('.select ul .active').prevAll().size();		$(this).parent().parent().parent().children().children('select').children('option:eq('+ss+')').attr('selected','selected');		$('.select ul').hide();		$('.select').removeClass('active-block');		return false	});		$('.menu > li').click(function(){		$(this).parent().find('li').removeClass('active')		$(this).addClass('active');}	);});/*	CRIR - Checkbox & Radio Input Replacement	Author: Chris Erwin (me[at]chriserwin.com)	www.chriserwin.com/scripts/crir/	Updated July 27, 2006.	Jesse Gavin added the AddEvent function to initialize	the script. He also converted the script to JSON format.	Updated July 30, 2006.	Added the ability to tab to elements and use the spacebar	to check the input element. This bit of functionality was	based on a tip from Adam Burmister.*/crir = {	userAgent: '',	isSafari: false,	init: function() {		this.userAgent = navigator.userAgent.toLowerCase();		this.isSafari = ((this.userAgent.indexOf('safari')!=-1)&&(this.userAgent.indexOf('mac')!=-1))?true:false;		if (! this.isSafari) { // the script doesn't work in safari.			arrLabels = document.getElementsByTagName('label');			searchLabels:			for (var i=0; i<arrLabels.length; i++) {							// get the input element based on the for attribute of the label tag				if (arrLabels[i].getAttributeNode('for') && arrLabels[i].getAttributeNode('for').value != '') {					labelElementFor = arrLabels[i].getAttributeNode('for').value;									inputElement = document.getElementById(labelElementFor);				}				else {									continue searchLabels;				}					inputElementClass = inputElement.className;					// if the input is specified to be hidden intiate it				if (inputElementClass == 'crirHiddenJS') {					inputElement.className = 'crirHidden';					inputElementType = inputElement.getAttributeNode('type').value;						// add the appropriate event listener to the input element					if (inputElementType == "checkbox") {						inputElement.onclick = crir.toggleCheckboxLabel;					}					else {						inputElement.onclick = crir.toggleRadioLabel;					}					// set the initial label state					if (inputElement.checked) {						if (inputElementType == 'checkbox') { arrLabels[i].className = 'checkbox_checked'}						else { arrLabels[i].className = 'radio_checked' }					}					else {						if (inputElementType == 'checkbox') { arrLabels[i].className = 'checkbox_unchecked'}						else { arrLabels[i].className = 'radio_unchecked' }					}				}				else if (inputElement.nodeName != 'SELECT' && inputElement.getAttributeNode('type').value == 'radio') { // this so even if a radio is not hidden but belongs to a group of hidden radios it will still work.					arrLabels[i].onclick = crir.toggleRadioLabel;					inputElement.onclick = crir.toggleRadioLabel;				}			}		}	},		findLabel: function (inputElementID) {		arrLabels = document.getElementsByTagName('label');		searchLoop:		for (var i=0; i<arrLabels.length; i++) {			if (arrLabels[i].getAttributeNode('for') && arrLabels[i].getAttributeNode('for').value == inputElementID) {								return arrLabels[i];				break searchLoop;							}		}			},		toggleCheckboxLabel: function () {		labelElement = crir.findLabel(this.getAttributeNode('id').value);		if(labelElement.className == 'checkbox_checked') {			labelElement.className = "checkbox_unchecked";		}		else {			labelElement.className = "checkbox_checked";		}	},		toggleRadioLabel: function () {			 		clickedLabelElement = crir.findLabel(this.getAttributeNode('id').value);		clickedInputElement = this;		clickedInputElementName = clickedInputElement.getAttributeNode('name').value;		arrInputs = document.getElementsByTagName('input');		// uncheck (label class) all radios in the same group		for (var i=0; i<arrInputs.length; i++) {						inputElementType = arrInputs[i].getAttributeNode('type').value;			if (inputElementType == 'radio') {				inputElementName = arrInputs[i].getAttributeNode('name').value;				inputElementClass = arrInputs[i].className;				// find radio buttons with the same 'name' as the one we've changed and have a class of chkHidden				// and then set them to unchecked				if (inputElementName == clickedInputElementName && inputElementClass == 'crirHidden') {									inputElementID = arrInputs[i].getAttributeNode('id').value;					labelElement = crir.findLabel(inputElementID);					labelElement.className = 'radio_unchecked';				}			}		}		// if the radio clicked is hidden set the label to checked		if (clickedInputElement.className == 'crirHidden') {			clickedLabelElement.className = 'radio_checked';		}	},	addEvent: function(element, eventType, doFunction, useCapture){		if (element.addEventListener) 		{			element.addEventListener(eventType, doFunction, useCapture);			return true;		} else if (element.attachEvent) {			var r = element.attachEvent('on' + eventType, doFunction);			return r;		} else {			element['on' + eventType] = doFunction;		}	}}crir.addEvent(window, 'load', crir.init, false);
