

$(document).ready(function () { 
	function detectBrowser()
{
	if (window.XMLHttpRequest) {
	return true;
	} else {
	return false;
	}
}
$('p#message').fadeIn(2000);
        // Fullname validation logic
        var validateFullname = $('#validateFullname');
        $('#fullname').blur(function () {
            // cache the 'this' instance as we need access to it within a setTimeout, where 'this' is set to 'window'
            var t = this; 
            
            // only run the check if the username has actually changed - also means we skip meta keys
            if (this.value != this.lastValue) {
                
                // the timeout logic means the ajax doesn't fire with *every* key press, i.e. if the user holds down
                // a particular key, it will only fire when the release the key.
                                
                if (this.timer) clearTimeout(this.timer);
                
                // show our holding text in the validation message space
				if(detectBrowser())
				{
                validateFullname.removeClass('error').html('<img src=\"images/formloader.gif\" /> validating field...');
				}
                
                // fire an ajax request in 1/5 of a second
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: 'pricing.php',
                        data: 'action=check_fullname&fullname=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            // put the 'msg' field from the $resp array from check_fullname (php code) in to the validation message
                            validateFullname.html(j.fullname);
                        }
                    });
                }, 200);
                
                // copy the latest value to avoid sending requests when we don't need to
                this.lastValue = this.value;
            }
        });
		
		
		 // email validation logic
        var validateEmail = $('#validateEmail');
        $('#email').blur(function () {
            // cache the 'this' instance as we need access to it within a setTimeout, where 'this' is set to 'window'
            var t = this; 
            
            // only run the check if the email has actually changed - also means we skip meta keys
            if (this.value != this.lastValue) {
                
                // the timeout logic means the ajax doesn't fire with *every* key press, i.e. if the user holds down
                // a particular key, it will only fire when the release the key.
                                
                if (this.timer) clearTimeout(this.timer);
                
                // show our holding text in the validation message space
				if(detectBrowser())
				{
                validateEmail.removeClass('error').html('<img src=\"images/formloader.gif\" /> validating field...');
				}
                
                // fire an ajax request in 1/5 of a second
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: 'pricing.php',
                        data: 'action=check_email&email=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            // put the 'msg' field from the $resp array from check_phone (php code) in to the validation message
                            validateEmail.html(j.email);
                        }
                    });
                }, 200);
                
                // copy the latest value to avoid sending requests when we don't need to
                this.lastValue = this.value;
            }
        });
		
		// phone validation logic
        var validatePhone = $('#validatePhone');
        $('#phone').blur(function () {
            // cache the 'this' instance as we need access to it within a setTimeout, where 'this' is set to 'window'
            var t = this; 
            
            // only run the check if the phone has actually changed - also means we skip meta keys
            if ((this.value != this.lastValue)) {
                
                // the timeout logic means the ajax doesn't fire with *every* key press, i.e. if the user holds down
                // a particular key, it will only fire when the release the key.
                                
                if (this.timer) clearTimeout(this.timer);
                
                // show our holding text in the validation message space
				if(detectBrowser())
				{
                validatePhone.removeClass('error').html('<img src=\"images/formloader.gif\" /> validating field...');
				}
                
                // fire an ajax request in 1/5 of a second
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: 'pricing.php',
                        data: 'action=check_phone&phone=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            // put the 'msg' field from the $resp array from check_phone (php code) in to the validation message
                            validatePhone.html(j.phone);
                        }
                    });
                }, 200);
                
                // copy the latest value to avoid sending requests when we don't need to
                this.lastValue = this.value;
            }
        });
		
		// company validation logic
        var validateCompany = $('#validateCompany');
        $('#company').blur(function () {
            // cache the 'this' instance as we need access to it within a setTimeout, where 'this' is set to 'window'
            var t = this; 
            
            // only run the check if the company has actually changed - also means we skip meta keys
            if ((this.value != this.lastValue)) {
                
                // the timeout logic means the ajax doesn't fire with *every* key press, i.e. if the user holds down
                // a particular key, it will only fire when the release the key.
                                
                if (this.timer) clearTimeout(this.timer);
                
                // show our holding text in the validation message space
				if(detectBrowser())
				{
                validateCompany.removeClass('error').html('<img src=\"images/formloader.gif\" /> validating field...');
				}
                
                // fire an ajax request in 1/5 of a second
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: 'pricing.php',
                        data: 'action=check_company&company=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            // put the 'msg' field from the $resp array from check_company (php code) in to the validation message
                            validateCompany.html(j.company);
                        }
                    });
                }, 200);
                
                // copy the latest value to avoid sending requests when we don't need to
                this.lastValue = this.value;
            }
        });
		
				// city validation logic
        var validateCity = $('#validateCity');
        $('#city').blur(function () {
            // cache the 'this' instance as we need access to it within a setTimeout, where 'this' is set to 'window'
            var t = this; 
            
            // only run the check if the city has actually changed - also means we skip meta keys
            if ((this.value != this.lastValue)) {
                
                // the timeout logic means the ajax doesn't fire with *every* key press, i.e. if the user holds down
                // a particular key, it will only fire when the release the key.
                                
                if (this.timer) clearTimeout(this.timer);
                
                // show our holding text in the validation message space
				if(detectBrowser())
				{
                validateCity.removeClass('error').html('<img src=\"images/formloader.gif\" /> validating field...');
				}
                
                // fire an ajax request in 1/5 of a second
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: 'pricing.php',
                        data: 'action=check_city&city=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            // put the 'msg' field from the $resp array from check_city (php code) in to the validation message
                            validateCity.html(j.city);
                        }
                    });
                }, 200);
                
                // copy the latest value to avoid sending requests when we don't need to
                this.lastValue = this.value;
            }
        });
		
		// State validation logic
        var validateState = $('#validateState');
        $('#state').blur(function () {
            // cache the 'this' instance as we need access to it within a setTimeout, where 'this' is set to 'window'
            var t = this; 
            
            // only run the check if the username has actually changed - also means we skip meta keys
            if (this.value != this.lastValue) {
                
                // the timeout logic means the ajax doesn't fire with *every* key press, i.e. if the user holds down
                // a particular key, it will only fire when the release the key.
                                
                if (this.timer) clearTimeout(this.timer);
                
                // show our holding text in the validation message space
				if(detectBrowser())
				{
                validateState.removeClass('error').html('<img src=\"images/formloader.gif\" /> validating field...');
				}
                
                // fire an ajax request in 1/5 of a second
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: 'pricing.php',
                        data: 'action=check_state&state=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            // put the 'msg' field from the $resp array from check_state (php code) in to the validation message
                            validateState.html(j.state);
                        }
                    });
                }, 200);
                
                // copy the latest value to avoid sending requests when we don't need to
                this.lastValue = this.value;
            }
        });
		
		// audience validation logic
        var validateAudience = $('#validateAudience');
        $('#audience').blur(function () {
            // cache the 'this' instance as we need access to it within a setTimeout, where 'this' is set to 'window'
            var t = this; 
            
            // only run the check if the audience has actually changed - also means we skip meta keys
            if ((this.value != this.lastValue)) {
                
                // the timeout logic means the ajax doesn't fire with *every* key press, i.e. if the user holds down
                // a particular key, it will only fire when the release the key.
                                
                if (this.timer) clearTimeout(this.timer);
                
                // show our holding text in the validation message space
				if(detectBrowser())
				{
                validateAudience.removeClass('error').html('<img src=\"images/formloader.gif\" /> validating field...');
				}
                
                // fire an ajax request in 1/5 of a second
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: 'pricing.php',
                        data: 'action=check_audience&audience=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            // put the 'msg' field from the $resp array from check_audience (php code) in to the validation message
                            validateAudience.html(j.audience);
                        }
                    });
                }, 200);
                
                // copy the latest value to avoid sending requests when we don't need to
                this.lastValue = this.value;
            }
        });
		
		// cur_url validation logic
        var validateCur_url = $('#validateCur_url');
        $('#cur_url').blur(function () {
            // cache the 'this' instance as we need access to it within a setTimeout, where 'this' is set to 'window'
            var t = this; 
            
            // only run the check if the cur_url has actually changed - also means we skip meta keys
            if ((this.value != this.lastValue)) {
                
                // the timeout logic means the ajax doesn't fire with *every* key press, i.e. if the user holds down
                // a particular key, it will only fire when the release the key.
                                
                if (this.timer) clearTimeout(this.timer);
                
                // show our holding text in the validation message space
				if(detectBrowser())
				{
                validateCur_url.removeClass('error').html('<img src=\"images/formloader.gif\" /> validating field...');
				}
                
                // fire an ajax request in 1/5 of a second
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: 'pricing.php',
                        data: 'action=check_cur_url&cur_url=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            // put the 'msg' field from the $resp array from check_cur_url (php code) in to the validation message
                            validateCur_url.html(j.cur_url);
                        }
                    });
                }, 200);
                
                // copy the latest value to avoid sending requests when we don't need to
                this.lastValue = this.value;
            }
        });
		
				// budget validation logic
        var validateBudget = $('#validateBudget');
        $('#budget').change(function () {
            // cache the 'this' instance as we need access to it within a setTimeout, where 'this' is set to 'window'
            var t = this; 
            
            // only run the check if the budget has actually changed - also means we skip meta keys
            if ((this.value != this.lastValue)) {
                
                // the timeout logic means the ajax doesn't fire with *every* key press, i.e. if the user holds down
                // a particular key, it will only fire when the release the key.
                                
                if (this.timer) clearTimeout(this.timer);
                
                // show our holding text in the validation message space
				if(detectBrowser())
				{
                validateBudget.removeClass('error').html('<img src=\"images/formloader.gif\" /> validating field...');
				}
                // fire an ajax request in 1/5 of a second
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: 'pricing.php',
                        data: 'action=check_budget&budget=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            // put the 'msg' field from the $resp array from check_budget (php code) in to the validation message
                            validateBudget.html(j.budget);
                        }
                    });
                }, 200);
                
                // copy the latest value to avoid sending requests when we don't need to
                this.lastValue = this.value;
            }
        });
		
		// description validation logic
        var validateDescription = $('#validateDescription');
        $('#description').blur(function () {
            // cache the 'this' instance as we need access to it within a setTimeout, where 'this' is set to 'window'
            var t = this; 
            
            // only run the check if the description has actually changed - also means we skip meta keys
            if ((this.value != this.lastValue)) {
                
                // the timeout logic means the ajax doesn't fire with *every* key press, i.e. if the user holds down
                // a particular key, it will only fire when the release the key.
                                
                if (this.timer) clearTimeout(this.timer);
                
                // show our holding text in the validation message space
				if(detectBrowser())
				{
                validateDescription.removeClass('error').html('<img src=\"images/formloader.gif\" /> validating field...');
				}
                
                // fire an ajax request in 1/5 of a second
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: 'pricing.php',
                        data: 'action=check_description&description=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            // put the 'msg' field from the $resp array from check_description (php code) in to the validation message
                            validateDescription.html(j.description);
                        }
                    });
                }, 200);
                
                // copy the latest value to avoid sending requests when we don't need to
                this.lastValue = this.value;
            }
        });
		
		// additional validation logic
        var validateAdditional = $('#validateAdditional');
        $('#additional').blur(function () {
            // cache the 'this' instance as we need access to it within a setTimeout, where 'this' is set to 'window'
            var t = this; 
            
            // only run the check if the additional has actually changed - also means we skip meta keys
            if ((this.value != this.lastValue)) {
                
                // the timeout logic means the ajax doesn't fire with *every* key press, i.e. if the user holds down
                // a particular key, it will only fire when the release the key.
                                
                if (this.timer) clearTimeout(this.timer);
                
                // show our holding text in the validation message space
				if(detectBrowser())
				{
                validateAdditional.removeClass('error').html('<img src=\"images/formloader.gif\" /> validating field...');
				}
                
                // fire an ajax request in 1/5 of a second
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: 'pricing.php',
                        data: 'action=check_additional&additional=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            // put the 'msg' field from the $resp array from check_additional (php code) in to the validation message
                            validateAdditional.html(j.additional);
                        }
                    });
                }, 200);
                
                // copy the latest value to avoid sending requests when we don't need to
                this.lastValue = this.value;
            }
        });
		
						// reference validation logic
        var validateReference = $('#validateReference');
        $('#reference').change(function () {
            // cache the 'this' instance as we need access to it within a setTimeout, where 'this' is set to 'window'
            var t = this; 
            
            // only run the check if the reference has actually changed - also means we skip meta keys
            if ((this.value != this.lastValue)) {
                
                // the timeout logic means the ajax doesn't fire with *every* key press, i.e. if the user holds down
                // a particular key, it will only fire when the release the key.
                                
                if (this.timer) clearTimeout(this.timer);
                
                // show our holding text in the validation message space
				if(detectBrowser())
				{
                validateReference.removeClass('error').html('<img src=\"images/formloader.gif\" /> validating field...');
				}
                
                // fire an ajax request in 1/5 of a second
                this.timer = setTimeout(function () {
                    $.ajax({
                        url: 'pricing.php',
                        data: 'action=check_reference&reference=' + t.value,
                        dataType: 'json',
                        type: 'post',
                        success: function (j) {
                            // put the 'msg' field from the $resp array from check_reference (php code) in to the validation message
                            validateReference.html(j.reference);
                        }
                    });
                }, 200);
                
                // copy the latest value to avoid sending requests when we don't need to
                this.lastValue = this.value;
            }
        });
		
		
	//added this checkbox click for something I given earlier
	$('#DynamicCalendar').click(function() { 
	   if ($(this).attr('checked') == true)
	
	  {
			$(this).parent().addClass('highlight');  
	  } 
	else
	 {   
		 $(this).parent().removeClass('highlight');
	
		}});
			//added this checkbox click for something I given earlier
	$('#EcommerceSolutions').click(function() { 
	   if ($(this).attr('checked') == true)
	
	  {
			$(this).parent().addClass('highlight');  
	  } 
	else
	 {   
		 $(this).parent().removeClass('highlight');
	
		}});
			//added this checkbox click for something I given earlier
	$('#ContentManagementSystem').click(function() { 
	   if ($(this).attr('checked') == true)
	
	  {
			$(this).parent().addClass('highlight');  
	  } 
	else
	 {   
		 $(this).parent().removeClass('highlight');
	
		}});
			//added this checkbox click for something I given earlier
	$('#CustomForms').click(function() { 
	   if ($(this).attr('checked') == true)
	
	  {
			$(this).parent().addClass('highlight');  
	  } 
	else
	 {   
		 $(this).parent().removeClass('highlight');
	
		}});
			//added this checkbox click for something I given earlier
	$('#Forum').click(function() { 
	   if ($(this).attr('checked') == true)
	
	  {
			$(this).parent().addClass('highlight');  
	  } 
	else
	 {   
		 $(this).parent().removeClass('highlight');
	
		}});
			//added this checkbox click for something I given earlier
	$('#MailingLists').click(function() { 
	   if ($(this).attr('checked') == true)
	
	  {
			$(this).parent().addClass('highlight');  
	  } 
	else
	 {   
		 $(this).parent().removeClass('highlight');
	
		}});
			//added this checkbox click for something I given earlier
	$('#WebsiteSearchCapability').click(function() { 
	   if ($(this).attr('checked') == true)
	
	  {
			$(this).parent().addClass('highlight');  
	  } 
	else
	 {   
		 $(this).parent().removeClass('highlight');
	
		}});
			//added this checkbox click for something I given earlier
	$('#CustomProgramming').click(function() { 
	   if ($(this).attr('checked') == true)
	
	  {
			$(this).parent().addClass('highlight');  
	  } 
	else
	 {   
		 $(this).parent().removeClass('highlight');
	
		}});
		//--------------END FORM VALIDATION-------------//
    });