$(document).ready(function(){
	var windowHeight = $(window).height();
	windowHeight = windowHeight + 1;
	$("#outerwrapper").css({'height':windowHeight+'px'});
	
	var DocumentHeight = $(document).height();
	var DocumentHeight = DocumentHeight+70;

	$("<div id='modalLayer'></div>").css({"height":DocumentHeight+"px","opacity":0.5}).insertAfter("#outerwrapper").hide();
});


//$(document).ready(function() {
//	$('#faqList').find('dd').hide().end().find('dt').click(function() {
//     $(this).next().slideToggle();
// 	$('#faqList').find('dd').hide().end();
//   });   
//});

$(function() {
$("#faqList dt").click(function(){
	$("#faqList dd").hide();
	$(this).next("dd").slideDown("slow");
	});

	$("table tr").each(function(){
		$("td",this).eq(1).css({"text-align":"right"})
	});

});





$(document).ready(function(){
	var Errors = $(".errors");
	Errors.hide();
	Errors.slideDown("slow");
});

$(document).ready(function() 
{$(".trigger").tooltip({ 
    position:['center','right'],
    offset: [0,100], 
    effect: 'fade',
    opacity: 0.9, 
    tip: '.tooltip' 
});
});

$(document).ready(function(){
	$("input.btn, a.inputStyle").hover(function(){
		$(this).addClass("hover");
	},
	function() {
		$(this).removeClass("hover");	
	});
});

$(document).ready(function(){
	$("input.btn, a.inputStyle").focus(function(){
		$(this).addClass("hover");
	});
});

$(document).ready(function(){
	$("form:not(.search) input:not(:submit),textarea ").focus(function(){
		$(this).addClass("inputFocus");
	}).
	blur(function(){
		$(this).removeClass("inputFocus");
	}).
	keyup(function(){
		$(this).removeClass("inputFocus");
	});
});

$(document).ready(function(){
	$("fieldset").each(function(){
		var heading = $("legend",this).remove().text();
		$("<h3></h3>").text(heading).prependTo(this);
	});
});

// for use with ajax functions to get values from the url see testcart

function getUrlVars(url)
{
 
	var vars = [], hash;
    var hashes = url.slice(url.indexOf('?') + 1).split('&');
    
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}

$(function(){
	$(".success").hide().slideDown("slow").delay(5000).fadeOut("slow",function(){location.href="contact"});
});

$(document).ready(function() {
  $('#loading').ajaxStart(function() {
    $(this).show();
  }).ajaxStop(function() {
    $(this).hide();
  });
});


