//including template
jQuery.fn.inc=function(a,b,c,d,e,f){return this.length?this.each(function(){d=$(this);f=function(a){d.html($.isFunction(b)?b(a):a);c&&c()};if($.browser.msie){$("<iframe>").hide().bind("readystatechange",function(){if(/m/.test(this.readyState)){f(this.contentWindow.document.body.innerHTML);$(this).remove()}}).attr("src",a).appendTo(document.body)}else{$.ajax({url:a,complete:function(a,b){/c/.test(b)&&f(a.responseText)}})}}):this}

function getExternal(){
	
$.expr[':'].external = function(obj){
    return !obj.href.match(/^mailto\:/)
            && (obj.hostname != location.hostname);
};

// Add 'external' CSS class to all external links
$('a:external').addClass('external');


} 


function slideLeft()
{
	$('.awsSideNavHeader:last').css('border','none');$('.awsSideNavMenuBody:last').css('border','none');$(".awsSideNavHeader").click(function(){if($(this).next().css('display')=='block'){$(this).toggleClass('active').next().slideUp();}
	if($(this).next().is(':hidden')){$('.awsSideNavHeader').removeClass('active').next().slideUp();$(this).toggleClass('active').next().slideDown();}
	return false;});	
}

if(/\/services\//.test(location.href) &&  !(/fba-jp-video-intro.htm/.test(location.href)))
{
	$('#headerbanner').inc("../includes/header.htm");
	$('.left').inc("../includes/sidebar.htm",null,function(){
					getNewHash();
					slideLeft();			
	});

	$('#Footer').inc("../includes/footer.htm",null,function(){
	
			getExternal();
				$('#amzn_logo a,#jp,#usa').live("click",function () {
							var href = $(this).attr('href');
							
							$(this).attr('href', "../"+href);
				});
					
				$('#Footer a').not(".external").click(function () {
							var href = $(this).attr('href');
							
							$(this).attr('href', "../"+href);
				});
		
			});

}
else if(/\/testimonials\//.test(location.href) || /\/contactus\//.test(location.href) || (/\/services\//.test(location.href) && /fba-jp-video-intro.htm/.test(location.href)))
{
	$('#headerbanner').inc("../includes/header.htm");
	$('.left').inc("../includes/sidebar.htm",null,function(){
					slideLeft();			
	});

	$('#Footer').inc("../includes/footer.htm",null,function(){
	
	getExternal();
	$('#amzn_logo a,#jp,#usa').live("click",function () {
				var href = $(this).attr('href');
				
				$(this).attr('href', "../"+href);
	});
		
	$('#Footer a').not(".external").click(function () {
				var href = $(this).attr('href');
				
				$(this).attr('href', "../"+href);
	});
	
});

}
else if(/stv/.test(location.href))
{
	$('#headerbanner').inc("jp/includes/header.htm");
	$('#Footer').inc("jp/includes/footer.htm",null,function(){
	getExternal();

	$('#amzn_logo a,#jp,#usa').live("click",function () {
				var href = $(this).attr('href');
				
				$(this).attr('href', "jp/"+href);
	});
		
	$('#Footer a').not(".external").click(function () {
				var href = $(this).attr('href');
				
				$(this).attr('href', "jp/"+href);
	});
	
});
	
}
else
{
	$('#headerbanner').inc("includes/header.htm");
	$('.left').inc("includes/sidebar.htm",null,function(){
					slideLeft();getExternal();	
					var links=$('#ASLeftNav').find('a');	
					links.not(".external").click(function(){
						var href = $(this).attr('href');
						$(this).attr('href', "services/"+href);
					});
	});
	$('#Footer').inc("includes/footer.htm",null,function(){
		getNewHash();getExternal();
	});

}

