﻿
/*$(function(){$("#searchwords").focus(function(){$(this).val("");});});*/

var sendme = false;
var qnc = false;
$(function(){
	$("#qname").focus(function(){
		sendme = true;
		if (!qnc) {
			$(this).val("");
			qnc = true;
			}
		});
	});

var qepc = false;
$(function(){
	$("#qep").focus(function(){
		sendme = true;
		if (!qepc) {
			$(this).val("");
			qepc = true;
			}
		});
	});

var qmc = false;
$(function(){
	$("#qmess").focus(function(){
		sendme = true;
		if (!qmc) {
			$(this).val("");
			qmc = true;
			}
		});
	});

$(function(){
	$("#question span").click(function(){
		$("#questionform").toggle();
		if ($("#questionform").css("display") == "block") $("#question").css("background-image","url(/eggo-cms/img/greenbg.png)");
		else $("#question").css("background-image","");
		});
	});

$(function(){
	$("#bquestion").click(function(){
		$("#questionform").show();
		$("#question").css("background-image","url(/eggo-cms/img/greenbg.png)");
		return true;
		});
	});

$(function(){
	$("#qsubmit").click(function(){
		if (sendme) {
			sendme = false;
			$("#questionform").toggle();
			if ($("#questionform").css("display") == "block") $("#question").css("background-image","url(/eggo-cms/img/greenbg.png)");
			else $("#question").css("background-image","");
			var qname = encodeURIComponent($("#qname").val());
			var qep = encodeURIComponent($("#qep").val());
			var qmess = encodeURIComponent($("#qmess").val());
			$("#qname").val("");
			$("#qep").val("");
			$("#qmess").val("");
			$.ajax({
				url: "/mailer.php",
				type: "post",
				dataType: "json",
				data: {"qname":qname,"qep":qep,"qmess":qmess},
				cache: false,
				success: function(rq){
					$("#qresponser").css("top","200px");
					$("#response").html(rq.t);
					$("#closeresponser").click(function(){
						$("#qresponser").css("top","-1000px");
						});
					}
				});
			}
		});
	});

$(function(){
	$("#persons a").mouseover(function(){
		$("#info b").html($(this).attr("iname"));
		$("#info span").html($(this).attr("ijob"));
		$("#info").stop().animate({opacity:1},600);
		$(this).mouseout(function(){
			$("#info").stop().animate({opacity:0},600);
			});
		});
	});

/*$(function(){
	$("#selectservices").mouseover(function(){
		$(".selectservices").stop(true,true).slideToggle(300);})
	.mouseout(function(){$(".selectservices").stop(true,true).hide();});
	});*/

/*var gw = $(window).width();

function resizer() {
	var mw = $(window).width();
	if (mw != gw) {
		if (mw > 1280) $("#container").width(1280);
		else {
			$("#container").css("width","100%");
			if (mw < 1000) $("#container").width(1000);
			}
		gw = mw;
		}
	}

var resize = setInterval(function(){resizer();},200);*/


