  $(document).ready(function()
  {
		$("form").submit(function(){
								  
			var email = document.getElementById('email').value;
			
			var full_name = document.getElementById('name').value;
			var comment = document.getElementById('comment').value;
			
			if( ( email == '') ||( full_name == '')||( comment == '') )
			{
				if($("#msg02").is(":visible"))	
					$("#msg02").text('');
				if($("#msg03").is(":visible"))	
					$("#msg03").text('');	
				
				if($("#msg01").is(":hidden"))
				{
					$("#msg01").text('Please complete required fields. Required fields are marked with an asterisk *.');
					$("#msg01").slideDown("slow");
				}
				else	
					$("#msg01").css("display","none");
					
				return false;
			}
			else if(email != '')
			{
						var myRegExp=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
						if(!(myRegExp.test(email)))
						{
							
							
									if($("#msg02").is(":visible"))	
										 $("#msg02").text('');
									if($("#msg03").is(":visible"))	
										 $("#msg03").text('');	 
										 
									if($("#msg01").is(":visible"))
									{
										  $("#msg01").text('');
										  $("#msg01").css("display","none");
									}
									if($("#msg01").is(":hidden"))
									{
										$("#msg01").text('Provide valid email address.');
										$("#msg01").slideDown("slow");
									}
									else	
										$("#msg01").css("display","none");
							return false;
						}
						
			}
			else
			{
			  return true;	
			}
    });
    $("#page_name1").change(function() {
       var PageName = $(this).val();
       
       $.ajax(
              {
                type: "POST",
                url: "select_item.php",
                data: "PageName="+PageName,
                success: function(msg)
                {
                   $("#outer01").html( msg );

                }
              }
            );
  
    });


  });
  
  function deletePic(picId) {
              currentId = picId;
       
              $.ajax(
              {
                type: "POST",
                url: "delete_item.php",
                data: "currentId="+currentId,
                success: function(msg)
                {
                   if( msg == 'success');
                   $('#pic_'+currentId).hide();
                   window.location.href = 'admin-product-images.php';
                }
              }
            );
}
  

