var x = 0;
	
$(document).ready(function() {

	
	
	$('.register a.sel').click(function(){
		$(this).next().toggle();
	});
	$('.register ul li a').click(function(){
		$('input.domain').val($(this).html());
		$('.register ul').toggle();
	});
	
	    $(".plan h3").each(function () {
          var el = $(this),
                text = el.html(),
                first = text.slice(0, 1),
                rest = text.slice(1);
          el.html("<span class='firstletter'>" + first + "</span>" + rest);
    });
	// CONTACT FLOATING
	jQuery.fn.center = function () {
    this.css("top", (($(window).height() - this.outerHeight()) / 2) + $(window).scrollTop() + 60 + "px");
    return this;
	}
	$('#scontact').center();
	
	$('.sform > div > form p:last').append('<a href="#" class="scontact-close">Close</a>')
	$('a.scontact-close').click(function(){
			$('#scontact').animate({right: '-380',})	
	});	
	$('a.scontact-but').toggle(
		function(){
		   $(this).parent().animate({right: '0',})
		},
		function(){
		   $(this).parent().animate({right: '-380',})
		});	

	$('.contacth input[type="submit"] ').click(function(){
		var timerId = 0;
		timerId = setInterval(function(){
			$('.contacth span.wpcf7-not-valid-tip').prev().addClass('error');	
		}, 1000);
		$('.contacth input').click(function(){	
			$(this).removeClass('error');
			clearInterval(timerId);
		});
	});	    
	
	$(window).resize(function() {
		hideSize();
		$('#scontact').center();
	});
	
	$('#scontact form.wpcf7-form').submit(function(){
		nl_form = 0;
		nl_email = nl_name = "";
		if($('#scontact form.wpcf7-form input[type=checkbox]').is(':checked')){
			nl_form = 2;
			nl_email = $('#scontact form.wpcf7-form input[name=your-email]').val();
			nl_name = $('#scontact form.wpcf7-form input[name=your-name]').val();
		}
		$.ajax({
			url: 'http://www.magikhosting.com.au/ajax-callback/',
			type: 'POST',
			cache: false,
			dataType: 'html',
			data: 'nl_email='+nl_email+'&nl_name='+nl_name+'&nl_form='+nl_form,
			success: function(responseText){
				//console.log(responseText);
			}
		});
	});

});

function hideSize() {
	if($(window).width() <= 1160){
		$('#scontact').hide();
	}else{
		$('#scontact').show();
	}
}
