/*@cc_on 
	@if (@_win32)
	try {document.execCommand('BackgroundImageCache', false, true);}catch(e){}
	@end
//	@if (@_jscript_version >= 5.5 && @_jscript_version <= 5.6)
//			var clear="/images/clear.gif";
//			pngfix=function(){var els=document.getElementsByTagName("*");var ip=/\.png/i;var i=els.length;while(i-->0){var el=els[i];var es=el.style;if(el.src&&el.src.match(ip)&&!es.filter){es.height=el.height;es.width=el.width;es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+el.src+"',sizingMethod='crop')";el.src=clear}else{var elb=el.currentStyle.backgroundImage;if(elb.match(ip)){var path=elb.split('"');var rep=(el.currentStyle.backgroundRepeat=="no-repeat")?"crop":"scale";es.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+path[1]+"',sizingMethod='"+rep+"')";es.height=el.clientHeight+"px";es.backgroundImage="none";var elkids=el.getElementsByTagName("*");if(elkids){var j=elkids.length}}}}};
//			$(function(){pngfix();});
//	@end
@*/


var menus = [];

menus[0]="item1";
menus[1]="item2";
menus[2]="item3";
menus[3]="item4";
menus[4]="item5";
menus[5]="item6";

function showMenu(lyr){
	for(i = Number(0);i < menus.length; i++){
		document.getElementById(menus[i]+"menu").className = "hide"
		document.getElementById(menus[i]+"Link").className = ""
	}
	
	document.getElementById(lyr+"menu").className = "show"
	document.getElementById(lyr+"Link").className = "selected"

}

window.document.onclick=hideMenu;
window.onload=init;

function init(){
	chkPage();
	getRadioList();
	if(rB.length!=0){findRadioDS();}
	getRecipesList();
	if(rL.length!=0){updateRecipeList();}
	fnAttachColorToggle();
	if(document.getElementById("MainFramework_ElertProfile_ctlStoreLogin_txtUserName")){
		document.getElementById("MainFramework_ElertProfile_ctlStoreLogin_txtUserName").focus();
	}
}

var other;
var address;
var done;
var postcode;

function chkPage(){


if(document.getElementById("template-elert")){

	if(document.getElementById("ddTitle")){other = document.getElementById("ddTitle");}
	if(document.getElementById("MainFramework_ElertReg_ctlElertReg_ddTitle")){other = document.getElementById("MainFramework_ElertReg_ctlElertReg_ddTitle");}
	if(document.getElementById("MainFramework_ElertProfile_ctlElertProfile_ddTitle")){other = document.getElementById("MainFramework_ElertProfile_ctlElertProfile_ddTitle");}

	if(document.getElementById("MainFramework_ElertReg_ctlElertReg_ddCountry")){address = document.getElementById("MainFramework_ElertReg_ctlElertReg_ddCountry");}
	if(document.getElementById("MainFramework_ElertProfile_ctlElertProfile_ddCountry")){address = document.getElementById("MainFramework_ElertProfile_ctlElertProfile_ddCountry");}

	if(document.getElementById("MainFramework_ElertReg_ctlElertReg_txtPostcode")){postcode = document.getElementById("MainFramework_ElertReg_ctlElertReg_txtPostcode");}
	if(document.getElementById("MainFramework_ElertProfile_ctlElertProfile_txtPostcode")){postcode = document.getElementById("MainFramework_ElertProfile_ctlElertProfile_txtPostcode");}
	
	
	if(document.getElementById("otherTitle")){
		document.getElementById("otherTitle").style.display = "none";
		showTitle();
	}
	
	if(document.getElementById("field-address") && document.getElementById("field-town") && document.getElementById("field-county")){
		if(done==false){
		document.getElementById("field-postcode").style.display = "block";
		document.getElementById("field-address").style.display = "none";
		document.getElementById("field-town").style.display = "none";
		document.getElementById("field-county").style.display = "none";
		showAddress();
		}
	}		
	
	if(other){other.onchange=showTitle;}
	if(address){address.onchange=showAddress;}
	
	if(document.getElementById("MainFramework_ElertReg_ctlElertReg_txtPostcode")){
		if(document.getElementById("MainFramework_ElertReg_ctlElertReg_txtPostcode").value!=""){
		document.getElementById("MainFramework_ElertReg_ctlElertReg_txtPostcode").focus();
		}
	}

	

	
	
}

if(document.getElementById("template-events-form")){


	if(document.getElementById("otherTitle")){document.getElementById("otherTitle").style.display="none";}
	if(document.getElementById("MainFramework_ConfEventBookStart_ctlConfEventBookStart_ddTitle")){other = document.getElementById("MainFramework_ConfEventBookStart_ctlConfEventBookStart_ddTitle");}
	if(document.getElementById("MainFramework_Donations2_ctlDonations2_ddTitle")){other = document.getElementById("MainFramework_Donations2_ctlDonations2_ddTitle");} /*AT*/
	if(other){other.onchange=showTitle;}

	if(document.getElementById("otherTitle")){
		document.getElementById("otherTitle").style.display = "none";
		showTitle();
	}
	
	errorDiv = document.getElementById("MainFramework_ConfEventBookStart_ctlConfEventBookStart_divError1");
	if(done==true && errorDiv == null){
	document.location.href = document.location.href + "#jump-form"
	}



}

	
}


function searchOptions(opt){

	var searchOpt = new Array();
	searchOpt[0]="chkGuide";
	searchOpt[1]="chkNews";
	searchOpt[2]="chkEvents";
	searchOpt[3]="chkResearch";
	searchOpt[4]="chkProResources";
	searchOpt[5]="chkSharedPractice";
	searchOpt[6]="chkRecipes";
	searchOpt[7]="chkAboutUs";
	searchOpt[8]="chkHowWeHelp";
	searchOpt[9]="chkSupportUs";
	
	var j=0;
	
	if(opt.checked==true){
	document.getElementById("MainFramework_SiteSearch_ctlSiteSearch_chkAllSite").checked=false;
	}
	
	
	//alert(document.getElementById("MainFramework_SiteSearch_ctlSiteSearch_chkAllSite".selected))

		//for(i=0;i<searchOpt.length;i++){
			//if(document.getElementById("MainFramework_SiteSearch_ctlSiteSearch_"+searchOpt[i])){
				//document.getElementById("MainFramework_SiteSearch_ctlSiteSearch_"+searchOpt[i]).checked=true;
			//}
		//}
	
	
	
}

function toggleVisibility(targetControlID, visible){
    if(visible){
		document.getElementById(targetControlID).style.display = "block";
    }
    else{
		document.getElementById(targetControlID).style.display = "none";
    }
}

function showTitle(){
	if(other.options[other.selectedIndex].innerHTML=="Other"){
	    var otherTitleTextBox = document.getElementById("otherTitle");
	    if(otherTitleTextBox != null){otherTitleTextBox.style.display = "block";}
	}
	else{
	    var otherTitleTextBox = document.getElementById("otherTitle");
	    if(otherTitleTextBox != null){otherTitleTextBox.style.display  = "none";}
	}
}

function showAddress(){

	if(address.options[address.selectedIndex].value=="GB" || address.options[address.selectedIndex].value=="NI" || address.options[address.selectedIndex].value=="0"){
		if(done==false){
		document.getElementById("field-address").style.display = "none";
		document.getElementById("field-town").style.display = "none";
		document.getElementById("field-county").style.display = "none";
		}
		document.getElementById("field-postcode").style.display = "block";
		
		if(document.getElementById("MainFramework_ElertReg_ctlElertReg_txtAddress1")){
			document.getElementById("MainFramework_ElertReg_ctlElertReg_txtAddress1").disabled=true;}
		
		if(document.getElementById("MainFramework_ElertReg_ctlElertReg_txtAddress2")){ document.getElementById("MainFramework_ElertReg_ctlElertReg_txtAddress2").disabled=true;}

		
		if(document.getElementById("MainFramework_ElertReg_ctlElertReg_txtAddress3")){ document.getElementById("MainFramework_ElertReg_ctlElertReg_txtAddress3").disabled=true;}

		
		if(document.getElementById("MainFramework_ElertReg_ctlElertReg_txtTown")){ document.getElementById("MainFramework_ElertReg_ctlElertReg_txtTown").disabled=true;}

		
		if(document.getElementById("MainFramework_ElertReg_ctlElertReg_txtCity")){ document.getElementById("MainFramework_ElertReg_ctlElertReg_txtCity").disabled=true;}
	} else {
		document.getElementById("field-postcode").style.display = "none";
		document.getElementById("field-address").style.display = "block";
		document.getElementById("field-town").style.display = "block";
		document.getElementById("field-county").style.display = "block";

		if(document.getElementById("MainFramework_ElertReg_ctlElertReg_txtAddress1")){
			document.getElementById("MainFramework_ElertReg_ctlElertReg_txtAddress1").disabled=false;}
		
		if(document.getElementById("MainFramework_ElertReg_ctlElertReg_txtAddress2")){ document.getElementById("MainFramework_ElertReg_ctlElertReg_txtAddress2").disabled=false;}

		
		if(document.getElementById("MainFramework_ElertReg_ctlElertReg_txtAddress3")){ document.getElementById("MainFramework_ElertReg_ctlElertReg_txtAddress3").disabled=false;}

		
		if(document.getElementById("MainFramework_ElertReg_ctlElertReg_txtTown")){ document.getElementById("MainFramework_ElertReg_ctlElertReg_txtTown").disabled=false;}

		
		if(document.getElementById("MainFramework_ElertReg_ctlElertReg_txtCity")){ document.getElementById("MainFramework_ElertReg_ctlElertReg_txtCity").disabled=false;}
		
	}
}

function hideMenu(lyr){
	for(i=0;i<menus.length;i++){
		if(document.getElementById(menus[i]+"menu")){document.getElementById(menus[i]+"menu").className = "hide";}
		if(document.getElementById(menus[i]+"Link")){document.getElementById(menus[i]+"Link").className = "";}
	}
}

function altShowMenu(lyr){
	for(i=0;i<menus.length;i++){
	if(document.getElementById(menus[i]+"menu")){
	document.getElementById(menus[i]+"menu").className = "hide"
	document.getElementById(menus[i]+"Link").className = ""
	}
	}
	
	if(document.getElementById(lyr+"menu")){
	document.getElementById(lyr+"menu").className = "show"
	document.getElementById(lyr+"Link").className = "selected"
	//document.getElementById(lyr+"Link").parentNode.className+=" test"
	}
	

	hideSel("hide");

}

function showSlowMenu(lyr){

}

function altHideMenu(lyr){
	for(i=0;i<menus.length;i++){
	if(document.getElementById(menus[i]+"menu")){
	document.getElementById(menus[i]+"menu").className = "hide"
	document.getElementById(menus[i]+"Link").className = ""
	}
	}
	
	
	hideSel("show");
	
}

function clearItem(item){
item.value="";
}

function openwin(href){
window.open(href,'help','width=400,height=500,scrollbars=yes');
}

//Hide seelct boxes in IE for the drop down menus
function hideSel(type){
	var IE = navigator.appName.indexOf("Internet Explorer");
	if(IE!=-1){
		var sels = document.getElementsByTagName("select");
		if(type=="hide"){for(i=0;i<sels.length;i++){sels[i].style.visibility="hidden";}}
		else{for(i=0;i<sels.length;i++){sels[i].style.visibility="visible";}}
	}
}

//RECIPES CHECKBOXES
var rL = new Array();
function getRecipesList(){
	var inp = document.getElementsByTagName("input");
	var j = 0;
	for(i=0;i<inp.length;i++){
		if(inp[i].id.indexOf("MainFramework_Recipes_ctlRecipes_chkCats")!=-1){
			rL[j] = inp[i];
			j++;
		}	
	}
	//alert(rL.length)
}

function updateRecipeList(){
	if(document.getElementById(rL[0].id)){
		targ =rL.length;
		targ--;
		for(i=1;i<targ;i++){rL[i].onclick=untickRecipes;}
	}
}

function untickRecipes(){
var test=false;
for(i=0;i<rL.length;i++){
	if(rL[i].checked==true){test=true;}
}
if(test==true){rL[0].checked=false;}
else{rL[0].checked=true;}



//if(this.id!=rL[0].id){if(this.checked==true){}}
}

//DONATIONS clears radio buttons for 'other' input functionality

// DONATIONS SINGLE

function findRadioDS(){
	if(document.getElementById(rB[0].id)){
	targ =rB.length;
		if(document.getElementById("MainFramework_ctl01_ctl00_txtRoundUpOther")){
			for(i=0;i<targ;i++){rB[i].onclick=clearOtherDS;};
			rB[3].onclick=null;
		}
		else{
			targ--;
			for(i=0;i<targ;i++){rB[i].onclick=clearOtherDS;};		
		}
		
	}

	
}

function selectOtherDS(){
	targ =rB.length;
	targ--;
	if(document.getElementById("MainFramework_ctl01_ctl00_txtRoundUpOther") != null){
	    alert('it exists!');
	    targ--;
    	document.getElementById(rB[targ].id).checked=true;
	}
}

function clearOtherDS(){
	if(rB[0].id.indexOf("Single")!=-1){
	    var txtBox = document.getElementById("MainFramework_DonationsSingle1_ctlDonationsSingle1_txtOther");
	    if(txtBox != null){ txtBox.value = ""; }
	}
	if(rB[0].id.indexOf("Regular")!=-1){
	    var txtBox =  document.getElementById("MainFramework_DonationsRegular1_ctlDonationsRegular1_txtOther");
	    if(txtBox != null){ txtBox.value = ""; }
	}
	if(rB[0].id.indexOf("RoundUp")!=-1){
	    var txtBox =  document.getElementById("MainFramework_ctl01_ctl00_txtRoundUpOther");
	    if(txtBox != null){ txtBox.value = ""; }
	}
}

var rB = new Array();
function getRadioList(){
	var inp = document.getElementsByTagName("input");
	var j = 0;
	for(i=0;i<inp.length;i++){
		if(inp[i].id.indexOf("rdoContributionList")!=-1 || inp[i].id.indexOf("rdoRoundUp")!=-1){
			rB[j] = inp[i];
			j++;
		}	
	}
	//alert(rB.length);
}







// RADIO BUTTON TOGGLER

// This script will progressively enhance the forms in the page on which it is embedded
// It will scan forms for fieldsets with the attribute   -   class="container-color-change"
// It attaches an onclick function to any radio buttons inside that fieldset
// Selecting the button, either directly or by its label, will colour in its container and blank the others
// For this to be meaningful, each radio button should be in its own containing element
// This ideally would  be a DIV containing the button and its label
// You can change the selected and unselected colours in the variables below


//define global variables
var arFieldsetsToggling = new Array();
var COLORselected = "#F7F7F7";
var COLORunselected = "#FFF";

//window.onload = fnAttachColorToggle;

//cycle through page links and check class
function fnAttachColorToggle() {
	if(!document.getElementsByTagName) return false;
	var arFieldsets = document.getElementsByTagName("fieldset");

	for (i=0, j=arFieldsets.length; i<j; i++) {

		//if tagged with colorToggle then add it to an array of toggleable elements
		if ((arFieldsets[i].getAttribute("class") == "container-color-change") || (arFieldsets[i].getAttribute("className") == "container-color-change")) {
			arFieldsetsToggling[arFieldsetsToggling.length] = arFieldsets[i];

			//scan for input elements
			var arRadioButtons = arFieldsets[i].getElementsByTagName("input");
			for (ii=0, jj=arRadioButtons.length; ii<jj; ii++) {

				//scan for radio buttons
				if (arRadioButtons[ii].getAttribute("type") == "radio") {

					// colours in the background of the the selected radio button
					if (arRadioButtons[ii].checked) {
						arRadioButtons[ii].parentNode.style.backgroundColor = COLORselected;
					} else {
						arRadioButtons[ii].parentNode.style.backgroundColor = COLORunselected;
					}
					
					arRadioButtons[ii].onclick = function() {

					//cycle up through the parents until the containing fieldset is reach again
					var elFieldset = this.parentNode;

					if (elFieldset.getAttribute("className")) {
						while ((elFieldset.getAttribute("className") == null) || (elFieldset.getAttribute("className") != "container-color-change")) {
							elFieldset = elFieldset.parentNode;
						} //while
					} else {
						while ((elFieldset.getAttribute("class") == null) || (elFieldset.getAttribute("class") != "container-color-change")) {
							elFieldset = elFieldset.parentNode;
						} //while
					} //if

					//turn off the background colours of the other radio button elements

					//scan for input elements
					var arLocalRadioButtons = elFieldset.getElementsByTagName("input");
					for (iii=0, jjj=arLocalRadioButtons.length; iii<jjj; iii++) {

						//scan for radio buttons
						if (arLocalRadioButtons[iii].getAttribute("type") == "radio") {
							arLocalRadioButtons[iii].parentNode.style.backgroundColor = COLORunselected;
						} //if
					} //for
						this.parentNode.style.backgroundColor = COLORselected;
					} //if
				} //if
			} //for
		} //if
	} //for
} //fnAttachColorToggle


function ClearAllControls() 
{
    for (i=0; i<document.forms[0].length; i++)
    {
        doc = document.forms[0].elements[i];
        switch (doc.type) 
        {
          case "text" :
                doc.value = "";
                break;
          case "checkbox" :
                doc.checked = false;
                break;    
          case "radio" :
                doc.checked = false;
                break;                
          case "select-one" :
                doc.options[doc.selectedIndex].selected = false;
                break;                      
          case "select-multiple" :
                while (doc.selectedIndex != -1) 
                {
                  indx = doc.selectedIndex;
                  doc.options[indx].selected = false;
                }
                doc.selected = false;
                break;
          default :
                break;
        }
    }
}

FC = {
	vars : {
		selectors :{
			custom : '.custom',
			reveal : '.reveal',
			customSubmit : '#customSubmit',
			allColours : '.all-colours',
			selectedColour : '.all-colours .selected',
			allLabels : '.all-colours label',
			allRadios : '.all-colours input',
			home : '.home',
			buttons : '.buttons',
			form : '.custom',
			bookmarkPanel : '.bookmark-panel',
			calendarHolder : '.mbr .calendar-holder',
			calendar : '.mbr .calendar',
			helpLink : '.help-link',
			helpText : '.help-text'
		},
		elements : {
			originalForm : null,
			firstInput : null
		},
		strings : {
			js : 'js',
			selected : 'selected',
			magenta : 'magenta',
			indigo : 'indigo',
			teal : 'teal',
			purple : 'purple',
			grey : 'grey'
		},
		bools : {
			isChanged : {},
			isRadio : null
		},
		jQ : {
			allLabels : null,
			allRadios : null
		},
		settings : {
			colour : null
		},
		bookmarks : {
			bookmarksPage : '/Membership-Homepage/My-Account/Bookmarks/'
			//bookmarksPage : 'bookmarks.html'
		}
	},
	
	setCustomPage : function () {
		var __input;
		
		FC.vars.settings.colour = $(FC.vars.selectors.home)[0].className.split(' ')[1];
		$(FC.vars.selectors.allColours + " input").each(function () {
			__$input = $(this);
			
			// this gets the currently selected label to store it for checking against changed labels in checkChanged 
			if (__$input.val() == FC.vars.settings.colour) {
				__$input.siblings('label').addClass('selected');
				FC.vars.elements.firstInput = this;
			} else {
				__$input.siblings('label').removeClass('selected');
			}
		});
		$(FC.vars.selectors.buttons).show();
		$(FC.vars.selectors.reveal).hide();
		FC.vars.jQ.allLabels = $(FC.vars.selectors.allLabels);
		FC.vars.jQ.allRadios = $(FC.vars.selectors.allRadios);
	},
	
	setEvents: function () {
		$(FC.vars.selectors.customSubmit).click(function (e) {
			$(FC.vars.selectors.reveal).slideToggle();
			return false;
		});
		
		$('input, select', FC.vars.selectors.form).change(FC.formElementClickHandler);
		
		FC.vars.jQ.allRadios.click(function (e) {
			FC.vars.jQ.allLabels.removeClass(FC.vars.strings.selected);
			$(this).siblings('label').addClass(FC.vars.strings.selected);
			$(FC.vars.selectors.home)[0].className = "home "+ this.value +" clear"
		})
	},
	
	checkChange : function(o, typ, str){ // receives a unique identifier (ie: an id) and an Object literal
		if (typ == 'checkbox'){
			(o[str]) ? delete o[str] : o[str] = true;
		}
		
		// check for checkbox children within the Object
		// if empty, return false
		for (var __i in o) if (o.hasOwnProperty(__i)) {
			return true
		}
		
		return false;
	},
	
	formElementClickHandler : function (e) {
		var __type = e.target.type, __id = e.target.id, __isFirstRadio = false;
		
		if (FC.vars.elements.firstInput.id == __id) {
			__isFirstRadio = true;
			FC.vars.bools.isRadio = null;
		} else if (__type == 'radio'){
			FC.vars.bools.isRadio = true;
		}
		
		if (!FC.vars.bools.isRadio) {
			__isFirstRadio = true;
		}
		
		if (!FC.checkChange(FC.vars.bools.isChanged, __type, __id) && __isFirstRadio) { // if 'false' rec'd and isFirstRadio then form is as loaded
			$('#saveSubmit').parents('.btn').addClass('off');
		} else {
			$('#saveSubmit').parents('.btn').removeClass('off');
		}
	},
	
	showChildren : function (el) {
		var __str = "";
	
		for (var __j in el){
			__str += __j +" = "+ el[__j] + ", "
		}
	
		alert(__str);
	},
	
	animCalendar : function (e) {

		if($('.calendar-holder').length){
			var holderWidth = ($(FC.vars.selectors.calendar).find('li').length - $(FC.vars.selectors.calendar).find('li li').length) * 171;
			
			//change some styles
			$(FC.vars.selectors.calendarHolder).css('position', 'relative').css('width', 161).css('overflow', 'hidden').css('height', 144);
			$(FC.vars.selectors.calendar).css('position', 'absolute').css('top', 0).css('left', 0).css('width', holderWidth);
			$('.mbr .calendar li:not(.mbr .calendar li li)').css('margin', '0 10px 10px 0');
			
			//add some links and make them clickable
			$(FC.vars.selectors.calendar).find('.year:not(:first)').prepend('<a href="#" class="prev">prev</a>');
			$(FC.vars.selectors.calendar).find('.year:not(:last)').append('<a href="#" class="next">next</a>');
			
			$(FC.vars.selectors.calendar).find('.year .next').bind('click', function(e){
				$(FC.vars.selectors.calendar).animate({left:"-=171px"}, 600);
				return false;
				});
			
			$(FC.vars.selectors.calendar).find('.year .prev').bind('click', function(e){
				$(FC.vars.selectors.calendar).animate({left:"+=171px"}, 600);
				return false;
				});
			
		}
		
		var getYear= function() {
			var url= document.location.href;
			var length= url.length;
			var position= url.indexOf('year=');
			var year= url.substring(position+5,length);
			year= parseInt(year)
			var firstYear= $(FC.vars.selectors.calendar).find('li:first-child').find('.year span').text();
			firstYear= parseInt(firstYear);
			var dif= year - firstYear;
			
			if(dif == 1) {
				$(FC.vars.selectors.calendar).css('left','-171px');
			}
			
			else if(dif == 2) {
				$(FC.vars.selectors.calendar).css('left','-342px');
			}
		}();
	},
	
	bookmarkPanel : function (e) {
		if($('.bookmark-btn').length){
			$(FC.vars.selectors.bookmarkPanel).css('padding', '1px').hide();
			/*$.ajax({
				type: "get",
				url: FC.vars.bookmarks.bookmarksPage,
				dataType: "html",
				success: function(bookmarksData){
					var total_text = $($(bookmarksData).find('.bookmarks li')).length;
					
					$('.bookmark-btn.right:first').removeClass('right');
					$('.bookmark-btn .bookmarks').html('View bookmarks (' + total_text + ')').attr('href', '#');
					$('<div></div>').attr('class', 'bookmark-panel-header').appendTo(FC.vars.selectors.bookmarkPanel)
					.append($('<h2></h2>').html('Bookmarks (' + total_text + ')'))
					.append($('<a></a>').html('close panel').attr('class', 'close-panel').attr('href', '#'));
					$('<div></div>').attr('class', 'padding bookmark-content').appendTo(FC.vars.selectors.bookmarkPanel);
					$('.bookmark-btn.right:last').removeClass().addClass('btn').remove().appendTo($('<div></div>').attr('class', 'padding clear').appendTo(FC.vars.selectors.bookmarkPanel));
					
					$($(bookmarksData).find('.bookmarks li')).each(function(){
						var title_text = $(this).find('h2 a').text();
						var url_text = $(this).find('h2 a').attr('href');
                        var date_text = $(this).find('p').text();
						$('<div></div>').attr('class', 'bookmark-info').appendTo('.bookmark-panel .bookmark-content')
						.append($('<h3></h3>').append($('<a></a>').html(title_text).attr('href', url_text)))
						.append($('<p></p>').html(' - ' + date_text).attr('class', 'date'))
                     });
					$('<a></a>').html('View all bookmarks').attr('href', FC.vars.bookmarks.bookmarksPage).appendTo($(FC.vars.selectors.bookmarkPanel).find('.bookmark-content'));
				},
				complete: function (e){
					$('#breadcrumb .bookmarks').bind('click', function(e){
						$(FC.vars.selectors.bookmarkPanel).slideToggle();
						return false;
					});
					$('.bookmark-panel-header a').bind('click', function(e){
						$(FC.vars.selectors.bookmarkPanel).slideToggle();
						return false;
					});
				}
			});*/


					$('#breadcrumb .bookmarks').bind('click', function(e){
						$(FC.vars.selectors.bookmarkPanel).slideToggle();
						return false;
					});
					$('.bookmark-panel-header a').bind('click', function(e){
						$(FC.vars.selectors.bookmarkPanel).slideToggle();
						return false;
					});

		}
	},
	
	donationMethods: function(){
		FC.donationReveal();
		$('input').bind('focus click', function(){
			FC.donationReveal();
		});
		$('.amount').find('input').bind('focus', function(){
			$(this).parents('.radios').find('input').attr('checked', 'checked');
		});
	},
	
	donationReveal: function(){
		$('.directDebit input').attr('checked') ? $('.paymentSH').css('display', 'block') : $('.paymentSH').css('display', 'none');
		$('.directDebit input').attr('checked') && $('.radMonthly input').attr('checked') ? $('.donation-amount.monthly').css('display', 'block') : $('.donation-amount.monthly').css('display', 'none');
		$('.creditCard input').attr('checked') || ($('.directDebit input').attr('checked') && $('.radAnnually input').attr('checked')) ? $('.donation-amount.annually').css('display', 'block') : $('.donation-amount.annually').css('display', 'none');

	},
	
	publicationsMethod : function(){
		$('.panel-subscriptions p').hide();
		$('p.balance-mag').show();
		
		$('ul.mag-subs li label').bind('mouseover focus', function(){	
			$('.panel-subscriptions p').hide();
			var myClass = 'p.' + $(this).siblings('input').attr('class');
			$(myClass).show();
		});
		
		$('ul.mag-subs li input').bind('mouseover focus', function(){	
			$('.panel-subscriptions p').hide();
			var myClass = 'p.' + $(this).attr('class');
			$(myClass).show();
		});	
	},
	
	
	
	helpLinks : function (e) {
		$(FC.vars.selectors.helpText).css('display', 'none');
		$(FC.vars.selectors.helpLink).each( function(e){									 
			$(this).wrap($('<span></span>').addClass('help-holder'));
			if($(this).hasClass('inline-help')){
				$(this).parents('.help-holder').addClass('inline-help');
			};
			var helpClass = $(this).attr('href').split('#');
			$(this).after($('<div></div').addClass('help-tip').css('display', 'none').append($('<div></div>').addClass('padding').html($('#'+helpClass[1]).html()).append($('<a></a>').html('close').attr('href', '#').addClass('close').bind('click', function(e){
				$(this).parents('.help-tip').toggle();
				return false;
				}))));
		});
		$(FC.vars.selectors.helpLink).bind('click', function(e){
			$(this).next('.help-tip').toggle();
			return false;
		});
		
	}
			
};

//$(function(){
//   
//	$('body').addClass(FC.vars.strings.js);
//	
//	if ($(FC.vars.selectors.custom).length) {
//		$('#saveSubmit').parents('.btn').addClass('off');
//		FC.setCustomPage();
//		FC.setEvents();
//		
//	};
//	if ($('.calendar').length) {
//		FC.animCalendar();
//	};
//	if ($('.bookmark-panel').length) {
//		FC.bookmarkPanel();
//	};
//	if ($('.help-link').length) {
//		FC.helpLinks();
//	};
//	
//	if($(".donation-method").length){
//		FC.donationMethods();
//	};
//	if($(".panel-subscriptions").length){
//		FC.publicationsMethod();
//	};
//});