	var PortfolioImages = new Array();	
	$(document).ready(function() {
    // Resize new div
	$(".NavBtn img").each(
	function(){ if ($(this).attr("src") == "../images/2011/images/navigation_02.gif") { var newdiv = $(this).parent().parent(); newdiv.css("width","75px");} }
	);
	
	$("#LeftCentre").empty().append($("#WhatWeDo").html());
	$("#RightCentre").empty().append($("#Portfolio").html());
	$("#Portfolio").empty();
	// Get element in unordered list
	$( "#weblist li" ).each(function(index) {
    PortfolioImages[index] = $(this).html();
	$("#ImagesCount").val(PortfolioImages.length);
	//alert($(this).html());
	 });
	 $("#weblist").empty().append('<div id="test0">'+PortfolioImages[0]+'</div>');
	$("#leftnav").click(function() {
	ScrollImages('back');
	ChangeDesignText();
	PortfolioChanger();
	});
	$("#rightnav").click(function() {
	ScrollImages('forward');
	ChangeDesignText();
	PortfolioChanger();
	});
	var EmailLink = $("#BaseContact").html().replace(' (AT) ','@');
	$("#BaseContact").empty().append('<a style="color@#fff;" href="mailto:'+EmailLink+ '">'+EmailLink+'</a>');
	
  });
  
  function PortfolioChanger()
  {
  var PortfoImg = $("#test0 img").attr("src");
	//console.log();
	if (PortfoImg.indexOf("-sww-") != -1) {PortfolioHighlighter('Studio William Welch');}
	if (PortfoImg.indexOf("smokehouse") != -1) {PortfolioHighlighter('Smokehouse');}
	if (PortfoImg.indexOf("lots") != -1) {PortfolioHighlighter('Lots');}
	if (PortfoImg.indexOf("taste") != -1) {PortfolioHighlighter('Taste');}
	if (PortfoImg.indexOf("skin") != -1) {PortfolioHighlighter('Skin');}
	if (PortfoImg.indexOf("f4l-car") != -1) {PortfolioHighlighter('Fitness4less');}
	if (PortfoImg.indexOf("delgado") != -1) {PortfolioHighlighter('Delgado');}
	if (PortfoImg.indexOf("topnotch") != -1) {PortfolioHighlighter('Topnotch');}
  }
  
  function ChangeDesignText() {
   var src = $("#test0 img").attr("src");
   
   //alert(src +" " + src.indexOf("acesmall") );
   switch (src) {
    case "../images/hartswoodsmall.jpg": $("#DesignInfo").empty().append($("#Hartswood").html());break;
	case "../images/topnotchbeermat.png": $("#DesignInfo").empty().append("<h3>Topnotch Health Clubs</h3>The company required a double sided beer mat design to be used as part of an marketing campaign in central London.");	break;
	case "../images/acesmall.jpg": $("#DesignInfo").empty().append($("#AceSec").html());break;
	case "../images/data_capture_flyer-small.jpg": $("#DesignInfo").empty().append($("#TopDataCap").html());break;
	}
  }
  function PortfolioHighlighter(cpm)
  {
   $("ul#ClientList li").each(function(ind) {
   if (ind > 9) {
   return false;
   }
   $(this).removeClass("Highlighted");
   if ($(this).html().indexOf(cpm) != -1) {
   $(this).addClass("Highlighted");
   console.log(ind +" => " +$(this).html());
   }
   
   });
  }
  function ScrollImages(direction)
  {
	var ImgIndx = $("#ImageID").val();
	var CurrentDiv = 'test'+ImgIndx;
	if (direction === 'forward') {
	ImgIndx++;
	//$("#"+CurrentDiv+" img").hide();
		} else {
	ImgIndx--;
	}
	if (ImgIndx >= PortfolioImages.length) {
		ImgIndx = 0;
	} else if  (ImgIndx < 0) {
		ImgIndx = PortfolioImages.length-1;
	}
	
	$("#weblist").empty().append('<div id="test0">'+PortfolioImages[ImgIndx]+'</div>');
	$("#ImageID").val(ImgIndx);
	//alert($("#ImageID").val() + " " + direction + " " + ImgIndx);
  }
		//$(function(){        $("div.weblist").carousel();     });
