function validatechar()
{
                var arr=new Array()
				 
				  var frmGall=document.frmGallery;

                arr[0]=frmGall.txtMessage;
                arr[1]=frmGall.txtFrName;
				arr[2]=frmGall.txtFrEmail;
	            arr[3]=frmGall.txtToName1;
				arr[4]=frmGall.txtToEmail1;

                var entrybox=new Array()
                entrybox[0] = 'Message';
                entrybox[1] = 'Your Name';
			    entrybox[2] = 'Your Email';
                entrybox[3] = 'To Name';
			    entrybox[4] = 'To Email';
 

                x=0
                while (x<=arr.length-1)
                {
                    	
					  if ((x == 2) || (x==4))
                        {
                                if (isBlank(arr[x])==true)
                                {
                                        alert('Please enter the text for \" ' + entrybox[x] + ' \"')
                                        arr[x].focus()
                                        return false
                                }

                                if (isValidEmail(arr[x])==false)
                                {
                                        alert("Please enter the correct format for \" " + entrybox[x] + " \"")
                                        arr[x].focus()
                                        return false
                                }
                        }						  


					  else
					{
						if (isBlank(arr[x])==true)
                                {
                                        alert('Please enter text for \" ' + entrybox[x] + ' \"')
                                        arr[x].focus()
                                        return false
                                }

					}
						      							
					
						

                        x++;
                }
                return true
}

function CallValid(strAction)
{
		var mform = document.frmGallery;
	if (validatechar()){
	if ((strAction=="preview") || (strAction=='preview'))
		{
		mform.action="preview-send-gallery.asp";
		var mwin = openWinBar('mwin',750,550);
		mform.target = "mwin";
		mform.submit()
		}
		else
		{
		mform.action="send-mail-gallery.asp";
		var mwin = openWinBar('mwin',200,100);
		mform.target = "mwin";
		mform.submit()
		}
	}
}
