$(document).ready(function () {
var HelpIcon = "http://www.wigan.gov.uk/NR/rdonlyres/21120431-B99F-489E-B1F4-0FD94466C459/0/Help.gif";
var HelpXML = "http://www.wigan.gov.uk/NR/rdonlyres/23F2963E-9072-41F9-A477-040C43ADC2E5/0/help.xml";
var HelpStylesheet ="http://www.wigan.gov.uk/NR/rdonlyres/F863C55C-6B7F-4D19-AA43-D9216290EF19/0/themestyle.css";

$('head').append('<link id="mylinkid" href="'+HelpStylesheet+'" rel="stylesheet">');

$("#txtKeyword").after("<img style=\"padding-left: 0.5em;\" alt=\"Keyword help\" src=\""+HelpIcon+"\" class=\"helpicon\" id=\"txtKeywordHelp\">");

$("#cmbCategory").after("<img style=\"padding-left: 0.5em;\" alt=\"Category help\" src=\""+HelpIcon+"\" class=\"helpicon\" id=\"cmbCategoryHelp\">");
$("#txtPostcodeOrTown").after("<img style=\"padding-left: 0.5em;\" alt=\"Location Search help\" src=\""+HelpIcon+"\" class=\"helpicon\" id=\"cbLocationSearchHelp\">");

$(".helpicon").css("cursor", "pointer");
var cmbCategory,txtKeyword;
 $.ajax({
   type: "GET",
   url: HelpXML,
   cache: false,
   data: "",
   success: function(xml){

     $('help', xml).each(function(i) {
				txtLocation = $(this).find("txtLocation").text(); 
				cmbCategory = $(this).find("cmbCategory").text();
				txtKeyword = $(this).find("txtKeyword").text(); 
				});
				}
				});
$("body").append("<div class='jqmConfirm' id='confirm'><div id='ex3b' class='jqmConfirmWindow'><div class='jqmConfirmTitle clearfix'><a href='#' class='jqmClose'><em>Close</em></a><h2 class='titletext'>Help</h2></div><div class='jqmConfirmContent'><p class='jqmConfirmMsg'></p></div></div></div>");
		$('#confirm').jqm({overlay: 30, modal: false, trigger: false,toTop: true });
$("#confirm").bgiframe();
	$("#cmbCategoryHelp").click(function () {
	$('#confirm').fadeIn("slow").jqmShow().find('p.jqmConfirmMsg') .html(cmbCategory) ;
	$('#confirm').find('div.jqmConfirmTitle h1') .html("Category Help");
$(".jqmOverlay").bgiframe();
$("a.jqmClose")[0].focus();
	
	});
	$("#txtKeywordHelp").click(function () {
	$('#confirm').fadeIn("slow").jqmShow().find('p.jqmConfirmMsg') .html(txtKeyword) ;
	$('#confirm').find('div.jqmConfirmTitle h1') .html("Keywords Help");	
$(".jqmOverlay").bgiframe();
$("a.jqmClose")[0].focus();
});
	
	$("#cbLocationSearchHelp").click(function () {
	$('#confirm').fadeIn("slow").jqmShow().find('p.jqmConfirmMsg') .html(txtLocation) ;
	$('#confirm').find('div.jqmConfirmTitle h1') .html("Location Search Help");
$(".jqmOverlay").bgiframe();
$("a.jqmClose")[0].focus();
	
	});
				
				});
				
