//Mail Check Starts Here

    $(document).ready(function(){
        $('#send_message').click(function(e){
            
            e.preventDefault();
            

            var error = false;			
            var name = $('#name').val();
            var email = $('#email').val();
            var subject = $('#subject').val();
            var message = $('#message').val();
			

            if(name.length == 0){
                var error = true;
				$('#name_error').slideDown(500);
            }else{
				$('#name_error').slideUp(500);
            }
			
			
			
			
			if(email.length	<7			||
			email.indexOf('@') == '-1'	||
			email.indexOf("@.") != -1	||
			email.indexOf("-.") != -1	||
			email.indexOf("_.") != -1	||
			email.indexOf("..") != -1	|| 
			email.indexOf("._") != -1	|| 
			email.indexOf(".-") != -1	||
			email.indexOf(".@") != -1	||
			email.indexOf("@-") != -1	|| 
			email.indexOf("@_") != -1	|| 
			email.indexOf("@") == -1	|| 
			email.indexOf(".") == -1 ){
                var error = true;
                $('#email_error').slideDown(200);
            }else{
                $('#email_error').slideUp(500);
            }
			
			
            if(subject.length == 0){
                var error = true;
                $('#subject_error').slideDown(500);
            }else{
                $('#subject_error').slideUp(500);
            }
			
			
            if(message.length == 0){
                var error = true;
                $('#message_error').slideDown(500);
            }else{
                $('#message_error').slideUp(500);
            }
            
            //now when the validation is done we check if the error variable is false (no errors)
            if(error == false){
                //disable the submit button to avoid spamming
                //and change the button text to Sending...
                $('#send_message').attr({'disabled' : 'true', 'value' : 'Sending...' });
                
                /* using the jquery's post(ajax) function and a lifesaver
                function serialize() which gets all the data from the form
                we submit it to send_email.php */
                $.post("php/send_email.php", $("#contactform").serialize(),function(result){
                    //and after the ajax request ends we check the text returned
                    if(result == 'sent'){
                        //if the mail is sent remove the submit paragraph
                         $('#send_message').remove();
                        //and show the mail success div with fadeIn
                        $('#mail_success').slideDown(500);
                    }else{
                        //show the mail failed div
                        $('#mail_fail').slideDown(500);
                        //reenable the submit button by removing attribute disabled and change the text back to Send The Message
                        $('#send_message').removeAttr('disabled').attr('value', 'Send The Message');
                    }
                });
            }
        });    
    });
	
	
	//Logo Request Check Starts Here
	
	    $(document).ready(function(){
        $('#send_logorequest').click(function(e){
            
            e.preventDefault();
            

            var error = false;
			
			
            var logotext = $('#logotext').val();
            var logocolor = $('#logocolor').val();
            var logoaudience = $('#logoaudience').val();
            var logoname = $('#logoname').val();
            var logoemail = $('#logoemail').val();            
			

            if(logotext.length == 0){
                var error = true;
				$('#logotext_error').slideDown(500);
            }else{
				$('#logotext_error').slideUp(500);
            }
			
			if(logocolor.length == 0){
                var error = true;
				$('#logocolor_error').slideDown(500);
            }else{
				$('#logocolor_error').slideUp(500);
            }            
			

            if(logoaudience.length == 0){
                var error = true;
				$('#logoaudience_error').slideDown(500);
            }else{
				$('#logoaudience_error').slideUp(500);
            }
			
			if(logoname.length == 0){
                var error = true;
				$('#logoname_error').slideDown(500);
            }else{
				$('#logoname_error').slideUp(500);
            }
			
			
			
			
			if(logoemail.length	<7			||
			logoemail.indexOf('@') == '-1'	||
			logoemail.indexOf("@.") != -1	||
			logoemail.indexOf("-.") != -1	||
			logoemail.indexOf("_.") != -1	||
			logoemail.indexOf("..") != -1	|| 
			logoemail.indexOf("._") != -1	|| 
			logoemail.indexOf(".-") != -1	||
			logoemail.indexOf(".@") != -1	||
			logoemail.indexOf("@-") != -1	|| 
			logoemail.indexOf("@_") != -1	|| 
			logoemail.indexOf("@") == -1	|| 
			logoemail.indexOf(".") == -1 ){
                var error = true;
                $('#logoemail_error').slideDown(200);
            }else{
                $('#logoemail_error').slideUp(500);
            }
			
			

            
            //now when the validation is done we check if the error variable is false (no errors)
            if(error == false){
                //disable the submit button to avoid spamming
                //and change the button text to Sending...
                $('#send_logorequest').attr({'disabled' : 'true', 'value' : 'Sending...' });
                
                /* using the jquery's post(ajax) function and a lifesaver
                function serialize() which gets all the data from the form
                we submit it to send_email.php */
                $.post("php/send_logorequest.php", $("#logorequest_form").serialize(),function(result){
                    //and after the ajax request ends we check the text returned
                    if(result == 'sent'){
                        //if the mail is sent remove the submit paragraph
                         $('#send_logorequest').remove();
                        //and show the mail success div with fadeIn
                        $('#logorequest_success').fadeIn(500);
                    }else{
                        //show the mail failed div
                        $('#logorequest_fail').fadeIn(500);
                        //reenable the submit button by removing attribute disabled and change the text back to Send The Message
                        $('#send_logorequest').removeAttr('disabled').attr('value', 'Send The Message');
                    }
                });
            }
        });    
    });
	
	
	//Site Request Check starts here
	
	    $(document).ready(function(){
        $('#send_siterequest').click(function(e){
            
            e.preventDefault();
            

            var error = false;
			
			
            var sitetitle = $('#sitetitle').val();
            var siteurl = $('#siteurl').val();  
            var sitecolor = $('#sitecolor').val();  
            var sitetitles = $('#sitetitles').val();  
            var siteaudience = $('#siteaudience').val();  
            var siteinfo = $('#siteinfo').val();            
            var sitename = $('#sitename').val();           
            var siteemail = $('#siteemail').val();         
			

            if(sitetitle.length == 0){
                var error = true;
				$('#sitetitle_error').slideDown(500);
            }else{
				$('#sitetitle_error').slideUp(500);
            }
			
			if(siteurl.length == 0){
                var error = true;
				$('#siteurl_error').slideDown(500);
            }else{
				$('#siteurl_error').slideUp(500);
            }  
			
			
			if(sitecolor.length == 0){
                var error = true;
				$('#sitecolor_error').slideDown(500);
            }else{
				$('#sitecolor_error').slideUp(500);
            }  
			
			
			if(sitetitles.length == 0){
                var error = true;
				$('#sitetitles_error').slideDown(500);
            }else{
				$('#sitetitles_error').slideUp(500);
            }            
			

            if(siteaudience.length == 0){
                var error = true;
				$('#siteaudience_error').slideDown(500);
            }else{
				$('#siteaudience_error').slideUp(500);
            }         
			

            if(siteinfo.length == 0){
                var error = true;
				$('#siteinfo_error').slideDown(500);
            }else{
				$('#siteinfo_error').slideUp(500);
            }
			
			if(sitename.length == 0){
                var error = true;
				$('#sitename_error').slideDown(500);
            }else{
				$('#sitename_error').slideUp(500);
            }
			
			
			
			
			if(siteemail.length	<7			||
			siteemail.indexOf('@') == '-1'	||
			siteemail.indexOf("@.") != -1	||
			siteemail.indexOf("-.") != -1	||
			siteemail.indexOf("_.") != -1	||
			siteemail.indexOf("..") != -1	|| 
			siteemail.indexOf("._") != -1	|| 
			siteemail.indexOf(".-") != -1	||
			siteemail.indexOf(".@") != -1	||
			siteemail.indexOf("@-") != -1	|| 
			siteemail.indexOf("@_") != -1	|| 
			siteemail.indexOf("@") == -1	|| 
			siteemail.indexOf(".") == -1 ){
                var error = true;
                $('#siteemail_error').slideDown(200);
            }else{
                $('#siteemail_error').slideUp(500);
            }
			
			

            
            //now when the validation is done we check if the error variable is false (no errors)
            if(error == false){
                //disable the submit button to avoid spamming
                //and change the button text to Sending...
                $('#send_siterequest').attr({'disabled' : 'true', 'value' : 'Sending...' });
                
                /* using the jquery's post(ajax) function and a lifesaver
                function serialize() which gets all the data from the form
                we submit it to send_email.php */
                $.post("php/send_siterequest.php", $("#siterequest_form").serialize(),function(result){
                    //and after the ajax request ends we check the text returned
                    if(result == 'sent'){
                        //if the mail is sent remove the submit paragraph
                         $('#send_siterequest').remove();
                        //and show the mail success div with fadeIn
                        $('#siterequest_success').fadeIn(500);
                    }else{
                        //show the mail failed div
                        $('#siterequest_fail').fadeIn(500);
                        //reenable the submit button by removing attribute disabled and change the text back to Send The Message
                        $('#send_siterequest').removeAttr('disabled').attr('value', 'Send The Message');
                    }
                });
            }
        });    
    });
