function encodeMyHtml(text){text=text.replace(/\&/g,"&"+"amp;");text=text.replace(/</g,"&"+"lt;");text=text.replace(/>/g,"&"+"gt;");text=text.replace(/\'/g,"&#39;");text=text.replace(/\"/g,"&"+"quot;");return text}function URLDecode(psEncodeString){var lsRegExp=/\+/g;return unescape(String(psEncodeString).replace(lsRegExp," "))}function SetupPage(){document.frmPageForm.TitleTextBox.focus()}
location.querystring=function(){var queryStringDictionary={};var querystring=location.search;if(!querystring)return{};querystring=querystring.substring(1);var pairs=querystring.split("&");for(var i=0;i<pairs.length;i++){var keyValuePair=pairs[i].split("=");if(keyValuePair[1]!="")if(queryStringDictionary[keyValuePair[0]]!=undefined)queryStringDictionary[keyValuePair[0]]=queryStringDictionary[keyValuePair[0]]+","+URLDecode(keyValuePair[1]);else queryStringDictionary[keyValuePair[0]]=URLDecode(keyValuePair[1])}queryStringDictionary.toString=
function(){if(queryStringDictionary.length==0)return"";var toString="?";for(var key in queryStringDictionary)toString+=key+"="+queryStringDictionary[key];return toString};return queryStringDictionary}();
function RefillForm(){for(var key in location.querystring){var KeyValue=URLDecode(location.querystring[key]);if($("form input[name="+key+"]:not(:checkbox)").length)$("form input[name="+key+"]:not(:checkbox)").val(KeyValue);if($("form select[name="+key+"]").length)$("form select[name="+key+"]").val(KeyValue);var queryvals=KeyValue.split(",");for(var i=0;i<queryvals.length;i++){if($("form input[name="+key+"][value="+queryvals[i]+"]:checkbox").length)$("form input[name="+key+"][value="+queryvals[i]+
"]:checkbox").attr("checked",true);if($("form input[name="+key+"][value="+queryvals[i]+"]:radio").length)$("form input[name="+key+"][value="+queryvals[i]+"]:radio").attr("checked",true)}}}
$(document).ready(function(){$(".Note").each(function(){$(this).html($(this).html().replace(/\&amp;apos/gi,"&#39;"))});$(".ResetForm").click(function(){$("form").find(":input").each(function(){switch(this.type){case "password":case "select-multiple":case "select-one":case "text":case "textarea":$(this).val("");break;case "checkbox":case "radio":this.checked=false}})});$(".Submit").click(function(){$(this).parents("form").submit()})});
function ToggleDisplay(x){var item=document.getElementById(x);if(item.style.display=="none")item.style.display="";else item.style.display="none"}function Togglevisible(x,visible){var item=document.getElementById(x);item.style.display=visible}function ClearTextBox(x){var item=document.getElementById(x);item.value=""}function ShowAddNote(selectionref){if($("#spanaddnote"+selectionref).val()!=undefined)ToggleDisplay("spanaddnote"+selectionref)}
function GetDirections(from,to){window.location="Default.aspx?from="+from+"&to="+to}
function GetDistance(from,to){var map;var directions="from: "+from+" to: "+to;var gDir=new GDirections;var directionsPanel;map=new GMap2(document.getElementById("_ctl0__ctl0_MainContentPlaceholder_MainContentPlaceholder_GoogleMap1"));directionsPanel=document.getElementById("route");directions=new GDirections(map,directionsPanel);directions.load(directions);distance=directions.getDistance(directions);alert("value :"+distance)}
function OpenContext(Button,ContextMenu,ClearBox,Display,ManageUrl,SaveUrl,Ref,RefVal){$(Button).contextMenu(Button,{menu:ContextMenu},function(action,el,pos){if(action.match(/AddNote/ig)=="AddNote"){ClearTextBox(ClearBox);ToggleDisplay(Display)}if(action.match(/Manage/ig)=="Manage")window.location=ManageUrl;if(action.match(/Remove/ig)=="Remove")PageMethod(SaveUrl,"Remove",[Ref,RefVal])})}
function UpdateContextMenuCss(){$(".contextMenu").each(function(){if($(this).css("display")!="none"){var button="#buOptionsfi"+$(this).attr("id").substring(8,9);var pos=$(button).position();var width=$(this).width();$(this).css({"position":"absolute",left:pos.left-width-5,top:pos.top})}})}
if(jQuery)(function(){$.extend($.fn,{contextMenu:function(Button,o,callback){if(o.isContextMenu==undefined)o.isContextMenu=true;if(o.menu==undefined)return false;if(o.inSpeed==undefined)o.inSpeed=50;if(o.outSpeed==undefined)o.outSpeed=25;if(o.inSpeed==0)o.inSpeed=-1;if(o.outSpeed==0)o.outSpeed=-1;$(this).each(function(e){var el=$(this);var offset=$(el).offset();$("#"+o.menu).addClass("contextMenu");var evt=e;var srcElement=$(this);$(this).unbind("mouseout");var buttonID=1;if(o.isContextMenu)buttonID=
2;else buttonID=0;if(evt.button!=buttonID){$(".contextMenu").hide();var menu=$("#"+o.menu);if($(el).hasClass("disabled"))return false;var d={},x,y;if(self.innerHeight){d.pageYOffset=self.pageYOffset;d.pageXOffset=self.pageXOffset;d.innerHeight=self.innerHeight;d.innerWidth=self.innerWidth}else if(document.documentElement&&document.documentElement.clientHeight){d.pageYOffset=document.documentElement.scrollTop;d.pageXOffset=document.documentElement.scrollLeft;d.innerHeight=document.documentElement.clientHeight;
d.innerWidth=document.documentElement.clientWidth}else if(document.body){d.pageYOffset=document.body.scrollTop;d.pageXOffset=document.body.scrollLeft;d.innerHeight=document.body.clientHeight;d.innerWidth=document.body.clientWidth}e.pageX?x=e.pageX:x=e.clientX+d.scrollLeft;e.pageY?y=e.pageY:y=e.clientY+d.scrollTop;var pos=$(Button).position();var width=$("#"+o.menu).width();$(document).unbind("click");$(menu).css({top:pos.top,left:pos.left-width-5}).fadeIn(o.inSpeed);$(menu).find("A").mouseover(function(){$(menu).find("LI.hover").removeClass("hover");
$(this).parent().addClass("hover")}).mouseout(function(){$(menu).find("LI.hover").removeClass("hover")});$(document).keypress(function(e){switch(e.keyCode){case 38:if($(menu).find("LI.hover").size()==0)$(menu).find("LI:last").addClass("hover");else{$(menu).find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover");if($(menu).find("LI.hover").size()==0)$(menu).find("LI:last").addClass("hover")}break;case 40:if($(menu).find("LI.hover").size()==0)$(menu).find("LI:first").addClass("hover");
else{$(menu).find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover");if($(menu).find("LI.hover").size()==0)$(menu).find("LI:first").addClass("hover")}break;case 13:$(menu).find("LI.hover A").trigger("click");break;case 27:$(document).trigger("click");break}});$("#"+o.menu).find("A").unbind("click");$("#"+o.menu).find("LI:not(.disabled) A").click(function(){$(document).unbind("click").unbind("keypress");$(".contextMenu").hide();if(callback)callback($(this).attr("href").substr(1),
$(srcElement),{x:x-offset.left,y:y-offset.top,docX:x,docY:y});return false});setTimeout(function(){$(document).click(function(){$(document).unbind("click").unbind("keypress");$(menu).fadeOut(o.outSpeed);return false})},0)}if($.browser.mozilla)$("#"+o.menu).each(function(){$(this).css({"MozUserSelect":"none"})});else if($.browser.msie)$("#"+o.menu).each(function(){$(this).bind("selectstart.disableTextSelect",function(){return false})});else $("#"+o.menu).each(function(){$(this).bind("mousedown.disableTextSelect",
function(){return false})});$(el).add("UL.contextMenu").bind("contextmenu",function(){return false})});return $(this)},disableContextMenuItems:function(o){if(o==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(o!=undefined){var d=o.split(",");for(var i=0;i<d.length;i++)$(this).find('A[href="'+d[i]+'"]').parent().addClass("disabled")}});return $(this)},enableContextMenuItems:function(o){if(o==undefined){$(this).find("LI.disabled").removeClass("disabled");
return $(this)}$(this).each(function(){if(o!=undefined){var d=o.split(",");for(var i=0;i<d.length;i++)$(this).find('A[href="'+d[i]+'"]').parent().removeClass("disabled")}});return $(this)},disableContextMenu:function(){$(this).each(function(){$(this).addClass("disabled")});return $(this)},enableContextMenu:function(){$(this).each(function(){$(this).removeClass("disabled")});return $(this)},destroyContextMenu:function(){$(this).each(function(){$(this).unbind("mousedown").unbind("mouseup")});return $(this)}})})(jQuery);
function LoginSubmit(event){if(event.keyCode==13)$("#buLogin").click()}function SearchBoxClick(box,hide){hide.addClass("HiddenFeatures");box.focus()}function SearchBoxBlur(box,hide){setTimeout(function(){box.value="";hide.removeClass("HiddenFeatures")},200)}function LoginBoxBlur(box,hide){if(box.value=="")setTimeout(function(){box.value="";hide.removeClass("HiddenFeatures")},200)}
function SearchBoxOnKeyDown(event,box,searchurl){if(event.keyCode==13){var searchterm="";if(box.value)searchterm=box.value;document.location=searchurl+"?s="+escape(searchterm)}}function SearchBoxGo(box,searchurl){var searchterm="";if(box.val()!=null)searchterm=box.val();document.location=searchurl+"?s="+escape(searchterm)}
function TogglePostGrade(x){if(x!="on"){Togglevisible("divYear","");Togglevisible("divPostBar","none");Togglevisible("divPostSol","none")}else{Togglevisible("divYear","none");if($("input[@name='route']:checked").val()=="Solicitor"){Togglevisible("divPostSol","");Togglevisible("divPostBar","none")}else{Togglevisible("divPostBar","");Togglevisible("divPostSol","none")}if($("input[@name='route']:checked").val()=="Don't know yet"){Togglevisible("divPostBar","none");Togglevisible("divPostSol","none")}}}
var result;var MainArea;function FillAreaFromUrl(url,resultarea,TabDiv){Resetstyle();setActivetab(TabDiv);result=document.getElementById(resultarea);MainArea=document.getElementById("MainPage");MainArea.style.display="none";$("#"+resultarea).load(url)}function setActivetab(tab){$("#"+tab).parents("li:first").attr("class","ActiveTab")}
function Resetstyle(){$("#OverViewLinkTab").parents("li:first").attr("class","TabMenuTabs");$("#NewsLinkTab").parents("li:first").attr("class","TabMenuTabs");$("#BurningLinkTab").parents("li:first").attr("class","TabMenuTabs");$("#DiaryLinkTab").parents("li:first").attr("class","TabMenuTabs");$("#DealsLinkTab").parents("li:first").attr("class","TabMenuTabs");$("#FeaturedLawyerLinkTab").parents("li:first").attr("class","TabMenuTabs");$("#LCNFocusTab").parents("li:first").attr("class","TabMenuTabs")}
function OnWebRequestCompleted(executor,eventArgs){if(executor.get_responseAvailable()){var resdata=executor.get_responseData();result.innerHTML=resdata}}if(typeof Sys!=="undefined")Sys.Application.notifyScriptLoaded();function ResetPanelUpdates(){MainArea=document.getElementById("MainPage");MainArea.style.display="";result=document.getElementById("ResultsArea");result.innerHTML="";Resetstyle();setActivetab("OverViewLinkTab")}var popupStatus=0;
function TogglePopup(x){if(popupStatus==0){CenterPopup(x);$(".popupbg").css({"opacity":"0.7"});$(".SearchGo").fadeOut("normal");$(".popupbg").fadeIn("normal");$("#"+x).fadeIn("normal");popupStatus=1}else{$(".popupbg").fadeOut("normal");$("#"+x).fadeOut("normal");$(".popupClearOnClose").hide();$(".SearchGo").fadeIn("normal");popupStatus=0}}function CenterPopup(x){$("#"+x).center();$(".popupbg").css({"height":$(document).height(),"width":$(document).width()})}$(window).resize(function(){if($(".popup").is(":visible"))CenterPopup($(".popup:visible").attr("id"))});
$(window).scroll(function(){if($(".popup").is(":visible"))CenterPopup($(".popup:visible").attr("id"))});
$(document).ready(function(){$(".popupclose, .showpopup").click(function(){TogglePopup()});if($("#RegisterPopup").length>0&&getCookie("LCNRegisteredPopup")==""){var totalNum=2;var ran=Math.random();var rndNum=Math.floor(Math.random()*totalNum);if(window.XMLHttpRequest)$("#imgRegister").attr("src","/images/MyLCN/Register_"+rndNum+".png");else $("#imgRegister").attr("src","/images/MyLCN/Register_"+rndNum+"_ie6.png");TogglePopup("RegisterPopup")}$(".LCNRegisteredPopup").click(function(){if(getCookie("LCNRegisteredPopup")==
"")setCookie("LCNRegisteredPopup","true",30)})});jQuery.fn.center=function(){this.css("position","absolute");this.css("top",($(window).height()-this.height())/2+$(window).scrollTop()+"px");this.css("left",($(window).width()-this.width())/2+$(window).scrollLeft()+"px");return this};
function AddToFavorites(){title=$(document).attr("title");url=document.location.href;if(window.sidebar)window.sidebar.addPanel(title,url,"");else if(window.external)window.external.AddFavorite(url,title);else if(window.opera&&window.print)return true}function ToggleComments(x){$("#rptComments").toggle();if($("#rptComments").is(":visible"))$(x).attr("src","/images/UpArrow_Information.gif");else $(x).attr("src","/images/RightArrow_Information.gif")}
function CenterFooter(){var $screen=jQuery(this);var fullScreen=$screen.width();var centerScreen=fullScreen/2*1;marginLeft=centerScreen-$("#footer").width()/2;$("#footer").css({"margin-left":marginLeft-30})}
function toggleMenu(menu,item){if($("#"+menu).is(":visible")){$("#"+menu).hide();$(item).attr("src","/images/footer/Button_Expand_Down.png")}else{$(".Footer-Item-Menu").hide();$(".Footer-Item-Menu-image").attr("src","/images/footer/Button_Expand_Down.png");$("#"+menu).show();$(item).attr("src","/images/footer/Button_Expand_Up.png")}}
function toggleFooter(item,fade){fade=fade==undefined?1E3:fade;switch(item){case "Minimize":$("#MinFooter").show(0);$("#footer").hide(0);setCookie("FooterMinimized","false",30);break;case "Close":if(confirm("Are you sure you want to remove the MyLC.N footer? You can restore it by clicking Restore MyLC.N")){$("#MinFooter").hide(0);$("#footer").hide(0);setCookie("FooterVisible","false",30);window.location=window.location}break;case "open":$("#MinFooter").hide(0);$("#footer").show(0);setCookie("FooterMinimized",
"true",30);break}}function CanChangeSearch(){var k=$("#tbFooterSearch").val();if(k=="Search whole site"||k=="Find a training contract..."||k=="Find a pupillage..."||k=="Find a course...")return true;else return false}
function ChangeSearch(option){switch(option){case 1:$("#tbFooterSearch").attr("watermark","Search whole site");if(CanChangeSearch())$("#tbFooterSearch").val("Search whole site");$("#tbFooterSearch").attr("SearchUrl","/Search.aspx?s=");$("#FooterSearchText").text("Search");break;case 2:$("#tbFooterSearch").attr("watermark","Find a training contract...");if(CanChangeSearch())$("#tbFooterSearch").val("Find a training contract...");$("#tbFooterSearch").attr("SearchUrl","/Solicitors/Search.aspx?s=");$("#FooterSearchText").text("Solicitors");
break;case 3:$("#tbFooterSearch").attr("watermark","Find a pupillage...");if(CanChangeSearch())$("#tbFooterSearch").val("Find a pupillage...");$("#tbFooterSearch").attr("SearchUrl","/Barristers/Search.aspx?s=");$("#FooterSearchText").text("Barristers");break;case 4:$("#tbFooterSearch").attr("watermark","Find a course...");if(CanChangeSearch())$("#tbFooterSearch").val("Find a course...");$("#tbFooterSearch").attr("SearchUrl","/Courses/Search.aspx?s=");$("#FooterSearchText").text("Courses");break}}
function RecordSearch(SearchTerm,Area){PageMethodWithCallback("/MyLCN/Ajax/Default.aspx","Search",["SearchTerm",SearchTerm,"Area",Area])}function RecordMyLCNSave(){PageMethodWithCallback("/MyLCN/Ajax/Default.aspx","MyLCNSave")}function RecordWeekly(Category){PageMethodWithCallback("/MyLCN/Ajax/Default.aspx","Weekly",["Category",Category])}
$(document).ready(function(){$(".HasToolTip").each(function(index){var k=$(this);if($(k).attr("tooltip")!=null&&$(k).attr("tooltip")!=""){$(k).append("<span class='Tooltip' id='Tooltip"+index+"' style='display:none'>"+$(k).attr("tooltip")+"</span>");$(k).mouseover(function(){if($(".ItemMenu").is(":visible"));else $("#Tooltip"+index).show()});$(k).mouseout(function(){$("#Tooltip"+index).hide()});$(k).click(function(){$("#Tooltip"+index).hide()})}});$(".watermark").each(function(index){$(this).focus(function(){$(this).filter(function(){return $(this).val()==
""||$(this).val()==$(this).attr("watermark")}).removeClass("watermarkOn").val("")});$(this).blur(function(){$(this).filter(function(){return $(this).val()==""}).addClass("watermarkOn").val($(this).attr("watermark"))})});$("#tbFooterSearch").keydown(function(event){if(event.keyCode==13&&$(this).val()!=""){RecordSearch($(this).val(),$("#tbFooterSearch").attr("SearchUrl"));window.location=$("#tbFooterSearch").attr("SearchUrl")+encodeURIComponent($(this).val())}});$("#liGo").click(function(event){if(!CanChangeSearch()){RecordSearch($("#tbFooterSearch").val(),
$("#tbFooterSearch").attr("SearchUrl"));window.location=$("#tbFooterSearch").attr("SearchUrl")+encodeURIComponent($("#tbFooterSearch").val())}});$("#SearchCategories ul  > li").click(function(){ChangeSearch($(this).attr("value"));$(".Footer-Item-Menu").hide();$(".Footer-Search-Inner img").attr("src","/images/footer/Button_Expand_Down.png")});$("#Weekly ul  > li").click(function(){RecordWeekly($(this).text())});UpdatePageFooter();$(".MainLayout").click(function(){$(".Footer-Item-Menu").hide();$(".Footer-Item-Menu-image").attr("src",
"/images/footer/Button_Expand_Down.png")});$(".MainLayout").mousedown(function(){$(".Footer-Item-Menu").hide();$(".Footer-Item-Menu-image").attr("src","/images/footer/Button_Expand_Down.png")})});
