    $(document).ready(function () {			var bq_ver_name = false;			var bq_ver_email = false;			var bq_ver_amount = false;			var news_email = false;					function isOK(txt){		  return (txt.indexOf('err.png')==-1);		}					var validateName = $('#validateName');        $('#name').keyup(function () {            var t = this;             bq_ver_name = false;            if (this.value != this.lastValue) {                if (this.timer) clearTimeout(this.timer);                validateName.removeClass('error').html('<img src="/img/ajax-loader.gif" height="16" width="16" alt="loader" />');                this.timer = setTimeout(function () {                    $.ajax({                        url: '/ajax.php',                        data: 'action=check_name&name=' + t.value,                        dataType: 'json',                        type: 'post',                        success: function (j) {                            validateName.html(j.msg);                            bq_ver_name = isOK(j.msg);                        }                    });                }, 200);                this.lastValue = this.value;            }        });				var validateEmail = $('#validateEmail');        $('#txtEmail').keyup(function () {            news_email = false;            var t = this;             if (this.value != this.lastValue) {                if (this.timer) clearTimeout(this.timer);                validateEmail.html('<img src="/images/loader.gif" height="16" width="16" alt="loader" />');                this.timer = setTimeout(function () {                    $.ajax({                        url: '/ajaxin.php',                        data: 'action=check_email&txtEmail=' + t.value,                        dataType: 'json',                        type: 'post',                        success: function (j) {                            validateEmail.html(j.msg);														news_email = isOK(j.msg);                        }                    });                }, 600);                this.lastValue = this.value;            }        });		/* 	Newsletter subscribe form button replacement	*/						var slink = $('#butrep').show();			$('#newsub').replaceWith(slink);			var txtEmail = $("#txtEmail").val();			var fadetest = $('#fadetest');						$('input[title]').each(function() {				if($(this).val() === '') {					$(this).val($(this).attr('title')).css({'color' : '#979799'});				}				$(this).focus(function() {					if($(this).val() == $(this).attr('title')) {						$(this).val('').addClass('focused').css({'color' : '#000'});						}				});				$(this).blur(function() {					if($(this).val() === '') {						$(this).val($(this).attr('title')).css({'color' : '#000'}).removeClass('focused');						}				});			});		/*		AjaxSubscribe function		*/			function AjaxSubscribe(){				$.ajax({					url: '/ajaxin.php',					data: 'action=newsletter_subscribe&txtEmail=' + $("#txtEmail").val(),					dataType: 'json',					type: 'post',					success: function (j) {						fadetest.html(j.msg);					},					error: function (j) {						setTimeout(function(){								$("#loader").fadeOut(1, function(){								  $("#fadetest").fadeOut(800);								  setTimeout(function(){									$("#fout").fadeIn(100);									$("#mail").fadeOut(800);								},100);								});							},800);					}					});				}			$('#butrep').click(function () {								if(news_email==true){					AjaxSubscribe();						$("#fout").fadeOut(1, function(){						$("#loader").fadeIn(1);						setTimeout(function(){							$("#loader").fadeOut(1);							setTimeout(function(){								$("#fadetest").fadeIn(800, function(){								  $("#mail").fadeIn(800);								});							},100);						},2500);						});				}							return false;			});			/*			Quotation vform validation, user side			*/		var bq_validateName = $('#bq_validateName');        $('#bq_txtname').keyup(function () {            var t = this;             if (this.value != this.lastValue) {                if (this.timer) clearTimeout(this.timer);                bq_validateName.html('<img src="/images/loader.gif" height="16" width="16" alt="loader" />');                this.timer = setTimeout(function () {                    $.ajax({                        url: '/ajax_bform.php',                        data: 'action=check_name&bq_txtname=' + t.value,                        dataType: 'json',                        type: 'post',                        success: function (j) {                            bq_validateName.html(j.msg);														bq_ver_name = isOK(j.msg);                        }                    });                }, 600);                this.lastValue = this.value;            }        });								var bq_validateCompany = $('#bq_validateCompany');        $('#bq_txtcompany').keyup(function () {            var t = this;             if (this.value != this.lastValue) {                if (this.timer) clearTimeout(this.timer);                bq_validateCompany.html('<img src="/images/loader.gif" height="16" width="16" alt="loader" />');                this.timer = setTimeout(function () {                    $.ajax({                        url: '/ajax_bform.php',                        data: 'action=check_compname&bq_txtcompany=' + encodeURI(t.value),                        dataType: 'json',                        type: 'post',                        success: function (j) {                            bq_validateCompany.html(j.msg);                        }                    });                }, 600);                this.lastValue = this.value;            }        });			var bq_validateEmail = $('#bq_validateEmail');        $('#bq_txtemail').keyup(function () {            bq_ver_email = false;            var t = this;             if (this.value != this.lastValue) {                if (this.timer) clearTimeout(this.timer);                bq_validateEmail.html('<img src="/images/loader.gif" height="16" width="16" alt="loader" />');                this.timer = setTimeout(function () {                    $.ajax({                        url: '/ajax_bform.php',                        data: 'action=check_bqemail&bq_txtemail=' + encodeURI(t.value),                        dataType: 'json',                        type: 'post',                        success: function (j) {                            bq_validateEmail.html(j.msg);														bq_ver_email = isOK(j.msg);                        }                    });                }, 600);                this.lastValue = this.value;            }        });			var bq_validatePhone = $('#bq_validatePhone');        $('#bq_txtphone').keyup(function () {            var t = this;             if (this.value != this.lastValue) {                if (this.timer) clearTimeout(this.timer);                bq_validatePhone.html('<img src="/images/loader.gif" height="16" width="16" alt="loader" />');                this.timer = setTimeout(function () {                    $.ajax({                        url: '/ajax_bform.php',                        data: 'action=check_bqphone&bq_txtphone=' + t.value,                        dataType: 'json',                        type: 'post',                        success: function (j) {                            bq_validatePhone.html(j.msg);                        }                    });                }, 600);                this.lastValue = this.value;            }        });	    var bq_validateAmount = $('#bq_validateAmount');        $('#bq_txttotal').keyup(function () {            bq_ver_amount = false;            var t = this;            if (this.value != this.lastValue) {                if (this.timer) clearTimeout(this.timer);                bq_validateAmount.html('<img src="/images/loader.gif" height="16" width="16" alt="loader init" />');                this.timer = setTimeout(function () {                    $.ajax({                        url: '/ajax_bform.php',                        data: 'action=check_amount&bq_txttotal=' + t.value,                        dataType: 'json',                        type: 'post',                        success: function (j) {                            bq_validateAmount.html(j.msg);														bq_ver_amount = isOK(j.msg);                        }                    });                }, 600);                this.lastValue = this.value;            }        });		/*	Quotation form replacements		*/		var paytermsdiv = $('#rep_payterm').show();		$('#bq_txtduration').replaceWith(paytermsdiv);				var freqdiv = $('#rep_freq').show();		$('#bq_txtfrequency').replaceWith(freqdiv);				var years = $('#rep_numyears').text();		var yearsval = parseInt(years);				$('#rep_addbutt').click(function(){			if(yearsval<5){				yearsval++;			$('#rep_numyears').text(yearsval);			}				return false;			});				$('#rep_dedbutt').click(function(){			if(yearsval<=5&&yearsval>2){			yearsval--;				$('#rep_numyears').text(yearsval);			}				return false;			});		$('#rep_fremo').css({'background' : 'url(images/month-on.png)'});		$('#rep_frequo').css({'background' : 'url(images/quarter-off.png)'});				var bq_txtfrequency = 12;				function fremoact(){			$('#rep_fremo').css({'background' : 'url(images/month-on.png)'});			$('#rep_frequo').css({'background' : 'url(images/quarter-off.png)'});			bq_txtfrequency = 12;		}		function frequo(){			$('#rep_fremo').css({'background' : 'url(images/month-off.png)'});			$('#rep_frequo').css({'background' : 'url(images/quarter-on.png)'});					bq_txtfrequency = 4;		}		$('#rep_fremo').click(function(){			fremoact();			return false;		});				$('#rep_frequo').click(function(){			frequo();			return false;		});				/*		AjaxQuotation		*/			var bq_result_fade = $("#bq_result_fade");			var bq_result_fade2 = $("#bq_result_fade2");			function AjaxQuote(){				$.ajax({					url: '/ajax_bform.php',					data: 'action=quotation_request&bq_txtname='+$("#bq_txtname").val()+'&bq_txtcompany='+$("#bq_txtcompany").val()+'&bq_txtemail='+$("#bq_txtemail").val()+'&bq_txtphone='+$("#bq_txtphone").val()+'&bq_txttotal='+$("#bq_txttotal").val()+'&bq_txtduration='+yearsval+'&bq_txtfrequency='+bq_txtfrequency,					dataType: 'json',					type: 'post',					success: function (j) {					  $("#bq_result_fade2").fadeIn(800, function(){					    $("#bq_loader").hide();						$('#j_msg').html(j.msg);						});					},					error: function (j) {					setTimeout(function(){					  $("#bq_loader").hide();						setTimeout(function(){						  $("#bq_result_fade2").fadeOut(800);							$("#b_quote").fadeIn(100);						},100);					},800);					}				});			}					var repsubbut = $("#rep_subbut").show();			$("#subbut").replaceWith(repsubbut);			$('#rep_subbuta').click(function () {			if(bq_ver_name&&bq_ver_email&&bq_ver_amount){				AjaxQuote();					$("#b_quote").hide();					$("#bq_loader").fadeIn(1);					setTimeout(function(){						$("#bq_loader").fadeOut(1);					},2500);			} else {			  if (!bq_ver_name) $('#bq_txtname').focus();			  else			  	if (!bq_ver_email) $('#bq_txtemail').focus();			  	  else			  	    if (!bq_ver_amount) $('#bq_txttotal').focus();			}				return false;			});    });
