$(document).ready( function() { 
	
	function submitMail(val) {
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		
		if ( !reg.test(val) ) {
			alert('Invalid Email Address');
			return false;
		}
		return true;	
	}
	
	$('#subscribeForm, #form1').submit(function() {
	    if (submitMail($(this).find('input[type=text]').val())) {
			$(this).parents('form').submit();
			return true;
		}
	     
	    return false;
	})
	
	$('#lText').click(function() {
		$('#menu, #content-sub, #breadcrumb, #states, #findDr, #footer').each(function() {
			if (!$(this).attr('id').match(/-L/)) {
				$(this).attr('id', $(this).attr('id') + '-L');
			}
		})	
		$('.indexBox, .sideBox, .title, .five80').each(function() {			
			$(this).attr('class', this.className.replace(/(indexBox|sideBox|title|five80)/, "$1" + "-L"));	
		})	
		
		$.setCookie( 'lText', 'true', {
		    duration : 180, //days
		    path : '/'
		});	
		
	})
	
	$('#sText').click(function() {
		//Something strange in the neighbourhood. O_o
		$.setCookie( 'lText', 'false', {
		    duration : 0, //days
		    path : '/'
		});	
		$.delCookie('lText');
		//Call GhostBusters!
	
		$('#menu-L, #content-sub-L, #breadcrumb-L, #states-L, #findDr-L, #footer-L').each(function() {
			$(this).attr('id', $(this).attr('id').replace('-L', ''));
		})			
		
		$('.indexBox-L, .sideBox-L, .title-L, .five80-L').each(function() {
			$(this).attr('class', $(this).attr('class').replace('-L', ''));
		})	
	})
	
	if ($.readCookie( 'lText' ) == 'true') {
		$('#lText').click();
	}


})
	
	
