$(document).ready(function() {
function filterPath(string) {
    return string
      .replace(/^\//,'')  
      .replace(/(index|default).[a-zA-Z]{3,4}$/,'')  
      .replace(/\/$/,'');
  }
$('a[href*=#]').each(function scroll() {
    if ( filterPath(location.pathname) == filterPath(this.pathname)
    && location.hostname == this.hostname
    && this.hash.replace(/#/,'') ) {
      var $targetId = $(this.hash), $targetAnchor = $('[name=' + this.hash.slice(1) +']');
      var $target = $targetId.length ? $targetId : $targetAnchor.length ? $targetAnchor : false;
       if ($target) {
         var targetOffset = $target.offset().top;
         $(this).click(function() {
           $('html, body').animate({scrollTop: targetOffset}, 600);
           return false;
         });
      }
    }
  });
});
/*$(document).ready(function(){
    $('img').bind("contextmenu",function(e){
        return false;
    });
});*/
 
$(function() {
	var pass="process_a";
	var last="process_a";
    $('#processes a').click(function() {
	if($(this).attr('id')!==pass){
		pass=$(this).attr('id');
		var sheet=$('body').attr('id')+".xml";
		
		$('#'+pass).addClass('selected');
		$.ajax({
         type: "GET",
         url: "/assets/"+sheet,
         dataType: "xml",
         success: function(xml) {
             $(xml).find('content[id='+pass+']').each(function(){
            	 var header_content= $(this).find('header').text();
                 var fill_content = $(this).find('body').text();
                 if($(this).find('features')){
                     var features_content = $(this).find('features').text();
                     //alert(features_content);
                 }
                 if($(this).find('img')){
                    var img_content = $(this).find('img').text();
                     //alert(img_content);
                 }
                $('#content_primary h2')
                	.empty()
					.append(header_content)
					.hide()
					.fadeIn('fast');
				$('#ajax_update')
					.empty()
					.append(fill_content)
					.hide()
					.fadeIn('fast');
                 $('#features_update')
					.empty()
					.append(features_content)
					.hide()
					.fadeIn('fast');
                 $('img#img_update')
                    .attr("src",img_content);
                 //alert(img_content);
             }); //close each(
             if(last!=='' || last=='process_a'){
            	 $('#'+last).removeClass('selected');
             }
             last=pass;
             
		}//close xml finder function
     }); //close $.ajax(
	}//close if(
 }); //close click(
 }); //close $(
 
