$(function(){
	$("#jquery-test").html("jQuery is loaded");
});

function showShade()
{
	var shade = jQuery('<div id="screen"><!-- screen --></div>');
	jQuery(shade).insertAfter('#wrapper');
	jQuery('body').click(hideShade());
	
	try {
		window.scrollBy(0,0); 
		window.scroll(0,0);
		document.body.scrollTop = 0;
		jQuery('#screen').height( $(document).height() );
	} catch(err) { }
}

function hideShade()
{
	jQuery('#screen').remove();
}


$(document).ready(function() {

	jQuery('#smsTxt').keyup(function(event) {
		jQuery('#smsTxtLeft b').html(140-this.value.length);
		if ( event.which<32 || event.which>126) {
			event.preventDefault();
		}
		else
		{
			if(this.value.length>=140) this.value=this.value.substring(0, 140);
		}
		jQuery('#smsTxtLeft b').html(140-this.value.length);
		
		var re = /\w/gi;
		//if(this.value.match(re))
		{
			var s = this.value;
			var re = /(\w)|([!])|(\s)|([?])|([.])/gi;
			var newstr = s.replace(re,'');
			for(x in newstr) this.value = this.value.replace(newstr[x],'');
		}
	});
	
	jQuery('.message')
		.click(function(){ jQuery(this).fadeOut(600).remove();});
	
	setTimeout(function(){
		jQuery('.message').fadeOut(600).remove();
	},4000);

			$("a.example2").fancybox({
				'overlayShow'	: true,
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.7,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic',
				'titlePosition'	: 'inside',
				'width'				: '70%',
				'height'			: '70%'
			});
			
			$(".various3").fancybox({
				'width'				: '30%',
				'height'			: '15%',
				'autoScale'			: false,
				'transitionIn'		: 'FadeIn',
				'transitionOut'		: 'FadeOut',
				'type'				: 'iframe',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.7
			});
			
			$(".various5").fancybox({
				'width'				: '40%',
				'height'			: '25%',
				'autoScale'			: false,
				'transitionIn'		: 'FadeIn',
				'transitionOut'		: 'FadeOut',
				'type'				: 'iframe',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.7
			});
			
			$(".various4").fancybox({
				'width'				: '50%',
				'height'			: '20%',
				'autoScale'			: false,
				'transitionIn'		: 'FadeIn',
				'transitionOut'		: 'FadeOut',
				'type'				: 'iframe'
			});
			
			$(".various2").fancybox({
				'autoScale'			: true,
				'transitionIn'		: 'FadeIn',
				'transitionOut'		: 'FadeOut',
				'type'				: 'iframe'
			});
			
			$(".various6").fancybox({
				'autoScale'			: true,
				'transitionIn'		: 'FadeIn',
				'transitionOut'		: 'FadeOut',
				'type'				: 'iframe'
			});
			
			$(".various21").fancybox({
				'width'				: '30%',
				'height'			: '20%',
				'autoScale'			: false,
				'transitionIn'		: 'FadeIn',
				'transitionOut'		: 'FadeOut',
				'type'				: 'iframe'
			});
			
			$("a[rel=example_group], a[rel=example_group2], a[rel=example_group3]").fancybox({
				'width'				: '80%',
				'height'			: '80%',
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.7
			});
			
		});

