function showverse(verse){
	var spin=new spinner('/resources/images/ajax-loader.gif');
	spin.setText("");
	
	if (verse != "") {
		var key = "IP";
		var base = "/resources/ajax/proxy.php?url=";
		var url = "http://www.esvapi.org/v2/rest/passageQuery?key=";
		var rest = key + "&passage=" + escape(verse) + "&include-headings=false";
		$("#revealbutton").hide();
		spin.addToElement("#revealbuttontd", false);
		$.get(base + escape(url + rest), function(data){
			var style = "<style>.esv{font-family:'Lucida Grande',Helvetica,Arial,Verdana,sans-serif; font-size:12px;} h2, h3{font-family:'Lucida Grande',Helvetica,Arial,Verdana,sans-serif; font-size:14px;} </style>"
			$("#verse").show();
			$("#stext").html(style + data)
			var divobj = $("div.esv");
			if (divobj[0] != undefined) {
				var newHeight = divobj[0].scrollHeight + 18;
				if (newHeight > 200) {
					newHeight = 200;
				}
			}else{
				newHeight=30;
			}
			$("#stext").css("height", newHeight).show("blind");
			spin.remove();
			$("#revealbutton").show();
		});
	}
}

function getversetextonly(verse){
	if (verse != "") {
		var key = "IP";
		var base = "/resources/ajax/proxy.php?url=";
		var url = "http://www.esvapi.org/v2/rest/passageQuery?key=";
		var rest = key + "&passage=" + escape(verse) + "&include-headings=false";
		
		$.get(base + escape(url + rest), function(data){
			var style = "<style>.esv{font-family:'Lucida Grande',Helvetica,Arial,Verdana,sans-serif; font-size:14px;} h2, h3{font-family:'Lucida Grande',Helvetica,Arial,Verdana,sans-serif; font-size:14px;} </style>"
			//$("#dialogbody").html(style + data)
			$("#dialogbody").html(data);
		})
		.error(function(){$("#dialogbody").html("Enter a valid verse in the Scripture field.");});
	}else{
		$("#dialogbody").html("Enter a valid verse in the Scripture field to reveal it's text.");
	}
}

function deleteEntry(){
	$("#dialog").dialog("open");
}

function hireme(){
	$("#dialoghireme").dialog("open")
}

function countryChoose() { 
	if ($("#country").val()=="United States"){
		$("#stateUS").css("display", "inline");
		$("#stateOther").css("display", "none");
		try{$("#stateOther_val").remove()}catch(e){};
		
	}else{
		$("#stateUS").css("display", "none");;
		$("#stateOther").css("display", "inline");
		try{$("#stateUS_val").remove()}catch(e){}
	}
}

function logout(){
	$('form').submit();
}

//load the country dropdown
function loadcfield(){
	var cn=$("#cchoice").val();
	var st=$("#stchoice").val(); 
	
	$("#country").val(cn).trigger("onchange");
	if (cn == "United States") {
		$("#stateUS").val(st)
	}else{
		$("#stateOther").val(st)
	}
}






