$(function(){

	
	$(".inviteesList").fancybox({
		'type'				: 'iframe',
		'titlePosition'		: 'inside',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'showCloseButton'   : false,
		'modal'				: false,
		'scrolling'			: 'no',
		'width'				: 430,
		'height'			: 500,
		'centerOnScroll'	: true,
		'overlayShow'		: true
	});
	
	$(".iframe-tc").fancybox({
		'type'				: 'iframe',
		'titlePosition'		: 'inside',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'showCloseButton'   : false,
		'modal'				: false,
		'scrolling'			: 'yes',
		'width'				: 1024,
		'height'			: 600,
		'centerOnScroll'	: true,
		'overlayShow'		: true
	});
	
	
	//in case there's no checkbox/radio to transform don't init the crir script.
	if($('.crirHiddenJS').length > 0){
		 crir.init();
	}
	
	// login modal window trick start
	$('.loginbox').click(function(){
		$('.zoom-small-image #wrap').css({zIndex:980});
		var html='<div id="login-overlay" style="display:none;"></div>';
		$('body').append(html);
		$('#login-overlay').css({
			'opacity':.7,
			'background':'rgb(119, 119, 119)',
			'width':$(document).width()+'px',
			'height':$(document).height()+'px',
			'position':'absolute',
			'z-index':990,
			'display':'block',
			'top':0,
			'left':0,
		});
	});
	
	$('#login-overlay').live('click',function(){
		$('#loginDiv').hide();
		$('#login-overlay').remove();
		$('.box_close').trigger('click');
	});
	// login modal window trick end.
	
});
function redirectTo(to){
	window.location.href=to;
	return false;
}
function SubmitSubscribe() {
		if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test($('#email_subscribe').val()))) {
			alert("Please enter a correct and valid email address.");
			$('#email_subscribe').focus();
			return false;
		}

		jQuery.post('./modules/ymlp/signup.php', {
			'sendContactEmail': 'true', 
			'email':   $('#email_subscribe').val(), 
			}, function(data) {
				$('#email_subscribe').val('');
				$('#subscribe_response').html(data);
			});
		return false;
}
