	
	jQuery(document).ready(function(){

		
	});

 function doClear(theText) {

     if (theText.value == theText.defaultValue) {

         theText.value = ""

     }

 }

function target_popup(form) {
    window.open('', 'formpopup', 'width=340,height=120,resizeable,scrollbars');
    form.target = 'formpopup';
}

	jQuery(document).ready(function(){		
		var window_size = jQuery(window).height();
		var inner_container_pos = window_size * .15;
		
		jQuery("#hello_container").css('top', '-'+window_size+'px');
		jQuery("#hello_inner_container_wrap").css('top', inner_container_pos);
	
	
		jQuery("#menu-item-232").click(function(e){
			e.preventDefault();
			
			jQuery("#hello_container").show();
			
			// get background container size
			added_size = inner_container_pos + jQuery("#hello_inner_container").height();
			if(added_size > window_size){
				hello_container_size = added_size;
			}else{
				hello_container_size = window_size;
			}
			
			
			jQuery("#hello_container").css('height', hello_container_size);
			// background container height set
			
			
			
			jQuery("#hello_container").animate(

				{

					top: '0'

				}, 500, function(){

					jQuery("#main_container").hide();
				}

			)

		});

		

		jQuery("#hello_container").click(function(e){
			if(e.target.id == "hello_inner_container_wrap" || e.target.id == "bg-img"){
				jQuery("#main_container").show();
				
				jQuery(this).animate(

					{

						top: '-'+hello_container_size

					}, 500, function(){
						jQuery(this).hide();
					}

				)
			}
		});
		
		jQuery("#contact-submit").click(function(e){
			e.preventDefault();
			
			var data = jQuery("#contact-form").serialize();
			
			if(jQuery("#contact-name").val() == ""){
				alert("Name is a required field.");
				jQuery("#contact-name").focus();
			}else if(jQuery("#contact-email").val() == ""){
				alert("Email is a required field.");
				jQuery("#contact-email").focus();
			}else if(jQuery("#contact-message").val() == ""){
				alert("Message is a required field.");
				jQuery("#contact-message").focus();
			}else{
				jQuery.post("/email.php", data, function(data2){
					
					if(data2 != ""){
						alert(data2);
						jQuery("#main_container").show();

						jQuery("#hello_container").animate(

							{

								top: '-'+hello_container_size

							}, 500, function(){
								jQuery(this).hide();
							}

						)
					}else{
						alert("There has been an error.");
					}
				});
				
			}
		});
		
		jQuery("#send-message").click(function(e){
			e.preventDefault();
			
			var data = jQuery("#wholesale-contact-form").serialize();
			
			if(jQuery("#wholesale-name").val() == ""){
				alert("Name is a required field.");
				jQuery("#wholesale-name").focus();
			}else if(jQuery("#wholesale-email").val() == ""){
				alert("Email is a required field.");
				jQuery("#wholesale-email").focus();
			}else if(jQuery("#wholesale-message").val() == ""){
				alert("Message is a required field.");
				jQuery("#wholesale-message").focus();
			}else{
				jQuery.post("/email.php", data, function(data2){
					if(data2 != ""){
						alert(data2);
					}else{
						alert("There has been an error.");
					}
				});
				
			}
		});
		
		jQuery("#mailing-list-form-1").submit(function(e){
			e.preventDefault();
			var data = jQuery(this).serialize();
			
			jQuery.post('http://www.gypsywears.com/index.php', data, function(res){
				if(res == "<strong class='mc_success_msg'>Success, you&#039;ve been signed up! Please look for our confirmation email!</strong>"){
					alert('Thank you for signing up.');
				}else{
					alert('Please enter in a valid email address.');
				}
			});
		});
		
		jQuery("#mailing-list-form-2").submit(function(e){
			e.preventDefault();
			var data = jQuery(this).serialize();
			jQuery.post('http://www.gypsywears.com/index.php', data, function(res){
				if(res == "<strong class='mc_success_msg'>Success, you&#039;ve been signed up! Please look for our confirmation email!</strong>"){
					alert('Thank you for signing up.');
				}else{
					alert('Please enter in a valid email address.');
				}
			});
		});
		
		jQuery(".prod_image_wrapper").hover(
			function(){
				jQuery(this).find(".prod_grey").hide();
			},
			function(){
				jQuery(this).find(".prod_grey").show();
			}
		);
		
	});
