$(document).ready(function() {
	var ie6 = ($.browser.msie && $.browser.version.substr(0,1)<7);
	if (ie6) $('body').addClass('ie6');
	
	
	//cufon
	Cufon.replace('h2, h3, h4:not(#footer h4, h4.no-replace), #home-highlight p, .matrix-list th.label, a.find-out-more-button, .rtf form button');
	//h2:not(.layout-park #content h2),h3:not(.layout-park #content h3),
	//, .matrix-list#features_table .group-7 td:not(.matrix-list .group-7 td.label), .matrix-list#features_table .group-12 td:not(.matrix-list .group-12 td.label

	//update some columns	
	$('#services > ul > li').height($('#services').height()-40);
	$('#news > ul > li').height($('#news').height()-40);
	$('#site-map .grid_4').height($('#site-map').height());
	
	//Make the logos look sweet
	$('ul.logos li').each(function() {
		$(this).children('img:first').css('opacity', 0);
		$(this).css('background-image', 'url(' + $(this).children('img:first').attr('src') + ')');
	});

	$(document).pngFix();
	
	//Add the quotes to erm... the quotes
	$('.quote').each(function() {
		$(this).find('p:first').prepend('<span class="open">"</span>');
		$(this).find('p:last').append('<span class="close">"</span>');
	});

	// Events form validation
        $('#events-form').validate();
		$.validator.addMethod("phone", function(phone_number, element) {
		    phone_number = phone_number.replace(/\s+/g, ""); 
			return this.optional(element) || phone_number.length > 9 &&
				phone_number.match(/^\+(?:[0-9] ?){6,14}[0-9]$/);
		}, "Please specify a valid phone number");
	// Posicloud form validation
        $('#posicloud-form').validate({
		rules: {
			'cardnumber': {
				digits: true,
				minlength: 16,
				maxlength: 16
			},
			'securitycode': {
				digits: true,
				minlength: 3,
				maxlength: 3
			},
			'telephone': {
				phone: true
			}
		}
	});

	$('select#vmpackage').selectToUISlider({ 'labels': 10 }).hide();

});

