( function($)
{	
	$.simplexWebs = function( page, extra )
	{
		var
		home = function( )
		{
			var
			tabs = function( )
			{
				$('section.rotatingBanner').tabs( { fx: { opacity: 'toggle' } } ).tabs("rotate", 7000, true);
				$('section.rotatingBanner article')
				.live( 'mouseover', function(){
					$('section.rotatingBanner').tabs("rotate", 0, false);
				} )
				.live( 'mouseout', function(){
					$('section.rotatingBanner').tabs( { fx: { opacity: 'toggle' } } ).tabs("rotate", 7000, true);
				} );
			};
			
			return tabs();
		},
		phone = function( )
		{
			$.getJSON( 'http://rest.onebip.com/geolocator/.jsonp?callback=?', function( data ){
				$('span.location').html( data.row.countryname );
				
				$('select.countries').prepend( '<option value="' + data.row.countryname + '" selected>' + data.row.countryname + '</option>' );
			} );
		},
		tickets = function( )
		{
		    $("#addfileupload").click(function () {
		        $("#fileuploads").append("<input type=\"file\" name=\"attachments[]\" size=\"50\"><br />");
		        return false;
		    });
		},
		register = function( )
		{
			var
			init = function( )
			{
				$('span.strength').html('<table align="center" cellspacing="5"><tr><td width="102"><div id="pwstrengthpos" style="position:relative;float:left;width:0px;background-color:#33CC00;border:1px solid #000;border-right:0px;">&nbsp;</div><div id="pwstrengthneg" style="position:relative;float:right;width:100px;background-color:#efefef;border:1px solid #000;border-left:0px;">&nbsp;</div></td></tr></table>');
				$("#newpw").keyup(function () {
			        var pwvalue = jQuery("#newpw").val();
			        var pwstrength = strength(pwvalue);
			        jQuery("#pwstrength").html("Strong");
			        jQuery("#pwstrengthpos").css("background-color","#33CC00");
			        if (pwstrength<75) {
			            jQuery("#pwstrength").html("Moderate");
			            jQuery("#pwstrengthpos").css("background-color","#ff6600");
			        }
			        if (pwstrength<30) {
			            jQuery("#pwstrength").html("Weak");
			            jQuery("#pwstrengthpos").css("background-color","#cc0000");
			        }
			        jQuery("#pwstrengthpos").css("width",pwstrength);
			        jQuery("#pwstrengthneg").css("width",100-pwstrength);
			    });
			},
			strength = function( pw )
			{
				var pwlength=(pw.length);
			    if(pwlength>5)pwlength=5;
			    var numnumeric=pw.replace(/[0-9]/g,"");
			    var numeric=(pw.length-numnumeric.length);
			    if(numeric>3)numeric=3;
			    var symbols=pw.replace(/\W/g,"");
			    var numsymbols=(pw.length-symbols.length);
			    if(numsymbols>3)numsymbols=3;
			    var numupper=pw.replace(/[A-Z]/g,"");
			    var upper=(pw.length-numupper.length);
			    if(upper>3)upper=3;
			    var pwstrength=((pwlength*10)-20)+(numeric*10)+(numsymbols*15)+(upper*10);
			    if(pwstrength<0){pwstrength=0}
			    if(pwstrength>100){pwstrength=100}
			    return pwstrength;
			}
			return init();
		},
		pwStrength = function( )
		{
			jQuery(document).ready(function(){
			    jQuery("#newpw").keyup(function () {
			        var pwvalue = jQuery("#newpw").val();
			        var pwstrength = getPasswordStrength(pwvalue);
			        jQuery("#pwstrength").html("Strong");
			        jQuery("#pwstrengthpos").css("background-color","#33CC00");
			        if (pwstrength<75) {
			            jQuery("#pwstrength").html("Moderate");
			            jQuery("#pwstrengthpos").css("background-color","#ff6600");
			        }
			        if (pwstrength<30) {
			            jQuery("#pwstrength").html("Weak");
			            jQuery("#pwstrengthpos").css("background-color","#cc0000");
			        }
			        jQuery("#pwstrengthpos").css("width",pwstrength);
			        jQuery("#pwstrengthneg").css("width",100-pwstrength);
			    });
			});

			function getPasswordStrength(pw){
			    var pwlength=(pw.length);
			    if(pwlength>5)pwlength=5;
			    var numnumeric=pw.replace(/[0-9]/g,"");
			    var numeric=(pw.length-numnumeric.length);
			    if(numeric>3)numeric=3;
			    var symbols=pw.replace(/\W/g,"");
			    var numsymbols=(pw.length-symbols.length);
			    if(numsymbols>3)numsymbols=3;
			    var numupper=pw.replace(/[A-Z]/g,"");
			    var upper=(pw.length-numupper.length);
			    if(upper>3)upper=3;
			    var pwstrength=((pwlength*10)-20)+(numeric*10)+(numsymbols*15)+(upper*10);
			    if(pwstrength<0){pwstrength=0}
			    if(pwstrength>100){pwstrength=100}
			    return pwstrength;
			}

			$('.strengthBar').html('<table align="center" cellspacing="5"><tr><td width="102"><div id="pwstrengthpos" style="position:relative;float:left;width:0px;background-color:#33CC00;border:1px solid #000;border-right:0px;">&nbsp;</div><div id="pwstrengthneg" style="position:relative;float:right;width:100px;background-color:#efefef;border:1px solid #000;border-left:0px;">&nbsp;</div></td></tr></table>');
		},
		login = function( )
		{
			$('a.remember-me').click( function(e){
				if( $(this).hasClass('active') )
				{
					$('input.rememberme').attr('value', '').attr('name', '');
					$(this).removeClass('active');
				}
				else {
					$('input.rememberme').attr('value', 'on').attr('name', 'rememberme');
					$(this).addClass('active');
				}
				
				e.preventDefault();
				return false;
			} );
			
			$('form').tinyForm();
		},
		status = function( )
		{
			var
			update = function( )
			{
				$.get( 'status/update', function(data)
				{
					$('div.load').slideUp();
					
					var json = $.parseJSON( data );
					
					var html =  '<table style="width: 100%;">';
						html += '<tr class="header">';
							html += '<td class="first">Server Name</td>';
							html += '<td align="center">Status</td>';
							html += '<td align="center">Ping</td>';
							html += '<td align="center">Last Checked</td>';
							html += '<td align="center">Last Problem</td>';
						html += '</tr>';
						
					var r = 0;
					for( i in json )
					{
						json[i].checkName = json[i].checkName;
						html += '<tr style="background: #' + ( ( r % 2 == 0 ) ? 'f8f7f7' : 'f0efef' ) + '">';
							html += '<td class="first">' + i + '</td>';
							html += '<td align="center">' + ( ( json[i].status == 'up' ) ? '<img src="/assets/images/icons/tick-green.png" alt="" />' : '<img src="/assets/images/icons/cross-red.png" alt="" />' ) + '</td>';
							html += '<td align="center">' + json[i].response + 'ms</td>';
							html += '<td align="center">' + json[i].update + '</td>';
							html += '<td align="center"t>' + json[i].downtime + '</td>';
						html += '</tr>';
						
						r++;
					}

					html += '</table>';

					$('div.serverInfo').html( html );
					
					$('abbr').fbtime();

					setTimeout( function(){ 
						$('div.serverInfo').slideDown();
					}, 500 );
				});
			},
			init = function( )
			{
				update();

				$('a.refresh').click(function(e){
					$('div.serverInfo').slideUp();
					$('div.load').slideDown();

					update();
					
					e.preventDefault();
					return false;
				});
			};
			
			return init( );
		},
		hosting = function( )
		{
			var
			toggleCountry = function( )
			{
				$('ul.countryPicker li.country:not(.ignore)')
				.bind( 'click', function(){
					$('ul.countryPicker li.country.active').removeClass('active');
					$(this).addClass('active');
					
					var id = $(this).attr('id');
					var price;
					
					$('div.plan').each( function(){
					
						price = '&pound' + $(this).attr('data-' + id + '-price').replace('.', '<sup>') + '</sup>';
										
						$(this).find('.price').html(price);
						$(this).find('.price-annual').html('<strong>&pound' + $(this).attr('data-' + id + '-price-annual') + '</strong>');
						$(this).find('.order-go').attr('href', 'https://www.simplexwebs.com/order/product/' + $(this).attr('data-' + id + '-id'));
					} );
				} );
			},
			toggleFeatures = function( )
			{
				var
				timeout;
				
				$('div.features ul li')
				.bind( 'click', function(){
					var $this = $(this);
					
					$('div.features ul li.active').removeClass('active', 'fast');
					$this.addClass('active', 'fast');
										
					$('div.features div.featuresContent > div' ).fadeOut();
					
					$('div.features div.featuresContent').animate({height: $('div.features div.featuresContent div.' + $this.attr('id') ).height() }, 500 );
					clearTimeout( timeout );
					timeout = setTimeout( function(){ $('div.features div.featuresContent div.' + $this.attr('id') ).fadeIn(); }, 500 );
				} );
			};
			
			var timeout;
			$('a[data-text]')
			.bind( 'mouseover', function(){
				clearTimeout( timeout );
				
				$('div.tooltip').html($(this).attr('data-text') + '<small></small>').css({top: $(this).offset().top - $('div.tooltip').height() - 40, left: $(this).offset().left - 23}).show();
			} )
			.bind( 'mouseout', function(){
				var $this = $(this);
				
				$('div.tooltip').hide();
			} );
			
			return toggleCountry(), toggleFeatures();
		},
		shoutcast = function( )
		{
			var
			settings = {
				kbps: [ 24, 32, 48, 64, 96, 128 ],
				bitrate: { 24: 197, 32: 196, 48: 195, 64: 198, 96: 199, 128: 200 },
				pid: {
					us: { 'normal': 176, 'auto': 177 },
					uk: { 'normal': 20, 'auto': 103 }
				}
			},
			prices = {
				kbps: {
					24: 0.5,
					32: 1.25,
					48: 2,
					64: 3,
					96: 4,
					128: 6
				},
				listeners: 0.03,
				autodjGB: 1,
				autodj: 9.99
			},
			country = 'uk',
			listeners = 250,
			bitrate = 3,
			autodj = false,
			toggleCountry = function( )
			{
				$('ul.countryPicker li.country')
				.bind( 'click', function(){
					$('ul.countryPicker li.country.active').removeClass('active');
					$(this).addClass('active');
					
					country = $(this).attr('id');
					
					$('#pid').val( settings.pid[ country ][ ( autodj ? 'auto' : 'normal' ) ] );
				} );
			},
			updatePrice = function( )
			{
				var price = ( ( listeners * prices.listeners ) + ( prices.kbps[ settings.kbps[ bitrate ] ] ) + ( ( autodj !== false ) ? ( autodj * prices.autodjGB ) + ( prices.autodj - prices.autodjGB ) : 0 ) );
				
				$('span.price span').html( price.toFixed(2) );
				
				return false;
			},
			handleListeners = function( e, u )
			{
				listeners = u.value;
				
				$('span.text.listeners').text( u.value );
				$('#sc_listeners').val( u.value );
				
				updatePrice();
			},
			handleKBPS = function( e, u )
			{
				bitrate = u.value;
				
				$('span.text.kbps').text( settings.kbps[ u.value ] );
				$('#sc_bitrate').val( settings.bitrate[ settings.kbps[ u.value ] ] );
				
				updatePrice();
			},
			handleAutoDJ = function( e, u )
			{
				autodj = u.value;
				
				$('span.text.autodj').text( u.value );
				$('#sc_allowance').val( u.value );
				
				updatePrice();
			},
			init = function( )
			{
				$('div.listeners')
				.slider( {
					value: 250,
					min: 25,
					max: 500,
					step: 25,
					range: 'min',
					slide: handleListeners
				} );
				
				$('div.kbps')
				.slider( {
					value: 3,
					min: 0,
					max: 5,
					range: 'min',
					slide: handleKBPS
				} );
				
				$('div.autodj')
				.slider( {
					value: 1,
					min: 1,
					max: 20,
					range: 'min',
					slide: handleAutoDJ
				} );
				
				$('a.button-red').click( function(){
					$('form.order').submit();
					return false;
				} );
				
				$('a.autodj-toggle')
				.click( function(){
					
					$(this).fadeOut();
					
					$('div.autodj-container').slideDown();
					setTimeout( function(){
						$('div.autodj-innerContainer').fadeIn();
						$('span.autodj small').html('Remove AutoDJ &raquo;').css('cursor', 'pointer').animate({top: '20px'}, 500);
					}, 500 );
					
					autodj = $('div.autodj').slider('option', 'value');
					updatePrice();
					
					autodj = true;
					
					$('#pid').val( settings.pid[ country ][ ( autodj ? 'auto' : 'normal' ) ] );
					if( $('#sc_allowance').val() == 0 )
						$('#sc_allowance').val('1');
					
					return false;
				} );
				
				$('span.autodj small')
				.click( function(){
					if( $('a.autodj-toggle').is(':visible') === false )
					{
						$('div.autodj-innerContainer').fadeOut();
						
						$('span.autodj small').html('Only &pound;9.99 a month').animate({top: '42px'}, 500);
						
						setTimeout( function(){
							$('div.autodj-container').slideUp();
							
							$('a.autodj-toggle').fadeIn();
						}, 500 );
						
						autodj = false;
						updatePrice();
						
						$('#pid').val( settings.pid[ country ][ ( autodj ? 'auto' : 'normal' ) ] );
					}
					
					return false;
				} );
				
				updatePrice();
			};
			
			return init(), toggleCountry();
		},
		order = function( extra )
		{
			$('form').tinyForm();
			
			var
			configureDomains = function( )
			{
				var completeDomain = function( extra )
				{
					$("#domainresults").append('<img src="images/loading.gif" border="0" alt="Loading..." />');
					
					$.post(
							'cart.php',
							'ajax=1&a=add&pid=' + extra.pid + '&' + $('#domainfrm').serialize(),
							function( data )
							{
								if( data == '' )
								{
									window.location='cart.php?a=view';
								} else {
									$('#prodconfigcontainer').html(data);
									
									$('div.errorBox').slideUp();
				    				$('div.overlay div').fadeOut( function(){ $('div.overlay').fadeOut() } );
								}
							}
						);
				}
				$('.reginput').hide();
				$('.domainoptions input:first').attr('checked','checked').parent().addClass('optionselected');
				
				$('.domainoptions .option').first().css('-moz-border-radius-topleft','10px').css('-moz-border-radius-topright','10px');
				$('.domainoptions .option').last().css('border-bottom','0').css('-moz-border-radius-bottomleft','10px').css('-moz-border-radius-bottomright','10px');
				$('#domain'+$('.domainoptions input:first').val()).show();
				
				$('.domainoptions input:radio').click(function(){
					$('.domainoptions .option').removeClass('optionselected');
					$(this).parent().addClass('optionselected');
					$('#domainresults').slideUp();
					$('.domainreginput').hide();
					$('#domain'+$(this).val()).show();
				});
				
				$('form.domains ul.tick > li').click( function(){
					if( $(this).hasClass('active') === false )
					{
						$(this).parent().find('div').hide().parent().removeClass('active');
						$(this).addClass('active');
						
						$(this).find('div').show();
						$('input#selincart').val( $(this).find('div').attr('id') );
					}
				} );
				
				$('span.field ul').customList( {
					open: function( element ){
						element.css( { borderBottomLeftRadius: '5px' } );
					},
					hide: function( element ){
						element.css( { height: '35px', borderBottomLeftRadius: '0' } );
					}
				} );
				
				$('form.domains').submit( function()
				{
					$('div.overlay').fadeIn( function(){ $('div.overlay div').fadeIn(); } );
				    
				    var
				    domainoption = $('input#selincart').val(),
				    sld = $('#'+domainoption+'sld').val();
				    tld = '';
				    
				    if( domainoption == 'incart' )
				    	sld = $('#'+domainoption+'sld option:selected').text();
				    else if( domainoption == 'subdomain' )
				    	tld = $('#'+domainoption+'tld option:selected').text();
				    else if( domainoption == 'register' )
				    	tld = $('#field-registertld').val();
				    else if( domainoption == 'transfer' )
				    	tld = $('#field-transfertld').val();
				    else
				    	tld = $('#'+domainoption+'tld').val();
				    
				    
				    $.post(
				    		'cart.php',
				    		{ ajax: 1, a: 'domainoptions', sld: sld, tld: tld, checktype: domainoption },
				    		function( data )
				    		{
				    			if( data.match(/completedomain/i) )
				    			{
				    				$('form#domainfrm').html( String( data ).replace('completedomain();', '' ) );
				    				completeDomain( extra );
				    			} else {
				    				$('div.errorBox').html( data ).slideDown().find('a').remove();
				    				if( data.match(/taken/i) )
				    				{
				    					$('div.errorBox input[type=submit]').hide();
				    				} else {
				    					$('div.errorBox input[type=submit]').val('Continue').addClass('checkout').show();
				    				}
				    				
				    				$('div.overlay div').fadeOut( function(){ $('div.overlay').fadeOut() } );
				    			}
				    		}
				    	);
				    
					return false;
				} );
				
				$('form#domainfrm').submit( function(){
					completeDomain( extra );
					
					return false;
				} );
				
				$('div.addons ul.tick > li, div.configoptions ul.tick > li').live( 'click', function(){
					if( $(this).hasClass('active') )
					{
						$('input.' + $(this).attr('id')).removeAttr('checked');
						$(this).removeClass('active');
					} else {
						$('input.' + $(this).attr('id')).attr('checked', 'checked');
						$(this).addClass('active');
					}
					
					recalctotals();
				} );
				
				$('div.billingcycle ul li').live( 'click', function(){
					if( $(this).hasClass('active') === false )
					{
						$('div.billingcycle input').val( $(this).attr('id') );
						$('div.billingcycle ul li').removeClass('active');
						$(this).addClass('active');
						
						recalctotals();
					}
				} );
			},
			viewCart = function( )
			{
				var
				init = function( )
				{
					$('span.strength').html('<table align="center" cellspacing="5"><tr><td width="102"><div id="pwstrengthpos" style="position:relative;float:left;width:0px;background-color:#33CC00;border:1px solid #000;border-right:0px;">&nbsp;</div><div id="pwstrengthneg" style="position:relative;float:right;width:100px;background-color:#efefef;border:1px solid #000;border-left:0px;">&nbsp;</div></td></tr></table>');
					$("#newpw").keyup(function () {
				        var pwvalue = jQuery("#newpw").val();
				        var pwstrength = strength(pwvalue);
				        jQuery("#pwstrength").html("Strong");
				        jQuery("#pwstrengthpos").css("background-color","#33CC00");
				        if (pwstrength<75) {
				            jQuery("#pwstrength").html("Moderate");
				            jQuery("#pwstrengthpos").css("background-color","#ff6600");
				        }
				        if (pwstrength<30) {
				            jQuery("#pwstrength").html("Weak");
				            jQuery("#pwstrengthpos").css("background-color","#cc0000");
				        }
				        jQuery("#pwstrengthpos").css("width",pwstrength);
				        jQuery("#pwstrengthneg").css("width",100-pwstrength);
				    });
					
					$('ul.navigation li').click( function(){
						var $this = $(this);
						$('div.details div.toggle').slideUp();
						
						$('div.details div.' + $this.attr('id') ).slideDown();
						
						$this.parent().find('li').removeClass('active');
						$this.addClass('active');
					} );
					
					$('div.domainDetails ul.tick > li').click( function(){
						if( $(this).hasClass('active') === false )
						{
							if( $(this).hasClass('new') )
							{
								$('div.domain.address').slideDown();
							} else {
								$('div.domain.address').slideUp();
							}
							$(this).parent().find('li').removeClass('active');
							$(this).addClass('active');
							
							$('input.domainType').val( $(this).attr('id') );
						}
					} );
					
					$('div.payment ul.tick > li').click( function(){
						if( $(this).hasClass('active') === false )
						{
							$(this).parent().find('li').removeClass('active');
							$(this).addClass('active');
							
							$('input.paymentInput').val( $(this).attr('id') );
						}
					} );
				},
				strength = function( pw )
				{
					var pwlength=(pw.length);
				    if(pwlength>5)pwlength=5;
				    var numnumeric=pw.replace(/[0-9]/g,"");
				    var numeric=(pw.length-numnumeric.length);
				    if(numeric>3)numeric=3;
				    var symbols=pw.replace(/\W/g,"");
				    var numsymbols=(pw.length-symbols.length);
				    if(numsymbols>3)numsymbols=3;
				    var numupper=pw.replace(/[A-Z]/g,"");
				    var upper=(pw.length-numupper.length);
				    if(upper>3)upper=3;
				    var pwstrength=((pwlength*10)-20)+(numeric*10)+(numsymbols*15)+(upper*10);
				    if(pwstrength<0){pwstrength=0}
				    if(pwstrength>100){pwstrength=100}
				    return pwstrength;
				}
				return init();
			};
			
			switch( extra.page )
			{
				case 'configuredomains':
					return configureDomains( extra );
					break;
				case 'viewcart':
					return viewCart();
					break;
			}
		},
		domains = function( extra )
		{
			$.jGrowl('Domains must be a minimum of 3 letters!', {sticky: true, header:'Important!'});
			
			$('form.domains').submit(function(e){e.preventDefault(); return false;}).tinyForm();
			
			var
			timeout,
			xhr = [],
			prices = {},
			tlds = [],
			rules = { 'couk': 2, 'orguk': 2, 'meuk': 2, 'ltduk': 2, 'plcuk': 2, 'netuk': 2 },
			notification = false,
			orderNotification = false,
			codes = {};
			
			$.extend( prices, extra.prices );
			$.extend( codes, extra.tlds );
			
			$('form.domains input').keydown( function(e){
				var code = (e.keyCode ? e.keyCode : e.which),
					$this = $(this);
				
				if( code == 190 )
				{
					e.preventDefault();
					return false;
				}
				
				if( ( ( code >= 48 && code <= 90 ) || code == 189 || code == 8 ) && !e.altKey && !e.ctrlKey )
				{
					clearTimeout( timeout );
					
					for( i in xhr )
						xhr[i].abort();
					
					for( i in tlds )
						tlds.splice(i, 1);
					
					timeout = setTimeout( function(){
						if( $('form.domains input').val().length > 2 )
						{
							$('.domains ul div.overlay').css({zIndex: 3}).animate({opacity: 0.3});
							
							$('div.price.box').fadeOut();
							setTimeout( function(){
								$('div.priceContainer').slideUp();
								priceUpdate();
							}, 500 );
							
							$('form.order').html('');
							
							$('.domains ul li').removeClass('taken').removeClass('available').removeClass('order');
							
							if( notification == false )
							{
								$.jGrowl('To order a domain, simply click on the available ones (in green)', {sticky: true, header:'Important!'});
								notification = true;
							}
							
							$('div.tooltip').hide();
							$('.domains ul li').removeAttr('data-years');
							
							if( $this.val() != '' && $this.val() != ' ' )
							{
								var
								done = 0,
								tlds = 2,
								amount = $('.domains ul li').size(),
								requests = amount / tlds,
								i = 0;
								
								//currentDomain = $this.val();
								
								while( i < requests )
								{
									xhr[ i ] = $.ajax( {
										type: 'GET',
										crossDomain: true,
										dataType: 'jsonp',
										url: 'http://api-' + Math.floor( Math.random() * 100 ) + '.simplexwebs.com/api/domains/search/' + $this.val() + '/' + ( tlds * i ) + '/callback=?',
										success: function( data )
												{
													done += tlds;
										
													for( i in data )
													{
														$('.domains ul li#' + String(i).replace('.', '') ).addClass(data[i]);
													}
													
													if( done == amount )
													{
														$('.domains ul div.overlay').animate({opacity: 0}, function( ){ $(this).css({zIndex: -1} )});
													}
												}
										} );
									
									i++;
								}
							} else {
								$('.domains ul div.overlay').animate({opacity: 0}, function( ){ $(this).css({zIndex: -1} )});
							}
						} else {
							$('form.order').html('');
							$('.domains ul li').removeClass('taken').removeClass('available').removeClass('order');
							$('div.tooltip').hide();
							$('.domains ul li').removeAttr('data-years');
							$('.domains ul div.overlay').animate({opacity: 0}, function( ){ $(this).css({zIndex: -1} )});
						}
					}, 300 );
				}
			} );
			
			$(document).bind( 'click', function(){
				if( $('div.tooltip').is(':visible') && $('div.tooltip').data('over') === false && $('ul li#' + $('div.tooltip').attr('data-tld') ).data('over') === false )
				{
					$('div.tooltip').hide().data('over', false);
				}
			} );
			
			$(window).resize( function(){
				$('div.tooltip').hide().data('over', false);
			} )
			
			$('div.tooltip ul li')
			.live( 'click', function(){
				$(this).parent().find('.active').removeClass('active');
				$(this).addClass('active');
				
				$('ul li#' + $(this).parent().parent().attr('data-tld')).removeClass('available').addClass('order').attr('data-years', $(this).attr('data-years'));
				
				$('input.period.' + $(this).parent().parent().attr('data-tld')).val( $(this).attr('data-years') );
				priceUpdate();
			} );
			
			$('ul li').disableTextSelect();
			
			$('ul li.available, ul li.order')
			.data('over', false)
			.live( 'mouseover', function(){
				$(this).data('over', true);
			} )
			.live( 'mouseout', function(){
				$(this).data('over', false);
			} )
			.live( 'click', function(){
				var
				tooltip = $('div.tooltip'),
				width = tooltip.width();
				width += parseInt( tooltip.css('paddingLeft'), 10 ),
				width += parseInt( tooltip.css('paddingRight'), 10 );
				
				if( orderNotification == false )
				{
					$.jGrowl('To change the length of the domain registration, click on the relevant amount of years you wish to purchase it for in the popup', {sticky: true, header:'Important!'});
					$.jGrowl('To undo your order, just right click the ordered domain (in blue)', {sticky: true, header:'Important!'});
					orderNotification = true;
				}
				
				$(this).removeClass('available').addClass('order');
				
				if( $('div.priceContainer').is(':visible') === false )
				{
					$('div.priceContainer').slideDown();
					setTimeout( function(){ $('div.price.box').fadeIn() }, 500 );
				}
				
				if( $('div.tooltip').attr('data-tld') == $(this).attr('id') && $('div.tooltip').is(':visible') )
				{
					$('div.tooltip').hide();
				} else {
					if( rules[ $(this).attr('id') ] )
					{
						$('div.tooltip ul li').removeClass('active').parent().find('li[data-years=1], li[data-years=3]').hide();
						$('div.tooltip li[data-years=2]').addClass('active');
						$('div.tooltip li[data-years=2] span').html( Number( prices[ $(this).attr('id') ] ).toFixed(2) ).parent().attr('data-price', Number( prices[ $(this).attr('id') ], 2 ).toFixed(2) );
						$(this).attr('data-years', '2');
					} else {
						$('div.tooltip li[data-years=1] span').html( Number( prices[ $(this).attr('id') ], 2 ).toFixed(2) ).parent().attr('data-price', Number( prices[ $(this).attr('id') ], 2 ).toFixed(2) );
						$('div.tooltip li[data-years=2] span').html( Number( prices[ $(this).attr('id') ] * 2 ).toFixed(2) ).parent().attr('data-price', Number( prices[ $(this).attr('id') ] * 2, 2 ).toFixed(2) );
						$('div.tooltip li[data-years=3] span').html( Number( prices[ $(this).attr('id') ] * 3 ).toFixed(2) ).parent().attr('data-price', Number( prices[ $(this).attr('id') ] * 3, 2 ).toFixed(2) );
						
						$('div.tooltip ul').parent().find('li[data-years=1], li[data-years=3]').show();
						if( $(this).attr('data-years') )
						{
							$('div.tooltip ul li').removeClass('active').parent().find('li[data-years=' + $(this).attr('data-years') + ']').addClass('active');
						} else {
							$(this).attr('data-years', '1');
							$('div.tooltip ul li').removeClass('active').parent().find('li[data-years=1]').addClass('active');
						}
					}
					
					var add = true;
					for( i in tlds )
					{
						add = ( tlds[i] == $(this).attr('id') ) ? false : add;
					}
					if( add )
						tlds.push( $(this).attr('id') );
					
					if( width + $(this).offset().left > screen.width )
					{
						$('div.tooltip').attr('data-tld', $(this).attr('id')).addClass('flipped').css( { left: $(this).offset().left - $('div.tooltip').width() + 2, top: $(this).offset().top - 100 } ).show();
					} else {
						$('div.tooltip').attr('data-tld', $(this).attr('id')).removeClass('flipped').css( { left: $(this).offset().left, top: $(this).offset().top - 100 } ).show();
					}
				}
				
				if( $('input.' + $(this).attr('id') ).size() == 0 )
				{
					$('form.order').append('<input type="hidden" name="domains[]" value="' + $('form.domains input').val() + '.' + codes[ $(this).attr('id') ] + '" class="' + $(this).attr('id') + '" />');
					$('form.order').append('<input type="hidden" name="domainsregperiod[' + $('form.domains input').val() + '.' + codes[ $(this).attr('id') ] + ']" value="' + ( rules[ $(this).attr('id') ] ? 2 : 1 ) + '" class="' + $(this).attr('id') + ' period" />');
				}
				
				priceUpdate();
			} );
			
			var priceUpdate = function( ){
				price = 0;
				for( i in tlds )
				{
					if( rules[ tlds[i] ] )
						price += prices[ tlds[i] ];
					else
						price += ( prices[ tlds[i] ] * $('ul li#' + tlds[i]).attr('data-years') );
				}
				if( price == 0 )
				{
					$('div.price.box').fadeOut();
					setTimeout( function(){
						$('div.priceContainer').slideUp();
					}, 500 );
				} else {
					$('span.price span').html( price.toFixed(2) );
				}
			}
			
			$('ul li.order')
			.live( 'contextmenu', function(e){
				if( e.button == 2 )
				{ 
					$(this).removeClass('order').addClass('available').removeAttr('data-years');
					$('div.tooltip').hide();
					
					for( i in tlds )
					{ 
						if( tlds[i] == $(this).attr('id') )
							tlds.splice(i, 1); 
					}
					
					$('input.' + $(this).attr('id')).remove();
					
					priceUpdate();
					
					return false;
				}
				return true;
			} );
			
			$('div.box.price a.button-red').click( function(e){
				$('form.order').submit();
				e.preventDefault();
				return false;
			});
			
			$('div.tooltip')
			.data('over', false)
			.live( 'mouseover', function(){
				$(this).data('over', true);
			} )
			.live( 'mouseout', function(){
				$(this).data('over', false);
			} );
		},
		virtualServers = function( extra )
		{
			var
			plans = {
				uk: {
					1: {
						custom: false,
						info: {
							name: '1',
							description: 'Small scale projects',
							product: 165
						},
						specs: {
							memory: 128,
							disk: 5,
							bandwidth: [ 200, 'gb' ],
							ip: 1
						},
						price: 4.49
					},
					2: {
						custom: false,
						info: {
							name: '2',
							description: 'For the average user',
							product: 166
						},
						specs: {
							memory: 256,
							disk: 15,
							bandwidth: [ 500, 'gb' ],
							ip: 1
						},
						price: 8.99
					},
					3: {
						custom: false,
						info: {
							name: '3',
							description: 'Hosting multiple websites',
							product: 167
						},
						specs: {
							memory: 512,
							disk: 25,
							bandwidth: [ 1, 'tb' ],
							ip: 1
						},
						price: 12.99
					},
					4: {
						custom: false,
						info: {
							name: '4',
							description: 'High performance needs',
							product: 168
						},
						specs: {
							memory: 1024,
							disk: 60,
							bandwidth: [ 2, 'tb' ],
							ip: 1
						},
						price: 21.99
					},
					5: {
						custom: false,
						info: {
							name: 'Turbo',
							description: 'Endless possibilities',
							product: 169
						},
						specs: {
							memory: 2048,
							disk: 120,
							bandwidth: [ 4, 'tb' ],
							ip: 1
						},
						price: 41.99
					},
					6: {
						custom: true,
						info: {
							name: 'Custom',
							description: 'Custom package'
						}
					}
				},
				us: {
					1: {
						custom: false,
						info: {
							name: '1',
							description: 'Small scale projects',
							product: 165
						},
						specs: {
							memory: 128,
							disk: 5,
							bandwidth: [ 600, 'gb' ],
							ip: 2
						},
						price: 6.49
					},
					2: {
						custom: false,
						info: {
							name: '2',
							description: 'For the average user',
							product: 166
						},
						specs: {
							memory: 256,
							disk: 15,
							bandwidth: [ 1.5, 'tb' ],
							ip: 2
						},
						price: 9.99
					},
					3: {
						custom: false,
						info: {
							name: '3',
							description: 'Hosting multiple websites',
							product: 167
						},
						specs: {
							memory: 512,
							disk: 25,
							bandwidth: [ 3, 'tb' ],
							ip: 2
						},
						price: 14.99
					},
					4: {
						custom: false,
						info: {
							name: '4',
							description: 'High performance needs',
							product: 168
						},
						specs: {
							memory: 1024,
							disk: 60,
							bandwidth: [ 6, 'tb' ],
							ip: 4
						},
						price: 28.99
					},
					5: {
						custom: false,
						info: {
							name: 'Elite',
							description: 'Endless possibilities',
							product: 169
						},
						specs: {
							memory: 2048,
							disk: 120,
							bandwidth: [ 12, 'tb' ],
							ip: 4
						},
						price: 52.99
					},
					6: {
						custom: true,
						info: {
							name: 'Custom',
							description: 'Custom package'
						}
					}
				}
			},
			nameChange,
			currentPID,
			country = 'uk',
			handleSlide = function( e, u )
			{
				var
				currentPlan = plans[ country ][ u.value ];
				
				$('div.vps ul li.active').removeClass('active');
				$('div.vps ul li#slider-' + u.value ).addClass('active');
				
				$('div.vpsMain div.specs div.header span').html( currentPlan.info.description );
				
				if( currentPlan.info.name.length > 1 )
					$('div.vpsMain div.specs div.header span').stop().animate({left: '120px'}, 500);
				else
					$('div.vpsMain div.specs div.header span').stop().animate({left: '80px'}, 500);
				
				clearTimeout( nameChange );
				nameChange = setTimeout( function(){
					$('div.vpsMain div.specs div.header h4 sup').html( currentPlan.info.name );
				}, ( ( currentPlan.info.name.length > 1 ) ? 250 : 0 ) );
				
				if( currentPlan.custom === false )
				{
					$('div.vpsMain div.specs div.header h5').html( '&pound;' + currentPlan.price );
					
					$('div.vpsMain div.specs ul li.memory strong').html( currentPlan.specs.memory + 'mb guaranteed' );
					$('div.vpsMain div.specs ul li.disk strong').html( currentPlan.specs.disk + 'gb' );
					$('div.vpsMain div.specs ul li.bandwidth strong').html( currentPlan.specs.bandwidth[0] + currentPlan.specs.bandwidth[1] );
					$('div.vpsMain div.specs ul li.ip strong').html( currentPlan.specs.ip );
					
					$('div.vpsMain a.order').html('Order Now <small></small>');
					
					$('div.vpsMain form').attr('action', 'https://www.simplexwebs.com/cart.php');
					$('div.vpsMain form input.input-one').attr('name', 'a').val('add');
					$('div.vpsMain form input.input-two').attr('name', 'pid').val( currentPlan.info.product );
					
					currentPID = currentPlan.info.product;
				} else {
					$('div.vpsMain div.specs div.header h5').html( '?' );					
					$('div.vpsMain div.specs ul:not(.labels) li:not(.no-change) strong').html('?');
					
					$('div.vpsMain a.order').html('Let&#039;s Chat <small></small>');

					$('div.vpsMain form').attr('action', 'https://www.simplexwebs.com/support');
					$('div.vpsMain form input.input-one').attr('name', 'step').val('2');
					$('div.vpsMain form input.input-two').attr('name', 'deptid').val('15');
					
					currentPID = false;
				}
			},
			init = function( p, e )
			{
				for( i in e.prices )
					for( c in e.prices[i] )
						plans[i][c].price = e.prices[i][c];
				
				$('div.vps div.slider')
				.slider( {
					value: p,
					min: 1,
					max: 6,
					range: 'min',
					slide: handleSlide
				} );
				
				$('div.vps ul li')
				.bind( 'click', function( ){
					handleSlide( false, { value: String( $(this).attr('id') ).replace('slider-', '') } );
					
					$('div.vps div.slider').slider( 'value', String( $(this).attr('id') ).replace('slider-', '') );
				} );
				
				$('div.vpsMain a.order').click( function(){ $('div.vpsMain form').submit(); return false; } );
				
				handleSlide( false, { value: p } );
			},
			accordian = function( )
			{
				$('div.vpsMain div.info ul li span').click ( function(){
					var $this = $(this);
					
					if( $this.hasClass('active') === false )
					{
						$('div.vpsMain div.info ul li div').slideUp().parent().find('span').removeClass('active');
						$this.addClass('active').parent().find('div').slideDown();
					} else {
						$this.parent().find('div').slideUp();
						$this.removeClass('active');
					}
				} );
			},
			toggleCountry = function( )
			{
				$('ul.countryPicker li.country')
				.bind( 'click', function(){
					$('ul.countryPicker li.country.active').removeClass('active');
					$(this).addClass('active');
					
					country = $(this).attr('id');
					
					handleSlide( false, { value: String( $('div.vps ul li.active').attr('id') ).replace('slider-', '') } );
					
					$('div.vps ul li#slider-5').html( plans[ country ][5].info.name );
					if( country == 'us' ) {
						$('div.vps ul li#slider-5').css({left: '480px'});
						
						$('div.notice').show();
					} else {
						$('div.vps ul li#slider-5').css({left: '476px'});
						
						$('div.notice').hide();
					}
				} );
			};
			
			
			
			return init(2, extra), accordian(), toggleCountry();
		}
		init = function( page, extra )
		{
			switch( page )
			{
				case 'hosting':
					return hosting();
					break;
				case 'vps':
					return virtualServers( extra );
					break;
				case 'shoutcast':
					return shoutcast();
					break;
				case 'home':
					return home();
					break;
				case 'domains':
					return domains( extra );
					break;
				case 'login':
					return login();
					break;
				case 'register':
					return register();
					break;
				case 'status':
					return status();
					break;
				case 'tickets':
					return tickets();
					break;
				case 'order':
					return order( extra );
					break;
				case 'passwordStrength':
					return pwStrength();
					break;
				case 'phone':
					return phone();
					break;
			}
		};
		
		if( $("div:contains(Logged in as Administrator):last").size() > 0 )
		{
			$('section.banner article div').css({top: '45%'}).prepend( '<a href="' + $("div:contains(Logged in as Administrator):last a").attr('href') + '">Return to admin area &raquo;</a>' );
			$("div:contains(Logged in as Administrator):last").remove();
		}
		
		return init( page, extra );
	};
} )(jQuery);

/*
 * fbtime
 * http://ryanclark.me/labs/fbtime
 * 
 * tinyForm
 * 
 * customList
 * 
 * (c) 2011 Ryan Clark
 */
(function(a){var b={callbacks:{},types:{},selector:":not([type=submit])",bind:{start:"focus",end:"blur"},replace:""};a.fn.tinyForm=function(c){if(c){a.extend(b,c)}var d=a(this);for(i in b.types){d.find(i).each(function(){a(this).data("change",b.types[i])})}for(i in b.callbacks){d.find(i).each(function(){if(b.callbacks[i].start){a(this).data("callback-start",b.callbacks[i].start)}if(b.callbacks[i].end){a(this).data("callback-end",b.callbacks[i].end)}})}d.find(b.selector).each(function(){var e=a(this);e.data("value",e.val()).data("type",e.attr("type"));if(b.bind.start){e.bind(b.bind.start,function(){if(e.val()==e.data("value")){e.val(b.replace);if(e.data("change")){e[0].type=e.data("change")}if(e.data("callback-start")){e.data("callback-start")(e)}}})}if(b.bind.end){e.bind(b.bind.end,function(){if(e.val()==b.replace){e.val(e.data("value"));if(e.data("change")){e[0].type=e.data("type")}if(e.data("callback-end")){e.data("callback-end")(e)}}})}})}})(jQuery);
(function(e){e.fn.fbtime=function(f){this.each(function(){var g=e(this);f=f?((String(f).length<=10)?f*1000:f):"";if(g.parent().hasClass("stopUpdateTime")===false){e.update(g,f);setInterval(function(){e.update(g,f)},60000)}})};var c={0:"less than a minute ago",1:"1 minute ago",59:"%m minutes ago",118:"an hour ago",1439:"%H hours ago",2879:"Yesterday at %h:%i",14567:"%l at %h:%i"},a="%d %f%y at %h:%i",d=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],b=["January","February","March","April","May","June","July","August","September","October","November","December"];e.update=function(p,q){if(p.attr("data-date")!="undefined"){var h=(String(p.attr("data-date")).length<=10)?new Date(p.attr("data-date")*1000):new Date(p.attr("data-date"));var l=(String(p.attr("data-date")).length<=10)?p.attr("data-date")*1000:p.attr("data-date");var j=(q=="")?new Date():new Date(q);var n=Math.round(Math.abs(Number(j)-Number(l))/60000);var m="";for(i in c){if(m==""&&n<=i){var o=Math.round(n/60),t=((h.getHours()<10)?"0":"")+h.getHours(),s=((h.getMinutes()<10)?"0":"")+h.getMinutes(),r=d[h.getDay()];m=c[i].replace(/%m/,n).replace(/%H/,o).replace(/%h/,t).replace(/%i/,s).replace(/%l/,r)}}if(m==""){var g=((h.getDate()<10)?"0":"")+h.getDate(),f=b[h.getMonth()],k=(j.getFullYear()==h.getFullYear())?"":" "+h.getFullYear(),t=((h.getHours()<10)?"0":"")+h.getHours(),s=((h.getMinutes()<10)?"0":"")+h.getMinutes();p.html(a.replace(/%d/i,g).replace(/%f/i,f).replace(/%y/i,k).replace(/%h/i,t).replace(/%i/i,s))}else{p.html(m)}}}})(jQuery);

( function( $ ) {
	$.fn.customList = function( a )
	{
		var callbacks = {};
		
		$.extend( callbacks, a );
		
		this.each( function(){
			var $this = $(this),
				$display = $this.find('li.display');
			
			$this.disableTextSelect();
			
			$this.addClass('customList');
			
			$display.live( 'click', function(){
				var $parent = $(this).parent().parent();
				if( $parent.hasClass('hide') )
				{
					var height = $(window).height() - $(this).offset().top - 20; if( height < 100 ) height = 100;
					
					$parent.addClass('active').removeClass('hide').css( { height: height } );
					callbacks.open( $parent );
				} else {
					$parent.addClass('hide').removeClass('active');
					
					callbacks.hide( $parent );
				}
			} );
			
			$(this)
			.data('over', false)
			.live( 'mouseover', function(){
				$(this).data('over', true);
			} )
			.live( 'mouseout', function(){
				$(this).data('over', false);
			} )
			.find( 'li:not(.display)' )
			.live( 'click', function(){
				var $this = $(this);
				
				$this
				.parent().find('li.display')
				.after( '<li id="' + $this.parent().find('li.display').attr('id') + '">' + $this.parent().find('li.display').html() + '</li>' )
				.attr('id', $this.attr('id') )
				.html( $this.html() );
				
				$('input#field-' + $this.parent().parent().attr('id') ).val( $this.attr('id') );
				
				$this.parent().parent().addClass('hide');
				
				callbacks.hide( $this.parent().parent() );
				
				$this.remove();
			} );
		} );
		
		$(window).resize( function(){ $('ul.customList active').each( function(){ var height = $(window).height() - $(this).offset().top - 20; if( height < 100 ) height = 100; $(this).css( { height: height } ); } ); } );
	}
} )(jQuery);

/*
 * http://stackoverflow.com/questions/2132172/disable-text-highlighting-on-double-click-in-jquery
 */
$(function(){
    $.extend($.fn.disableTextSelect = function() {
        return this.each(function(){
            if($.browser.mozilla){//Firefox
                $(this).css('MozUserSelect','none');
            }else if($.browser.msie){//IE
                $(this).bind('selectstart',function(){return false;});
            }else{//Opera, etc.
                $(this).mousedown(function(){return false;});
            }
        });
    });
});

/*
 * jGrowl
 */

(function(a){a.jGrowl=function(b,c){if(a("#jGrowl").size()==0){a('<div id="jGrowl"></div>').addClass((c&&c.position)?c.position:a.jGrowl.defaults.position).appendTo("body")}a("#jGrowl").jGrowl(b,c)};a.fn.jGrowl=function(b,d){if(a.isFunction(this.each)){var c=arguments;return this.each(function(){var e=this;if(a(this).data("jGrowl.instance")==undefined){a(this).data("jGrowl.instance",a.extend(new a.fn.jGrowl(),{notifications:[],element:null,interval:null}));a(this).data("jGrowl.instance").startup(this)}if(a.isFunction(a(this).data("jGrowl.instance")[b])){a(this).data("jGrowl.instance")[b].apply(a(this).data("jGrowl.instance"),a.makeArray(c).slice(1))}else{a(this).data("jGrowl.instance").create(b,d)}})}};a.extend(a.fn.jGrowl.prototype,{defaults:{pool:0,header:"",group:"",sticky:false,position:"top-right",glue:"after",theme:"default",themeState:"highlight",corners:"10px",check:250,life:3000,closeDuration:"normal",openDuration:"normal",easing:"swing",closer:true,closeTemplate:"&times;",closerTemplate:"<div>[ close all ]</div>",log:function(c,b,d){},beforeOpen:function(c,b,d){},afterOpen:function(c,b,d){},open:function(c,b,d){},beforeClose:function(c,b,d){},close:function(c,b,d){},animateOpen:{opacity:"show"},animateClose:{opacity:"hide"}},notifications:[],element:null,interval:null,create:function(b,c){var c=a.extend({},this.defaults,c);if(typeof c.speed!=="undefined"){c.openDuration=c.speed;c.closeDuration=c.speed}this.notifications.push({message:b,options:c});c.log.apply(this.element,[this.element,b,c])},render:function(d){var b=this;var c=d.message;var e=d.options;var d=a('<div class="jGrowl-notification '+e.themeState+" ui-corner-all"+((e.group!=undefined&&e.group!="")?" "+e.group:"")+'"><div class="jGrowl-close">'+e.closeTemplate+'</div><div class="jGrowl-header">'+e.header+'</div><div class="jGrowl-message">'+c+"</div></div>").data("jGrowl",e).addClass(e.theme).children("div.jGrowl-close").bind("click.jGrowl",function(){a(this).parent().trigger("jGrowl.close")}).parent();a(d).bind("mouseover.jGrowl",function(){a("div.jGrowl-notification",b.element).data("jGrowl.pause",true)}).bind("mouseout.jGrowl",function(){a("div.jGrowl-notification",b.element).data("jGrowl.pause",false)}).bind("jGrowl.beforeOpen",function(){if(e.beforeOpen.apply(d,[d,c,e,b.element])!=false){a(this).trigger("jGrowl.open")}}).bind("jGrowl.open",function(){if(e.open.apply(d,[d,c,e,b.element])!=false){if(e.glue=="after"){a("div.jGrowl-notification:last",b.element).after(d)}else{a("div.jGrowl-notification:first",b.element).before(d)}a(this).animate(e.animateOpen,e.openDuration,e.easing,function(){if(a.browser.msie&&(parseInt(a(this).css("opacity"),10)===1||parseInt(a(this).css("opacity"),10)===0)){this.style.removeAttribute("filter")}a(this).data("jGrowl").created=new Date();a(this).trigger("jGrowl.afterOpen")})}}).bind("jGrowl.afterOpen",function(){e.afterOpen.apply(d,[d,c,e,b.element])}).bind("jGrowl.beforeClose",function(){if(e.beforeClose.apply(d,[d,c,e,b.element])!=false){a(this).trigger("jGrowl.close")}}).bind("jGrowl.close",function(){a(this).data("jGrowl.pause",true);a(this).animate(e.animateClose,e.closeDuration,e.easing,function(){a(this).remove();var f=e.close.apply(d,[d,c,e,b.element]);if(a.isFunction(f)){f.apply(d,[d,c,e,b.element])}})}).trigger("jGrowl.beforeOpen");if(e.corners!=""&&a.fn.corner!=undefined){a(d).corner(e.corners)}if(a("div.jGrowl-notification:parent",b.element).size()>1&&a("div.jGrowl-closer",b.element).size()==0&&this.defaults.closer!=false){a(this.defaults.closerTemplate).addClass("jGrowl-closer ui-state-highlight ui-corner-all").addClass(this.defaults.theme).appendTo(b.element).animate(this.defaults.animateOpen,this.defaults.speed,this.defaults.easing).bind("click.jGrowl",function(){a(this).siblings().trigger("jGrowl.beforeClose");if(a.isFunction(b.defaults.closer)){b.defaults.closer.apply(a(this).parent()[0],[a(this).parent()[0]])}})}},update:function(){a(this.element).find("div.jGrowl-notification:parent").each(function(){if(a(this).data("jGrowl")!=undefined&&a(this).data("jGrowl").created!=undefined&&(a(this).data("jGrowl").created.getTime()+parseInt(a(this).data("jGrowl").life))<(new Date()).getTime()&&a(this).data("jGrowl").sticky!=true&&(a(this).data("jGrowl.pause")==undefined||a(this).data("jGrowl.pause")!=true)){a(this).trigger("jGrowl.beforeClose")}});if(this.notifications.length>0&&(this.defaults.pool==0||a(this.element).find("div.jGrowl-notification:parent").size()<this.defaults.pool)){this.render(this.notifications.shift())}if(a(this.element).find("div.jGrowl-notification:parent").size()<2){a(this.element).find("div.jGrowl-closer").animate(this.defaults.animateClose,this.defaults.speed,this.defaults.easing,function(){a(this).remove()})}},startup:function(b){this.element=a(b).addClass("jGrowl").append('<div class="jGrowl-notification"></div>');this.interval=setInterval(function(){a(b).data("jGrowl.instance").update()},parseInt(this.defaults.check));if(a.browser.msie&&parseInt(a.browser.version)<7&&!window.XMLHttpRequest){a(this.element).addClass("ie6")}},shutdown:function(){a(this.element).removeClass("jGrowl").find("div.jGrowl-notification").remove();clearInterval(this.interval)},close:function(){a(this.element).find("div.jGrowl-notification").each(function(){a(this).trigger("jGrowl.beforeClose")})}});a.jGrowl.defaults=a.fn.jGrowl.prototype.defaults})(jQuery);

