//// JavaScript Document
$(document).ready(
				  function () {


				      if ($.jqURL.get('suc') == 'true') {
				          $('body').css({ 'overflow-y': 'hidden' });
				          var holder = $('<div class="containeroverlay"></div>');
				          holder.appendTo('body');
				          var mainbox = $('<div class="backblanket"></div>');
				          mainbox.css({ 'height': '1100px' })
				          var centerbox = $('.confirmationbox').css({ 'dispaly': 'block' });
				          $('.alertimagebox').css('display', 'none');
				          $('.newsimagebox').css({ 'display': 'block' }).animate({ 'margin-left': '80px', 'margin-top': '30px' }, 1000);
				          //				        
				          var leftval = (($(window).width() / 2) - (336 / 2)) + 'px';
				          var topval = (($(window).height() / 2) - (290 / 2)) + 'px';
				          centerbox.css({ 'left': leftval, 'top': topval });
				          $('.alerttext').css({ 'display': 'block', 'margin-left': '20px', 'width': '300px' });
				          mainbox.animate({ 'opacity': 0.7 }, 2000);
				          mainbox.appendTo(holder);
				          centerbox.appendTo(holder);
				          $('.confirmationbox p').html(
							 '<span class="thanks1"> Thank you&nbsp;!&nbsp;</span><span class="thanks2">  for subscribing to our newsletter. You will now be kept updated with all our exciting new offers. </span>'
							 );
				          $('#ok_alert').css({ 'margin-left': '90px' });
				          centerbox.animate({ 'height': '+=390px' }, { duration: 2000, queue: false });

				      }
				      $('.subscribe').click(
						function (e) {

						    if ($('.name').val().length == 0 && $('.email').val().length == 0) {
						        showalert("Please Enter Name And Email");
						        return false;
						    }
						    else {
						        if ($('.name').val().length == 0) {
						            showalert("Please Enter Name");
						            return false;
						        }
						        else {

						            if ($('.email').val().length == 0) {
						                showalert("Please Enter Email");
						                return false;
						            }
						            else {
						                var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
						                if (reg.test($('.email').val()) == false) {
						                    showalert("Please Enter Valid Email");
						                    return false;
						                }
						                else {
						                    return true;
						                }
						            }
						        }
						    }

						}
									);
				      function showalert(message) {
				          var holder = $('<div class="containeroverlay"></div>');
				          holder.appendTo('body');
				          var mainbox = $('<div class="backblanket"></div>');
				          mainbox.css({ 'height': '1300px' })
				          var centerbox = $('.confirmationbox');
				          centerbox.removeClass('confirmationbox');
				          centerbox.addClass('confirmation_alert_box');

				          var leftval = (($(window).width() / 2) - (336 / 2)) + 'px';
				          var topval = $(document).scrollTop();
				          centerbox.css({ 'left': leftval, 'top': topval });
				          var confirmation_class = centerbox.attr('class');
				          $('.newsimagebox').css({ 'display': 'none' });
				          $('.alertimagebox').css('display', 'block');
				          $('.alerttext').css('display', 'block');

				          $('.alerttext p').html(message);
				          mainbox.animate({ 'opacity': 0.7 }, 2000);
				          mainbox.appendTo(holder);
				          centerbox.appendTo(holder);

				          centerbox.animate({ 'height': '+=390px' }, { duration: 2000, queue: false });
				          centerbox.animate({ 'padding-top': '+=50px', 'padding-left': '+=40px' }, 1000);
				      }
				      $('#ok_alert').click(
										  function () {
										      if ($.jqURL.get('suc') == 'true') {
										          $('.containeroverlay').hide();
										          $('.backblanket').hide();
										          var alert_confirmation_box_id = $('.confirmation_alert_box');
										          alert_confirmation_box_id.removeClass('confirmation_alert_box');
										          alert_confirmation_box_id.addClass('confirmationbox');
										          $('.confirmationbox').hide();
										          $('.confirmationbox').css({ 'padding-left': '0px', 'padding-top': '0px' });
										          $('body').css('overflow-y', 'auto');
										          var new_url = $.jqURL.strip({ keys: 'suc' });
										          window.location = new_url;
										      }
										      else {
										          if ($.jqURL.get('reg') == 'true') {

										              window.location = "../Home.aspx";
										          }
										          else {
										              $('.containeroverlay').hide();
										              $('.backblanket').hide();
										              var alert_confirmation_box_id = $('.confirmation_alert_box');
										              alert_confirmation_box_id.removeClass('confirmation_alert_box');
										              alert_confirmation_box_id.addClass('confirmationbox');
										              $('.confirmationbox').hide();
										              $('.confirmationbox').css({ 'padding-left': '0px', 'padding-top': '0px' });
										              $('body').css('overflow-y', 'auto');

										              window.location;
										          }
										      }

										  }

										  )
				  }

				  );
