/*@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";//move this line into the page between some conditional comments if using script with CMS that is rewriting URL's. don't forget to wrap script tags around it too.

			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();});//use with jQuery

			window.attachEvent('onload',pngfix);//or use this for normal cases. Or call from your own events.

	@end

@*/



var fcFunctions = {	

	furtherInfo: function(o){

		if($('.further').length){

			//add some links and make them clickable

			$('.further').css('display', 'none');

			$('.further').after('<div class="furtherLink padding"><a href="#" class="more">More details</a></div>');

			$('.furtherLink .more').toggle(

				function(e){

					$(this).parent().prev().slideDown('slow');

					$(this).removeClass('more');

					$(this).addClass('less');

					$(this).text('Less details');

			  		return false;

				},

				function(e){

					$(this).parent().prev().slideUp('slow');

					$(this).removeClass('less');

					$(this).addClass('more');

					$(this).text('More details');

			  		return false;

				});



		}	

	},

	

	questions: function(o){

		if($('.questions').length){

			$('.questions .answer').css('display', 'none');

			$('.questions .question').toggle(

				function(e){

					$(this).next().slideDown('normal');

					$(this).removeClass('more1');

					$(this).addClass('less1');

			  		return false;

				},

				function(e){

					$(this).next().slideUp('normal');

					$(this).removeClass('less1');

					$(this).addClass('more1');

			  		return false;

				});



		}	

	},

	

	tooltip : function(o){

		if ($.browser.safari && $.browser.version < 523) {

   			//do nothing because the jquery tooltip crashes older versions of safari that should be supported

		} else {

			if($('a.helpbutton').length){

				$('a.helpbutton').tooltip({ 

					track: true, 

					delay: 0, 

					showURL: false, 

					showBody: " - ",

					top: -16,

					left: 9,

					fixPNG: true

				});

			}

		}

	},

	

	changeServiceAddress: function(o){

		if($('.changeServiceAddress').length > 0){

			//add some links and make them clickable

			$('.changeServiceAddress').css('display', 'none');

			$('.changeServiceAddress').prev().find('.text').html("<p>Can't see your address?</p><a rel='internal' class='green-arrow'><span>Enter your service address</span></a>");

			$('.changeServiceAddress').prev().find('.text a').click(

				function(e){

					$('.changeServiceAddress').show('slow');

					$(this).parent().html("<p>If one of the addresses listed above is almost right, select it and edit the details below:</p>")

			  		return false;

				});

		}	

	},

	

	changeBillingAddress: function(o){

		if($('.changeBillingAddress').length > 0){

			//add some links and make them clickable

			$('.changeBillingAddress').css('display', 'none');

			$('.changeBillingAddress').prev().find('.text').html("<p>Can't see your address?</p><a rel='internal' class='green-arrow'><span>Enter your billing address</span></a>");

			$('.changeBillingAddress').prev().find('.text a').click(

				function(e){

					$('.changeBillingAddress').show('slow');

					$(this).parent().html("<p>If one of the addresses listed above is almost right, select it and edit the details below:</p>")

			  		return false;

				});

		}	

	},

	tabs: function() {

 	if ($('.quote-box').length) {

 		$('.quote-box').each(function() {

 			var tabContainers = $('div.quote-tab', this);

				$('ul.quote-tab-nav a', this).click(function() {

				tabContainers.hide().filter(this.hash).show();

				$('ul.quote-tab-nav a').removeClass('selected');

				$(this).addClass('selected');

				return false;

 			}).filter(':first').click();

 		});

 	}

 }



};



$(function() {

    fcFunctions.furtherInfo();

	fcFunctions.changeServiceAddress();

	fcFunctions.changeBillingAddress();

	fcFunctions.questions();

	fcFunctions.tooltip();

	fcFunctions.tabs();

	

});
