function start_script(auto_start, random){

	// Home page slideshow
	var homeSlideDelay = 6000;
	homeSlide = function(){
								 
		if ( $(".activeHomeSlide").length==0 ) {
			$("#home .mainArea ul li:first").next().addClass('activeHomeSlide');
		}
		
		$activeHomeSlide = $(".activeHomeSlide");
		$("#home .mainArea").scrollTo( $activeHomeSlide, 300, {offset:-10});	
		
		if ( $(".activeHomeSlide").hasClass('cloneHomeSlide') ) {
			$("#home .mainArea").scrollTo( $("#home .mainArea ul li:first"), 0, {offset:-10});
			$activeHomeSlide = $("#home .mainArea ul li:first");
		}	
		
		$("#home .mainArea ul li").removeClass('activeHomeSlide');
		$activeHomeSlide.next().addClass('activeHomeSlide');

	}
	
	
	if ( $("#home .mainArea").length>0 ) {
		
		// add dummy item
		var $clone = $("#home .mainArea ul li:first").clone();
		$clone.addClass('cloneHomeSlide').attr('id', '');
		$("#home .mainArea ul").append($clone);
		
		// Home page auto adjust width of ul for slider
		var w = $("#home .mainArea ul li").length * 935;
		$("#home .mainArea ul").width(w);
		
		
		// set random active state
		if (random){
			$activeHomeSlide = $("#home .mainArea ul li").eq( Math.floor(Math.random()*$("#home .mainArea ul li").length) );
			$activeHomeSlide.addClass('activeHomeSlide');
			$("#home .mainArea").scrollTo( $activeHomeSlide, 0, {offset:-10});
		}
		
		// start the slide
		if(auto_start){
			var x = setInterval('homeSlide();', homeSlideDelay);	
		}
	}

	// home next slider
	$(".btnHomeNext").click(function(){		
		clearInterval(x);
		homeSlide();
		
		if(auto_start){
			x = setInterval('homeSlide();', homeSlideDelay);
		}
		return false;
	});
	
	$("#home .projectCaption a").click(function(){
		clearInterval(x);
		project_target = $(this).attr('href');
		
		$("#home .mainArea").scrollTo( $(project_target), 300, {offset:-10});
		$("#home .mainArea ul li").removeClass('activeHomeSlide');
		$(project_target).addClass('activeHomeSlide');
		
		if(auto_start){
			x = setInterval('homeSlide();', homeSlideDelay);
		}
		return false;
	});
}


$(document).ready(function(){

	// Cufon text replacement
	Cufon.replace('#nav, .contentHeader h2, .contentHeader h3, .expertiseDescription h3, .expertiseSubPage .subContentNav, .vml, #filePortalBreadcrumbs h2, #home .spotlight li.last div, #home .spotlight li.twitter div');

	// preload images
	$.preloadCssImages();

	// nav pull down
	$("#nav li").hover(
		function(){
			var subnav = $(this).children().eq(2);
			if (subnav.length>0) {

				$(this).children().eq(0).addClass('active');
				subnav.after('<div id="shadow"><div class="inner"></div></div>');
				var h = subnav.height();

				subnav
					.show()
					.css('opacity',0);

				$("#shadow")
					.css({
						height: 0,
						opacity: 0
					})
					.animate({
						height: h,
						opacity: 0.53
					}, 'fast');

				subnav.animate({
						opacity: 1
					}, 300);
				$("#shadow .inner").height(h-3);
			}
		},
		function() {
			var subnav = $(this).children().eq(2);
			if (subnav.length>0) {
				$(this).children().eq(0).removeClass('active');
				subnav.hide();
				$("#shadow").remove();

			}
		}
	);




	// Client hover
	$("#workClient .mainArea li").hover(
		function(){
			var $this = $(this);
			var url = $this.children().eq(0).attr('href');
			if (url!=undefined && url!='') {
				$this.append('<div id="clientHover"></div>');
				$("#clientHover")
					.css('opacity',0)
					.animate({
						opacity: .6
					}, 'slow');
				$("#clientHover").prev().fadeIn('slow');
			} else {
				$this.css('cursor','default');
			}
		},
		function(){
			$("#clientHover").prev().fadeOut('slow');
			$("#clientHover").remove();
		}
	);
	// click event
	$("#clientHover").live('click', function(){
		// get url
		var url = $(this).prev().prev().attr('href');
		if (url!=undefined) {
			window.location = url;
		}
	});


	// Featured work landing page
	if ($("#projectCarouselWrap li").length>0) {
		$("#projectCarouselWrap li").css('opacity',1);
	}
	$("#projectCarouselWrap li").hover(
		function(){
			$(this).stop().animate({
				opacity: 1
			}, 'slow');

			$(this).children().eq(1)
				.css({
					bottom: '-36px',
					opacity: 0
				})
				.show()
				.stop()
				.animate({
					bottom: '5px',
					opacity: .95
				}, 'fast');
		},
		function(){
			$(this).stop().animate({
				opacity: 1
			}, 'slow');

			$(this).children().eq(1)
				.stop()
				.animate({
					bottom: '-36px',
					opacity: 0
				}, 'fast');
		}
	);
	
	if ( $("#projectCarouselWrap").length>0 ) {
		$("#projectCarouselWrap .wrapBox").width( ($(".projectCarousel").length + 3) * $("#projectCarouselWrap").width());
		
		// make a clone
		var first_item = $(".projectCarousel:last").clone();
		var last_item = $(".projectCarousel:first").clone();
		
		// add some marker
		first_item.addClass('firstItem');
		last_item.addClass('lastItem');
		
		// set active state
		$(".projectCarousel:first").addClass('active');
		
		// insert clones
		$("#projectCarouselWrap .wrapBox").prepend(first_item);
		$("#projectCarouselWrap .wrapBox").append(last_item);
		
		// set initial view (to active item)
		var $pcActive = $(".projectCarousel.active");
		$("#projectCarouselWrap").scrollTo( $pcActive, 0);
		
		// move next
		$("#projectCarouselNext").click(function(){
			$pcActive = $pcActive.next();
			$(".projectCarousel.active").removeClass('active');
			$pcActive.addClass('active');
			
			$("#projectCarouselWrap").scrollTo( $pcActive, 300, 
				function(){ 
					if ( $pcActive.hasClass('lastItem') ) {
						$pcActive = $(".projectCarousel").eq(1);
						$("#projectCarouselWrap").scrollTo( $pcActive, 0);
						$(".projectCarousel.active").removeClass('active');
						$pcActive.addClass('active');						
					}
				 });

			return false;
		});
		
		// move previous
		$("#projectCarouselPrev").click(function(){
			$pcActive = $pcActive.prev();
			$(".projectCarousel.active").removeClass('active');
			$pcActive.addClass('active');
			
			$("#projectCarouselWrap").scrollTo( $pcActive, 300, 
				function(){ 
					if ( $pcActive.hasClass('firstItem') ) {
						$pcActive = last_item.prev();
						$("#projectCarouselWrap").scrollTo( $pcActive, 0);
						$(".projectCarousel.active").removeClass('active');
						$pcActive.addClass('active');						
					}
				 });

			return false;
		});
	}


	// Featured work page details
	if ( $("#workFeaturedProject .productThumbs li a").length>0 ) {
		var total_thumbs = $("#workFeaturedProject .slideshow li").length;

		$("#workFeaturedProject .productThumbs li a").css('opacity', .5);
		$("#workFeaturedProject .productThumbs li a.active").css('opacity', 1);

		// adjust ul width
		$($("#workFeaturedProject .slideshow ul")).width(total_thumbs*631);

	}
	$("#workFeaturedProject .productThumbs li a")
		.hover(
			function() {
				var $this = $(this);

				if ($this.hasClass('active')==false) {
					 $this.animate({
						opacity: 1
					}, 300);
				}

			},
			function() {
				var $this = $(this);
				if ($this.hasClass('active')==false) {
					 $this.animate({
						opacity: .5
					}, 300);
				}
			}
		)
		.click(function() {
			var $this = $(this);
			var li = $this.attr('href');
			$("#workFeaturedProject .productThumbs li a")
				.removeClass('active')
				.css('opacity', .5);

			$this.addClass('active').css('opacity', 1);

			// change caption
			var title = $this.attr('title');
			if (title!='') {
				$("#workFeaturedProject .productFull p").html(title);
			}

			$("#workFeaturedProject .slideshow").scrollTo(li, 200);
			return false;
		}
	);

	// move previous
	$("#workFeaturedProject .productFull .caption .prev").click(function(){
		var current_active = $("#workFeaturedProject .productThumbs li a.active");
		var current_thumb = current_active.attr('href').split('-')[1];
		var new_thumb = 0;

		if (current_thumb==1) {
			new_thumb = total_thumbs;
		} else {
			new_thumb = current_thumb - 1;
		}

		$("#workFeaturedProject .productThumbs li:eq("+ parseInt(current_thumb-1) +")").children()
			.removeClass('active')
			.css('opacity', .5);

		$("#workFeaturedProject .productThumbs li:eq("+ parseInt(new_thumb-1) +")").children()
			.addClass('active')
			.animate({
				opacity: 1
			}, 300);

		// change caption
		var title = $("#workFeaturedProject .productThumbs li:eq("+ parseInt(new_thumb-1) +")").children().attr('title');
		if (title!='') {
			$("#workFeaturedProject .productFull p").html(title);
		}

		$("#workFeaturedProject .slideshow").scrollTo('#product-'+new_thumb, 200);

		return false;
	});

	// move next
	$("#workFeaturedProject .productFull .caption .next").click(function(){
		var current_active = $("#workFeaturedProject .productThumbs li a.active");
		var current_thumb = current_active.attr('href').split('-')[1];
		var new_thumb = 0;

		if (current_thumb==total_thumbs) {
			new_thumb = 1;
		} else {
			new_thumb = parseInt(current_thumb) + 1;
		}

		$("#workFeaturedProject .productThumbs li:eq("+ parseInt(current_thumb-1) +")").children()
			.removeClass('active')
			.css('opacity', .5);

		$("#workFeaturedProject .productThumbs li:eq("+ parseInt(new_thumb-1) +")").children()
			.addClass('active')
			.animate({
				opacity: 1
			}, 300);

		// change caption
		var title = $("#workFeaturedProject .productThumbs li:eq("+ parseInt(new_thumb-1) +")").children().attr('title');
		if (title!='') {
			$("#workFeaturedProject .productFull p").html(title);
		}

		$("#workFeaturedProject .slideshow").scrollTo('#product-'+new_thumb, 200);

		return false;
	});

	$("#beforePhotoShow").click(function() {
		$("#beforePhoto").slideDown('fast');
		$(".accomplishment .vml").css('opacity', .1);
		return false;
	});
	$("#beforePhotoClose").click(function() {
		$("#beforePhoto").slideUp('fast');
		$(".accomplishment .vml").css('opacity', 1);
		return false;
	});


	// Gallery
	if ( $("#workGallery .thumbs").length>0 ) {
		var total_thumbs = $("#workGallery .thumbs li").length;
		$("#workGallery .thumbs li a").css('opacity', .4);
		$("#workGallery .thumbs li a.active").css('opacity', 1);
		
		// create dummy/clone copy of list items for continous loop purpose
		var clone1 = $("#workGallery .thumbs li").clone();
		var clone2 = $("#workGallery .thumbs li").clone();
		
		clone1.addClass('fakeFirst');
		clone2.addClass('fakeLast');
		clone1.children('a').removeClass();
		clone2.children('a').removeClass();

		$("#workGallery .thumbs .wrap ul").prepend(clone1);
		$("#workGallery .thumbs .wrap ul").append(clone2);
		$("#workGallery .thumbs .wrap").scrollTo($("#workGallery .thumbs li").eq(total_thumbs), 0); // go to current item

		
		// create dummy and adjust the full image ul width
		var full1 = $("#workGallery .full li:last").clone();
		var full2 = $("#workGallery .full li:first").clone();
		full1.addClass('fakeFirst').attr('id','fakeProductFirst');
		full2.addClass('fakeLast').attr('id','fakeProductLast');
		$("#workGallery .full ul").prepend(full1);
		$("#workGallery .full ul").append(full2);		
		$("#workGallery .mainArea .full ul").width($("#workGallery .mainArea .full li").length*852).height('100%');
		$("#workGallery .full .wrap").scrollTo(852, 0); // go to current item		

		// hide nav
		$("#workGallery .mainArea .full .movePrev, #workGallery .mainArea .full .moveNext").css('opacity', 0);
		//$("#workGallery .mainArea .full .movePrev").hide();
	}

	$("#workGallery .thumbs li a")
		.hover(
			function() {
				var $this = $(this);
				if ($this.hasClass('active')==false) {
					 $this.animate({
						opacity: 1
					}, 300);
				}
			},
			function() {
				var $this = $(this);
				if ($this.hasClass('active')==false) {
					 $this.animate({
						opacity: 0.4
					}, 300);
				}
			}
		)
		.click(function(){
			var $this = $(this);
			var id = $this.attr('href');
			var caption = $this.attr('title');
			$("#workGallery .full .wrap").scrollTo(id, 200);
			$("#workGallery .full p").html(caption);

			$("#workGallery .thumbs li a").css('opacity', .4).removeClass('active');
			$this.addClass('active').animate({ opacity: 1 }, 300);

			var index = $("#workGallery .thumbs li a").index($("#workGallery .thumbs li a.active"));
			if (index<total_thumbs-1) {
				$("#workGallery .mainArea .full .moveNext").show();
			}
			if (index>0) {
				$("#workGallery .mainArea .full .movePrev").show();
			}

			return false;
		});

	var thumb_display = 13;
	$("#workGallery .thumbs .prev").click(function(){

		var i = $("#workGallery .thumbs ul li").index( $('#workGallery .thumbs li a.current').parent() );		

		if (i==0) {
			i = total_thumbs-1;
			$("#workGallery .thumbs .wrap").scrollTo($("#workGallery .thumbs li").eq(total_thumbs), 0);
		} else {
			i = i - 1;
		}

		$("#workGallery .thumbs li a").removeClass('current');
		$("#workGallery .thumbs li:eq("+i+") a").addClass('current');
		$("#workGallery .thumbs .wrap").scrollTo($("#workGallery .thumbs li").eq(i), 200);
		return false;
	});
	$("#workGallery .thumbs .next").click(function(){

		var i = $("#workGallery .thumbs ul li").index( $('#workGallery .thumbs li a.current').parent() );
		var loopback = false;
		var diff = total_thumbs-thumb_display;

		if (i-total_thumbs==diff || i-(total_thumbs*2)==diff) {
			i = total_thumbs+diff+1;
			$("#workGallery .thumbs .wrap").scrollTo($("#workGallery .thumbs li").eq(total_thumbs+diff), 0);
		} else {
			i = i + 1;
		}

		$("#workGallery .thumbs li a").removeClass('current');
		$("#workGallery .thumbs li:eq("+i+") a").addClass('current');
		$("#workGallery .thumbs .wrap").scrollTo($("#workGallery .thumbs li").eq(i), 200);
		
		return false;
	});


	// move next
	$("#workGallery .mainArea .full .moveNext")
		.hover(
			function() {
				$(this).animate({opacity: 0.75},300);
			},
			function() {
				$(this).animate({opacity: 0},300);
			}
		)
		.click(function(){
			var index = $("#workGallery .thumbs li a").index($("#workGallery .thumbs li a.active")) - total_thumbs;
			var new_index = index+1;
			var id = $("#workGallery .thumbs li a").eq(new_index).attr('href');
			var caption = $("#workGallery .thumbs li a").eq(new_index).attr('title');
			
			if ( $("#workGallery .thumbs li a.active").parent().next().hasClass('fakeLast') ) {
				$("#workGallery .full .wrap").scrollTo($("#workGallery .full .wrap li:last"), 200, {onAfter:function(){
						$("#workGallery .full .wrap").scrollTo(852, 0);
					}});
				$("#workGallery .thumbs li a").removeClass('active').css('opacity', .4);
				$("#workGallery .thumbs li a").eq(total_thumbs).addClass('active').css('opacity', 1);
			} else {
				$("#workGallery .full .wrap").scrollTo(id, 200);
				$("#workGallery .full p").html(caption);
	
				$("#workGallery .thumbs li a").removeClass('active').css('opacity', .4);
				$("#workGallery .thumbs li a").eq(new_index+total_thumbs).addClass('active').css('opacity', 1);				
			}

			return false;
		}
	);

	// move previous
	$("#workGallery .mainArea .full .movePrev")
		.hover(
			function() {
				$(this).animate({opacity: 0.75},300);
			},
			function() {
				$(this).animate({opacity: 0},300);
			}
		)
		.click(function(){
			var index = $("#workGallery .thumbs li a").index($("#workGallery .thumbs li a.active")) - total_thumbs;			
			var new_index = index-1;
			var id = $("#workGallery .thumbs li a").eq(new_index).attr('href');
			var caption = $("#workGallery .thumbs li a").eq(new_index).attr('title');
			
			if ( $("#workGallery .thumbs li a.active").parent().prev().hasClass('fakeFirst') ) {
				$("#workGallery .full .wrap").scrollTo($("#workGallery .full .wrap li:first"), 200, {onAfter:function(){
						$("#workGallery .full .wrap").scrollTo($("#workGallery .full .wrap li.fakeLast").prev(), 0);						
						$("#workGallery .thumbs li a").removeClass('active').css('opacity', .4);				
						$("#workGallery .thumbs li.fakeLast:first").prev().children('a').addClass('active').css('opacity', 1);
					}});
			} else { 
				$("#workGallery .full .wrap").scrollTo(id, 200);
				$("#workGallery .full p").html(caption);
	
				$("#workGallery .thumbs li a").removeClass('active').css('opacity', .4);
				$("#workGallery .thumbs li a").eq(new_index+total_thumbs).addClass('active').css('opacity', 1);
			}

			return false;
		}
	);


	// Leadership
	$("#leadership .contentHeader ul li").hover(
		function() {
			$(this).prepend('<div id="leadershipHover"></div>');
			$("#leadershipHover").css('opacity',0).animate({opacity: 0.38},300);
		},
		function() {
			$("#leadershipHover").remove();
		}
	);

	$("#leadership #leadershipHover").live('click',function(){
		var url = $(this).next().attr('href');
		window.location = url;
	});

	if ($("#leadership .contentHeader ul li.active").length>0) {
			$("#leadership .contentHeader ul li.active").prepend('<div id="leadershipActive"></div>');
			$("#leadershipActive").css('opacity',0).animate({opacity: 0.38},300);
	}


	// Culture
	if ($("#culture .mainArea .thumbs li.active").length>0) {
		$("##culture .mainArea .thumbs li.active").prepend('<div id="leadershipActive"></div>');
		$("#leadershipActive").css('opacity',0).animate({opacity: 0.38},300);
	}
	$("#culture .mainArea .thumbs li").hover(
		function() {
			$(this).prepend('<div id="leadershipHover"></div>');
			$("#leadershipHover").css('opacity',0).animate({opacity: 0.38},300);
		},
		function() {
			$("#leadershipHover").remove();
		}
	);
	$("#culture #leadershipHover").live('click',function(){
		var url = $(this).next().attr('href');
		var caption = $(this).next().attr('title');

		$("#culture .mainArea .full img").attr('src', url);
		$("#culture .mainArea .full p").html(caption);

		$("#leadershipActive").remove();
		$(this).parent().prepend('<div id="leadershipActive"></div>');
		$("#leadershipActive").css('opacity',0).animate({opacity: 0.38},300);

		return false;
	});
	$("#culture .mainArea .full .prev").click(function(){
		var i = $("#culture .mainArea .thumbs li").index( $('#leadershipActive').parent() );

		if (i==0) {
			i = $("#culture .mainArea .thumbs li").length - 1;
		} else {
			i = i - 1;
		}

		var a = $("#culture .mainArea .thumbs li:eq("+ i +") a");
		var url = a.attr('href');
		var caption = a.attr('title');

		$("#culture .mainArea .full img").attr('src', url);
		$("#culture .mainArea .full p").html(caption);

		$("#leadershipActive").remove();
		a.parent().prepend('<div id="leadershipActive"></div>');
		$("#leadershipActive").css('opacity',0).animate({opacity: 0.38},300);

		return false;
	});
	$("#culture .mainArea .full .next").click(function(){
		var i = $("#culture .mainArea .thumbs li").index( $('#leadershipActive').parent() );

		if (i==$("#culture .mainArea .thumbs li").length - 1) {
			i = 0;
		} else {
			i = parseInt(i) + 1;
		}

		var a = $("#culture .mainArea .thumbs li:eq("+ i +") a");
		var url = a.attr('href');
		var caption = a.attr('title');

		$("#culture .mainArea .full img").attr('src', url);
		$("#culture .mainArea .full p").html(caption);

		$("#leadershipActive").remove();
		a.parent().prepend('<div id="leadershipActive"></div>');
		$("#leadershipActive").css('opacity',0).animate({opacity: 0.38},300);

		return false;
	});


	// scrollbars
	if ($('.scroll-pane').length>0) {
		$('.scroll-pane').jScrollPane({scrollbarWidth:20, scrollbarMargin:10});
		$('.jScrollPaneTrack').height($('.scroll-pane').parent().height());
	}


	// strategy hover state on sub nav
	$(".expertiseSubPage .subContentNav li a").hover(
		function() {
			$(this).addClass('activeHover');
			Cufon.refresh();
		},
		function() {
			$(this).removeClass('activeHover');
			Cufon.refresh();
		}
	);


	// Map
	$(".flashArea li a").hover(
		function() {
			$(this).next().fadeIn();
		},
		function() {
			if ($(this).next().hasClass('active')==false) {
				$(this).next().fadeOut();
			}
		}
	);
	if ( $(".flashArea li a").length>0 ) {
		$(".flashArea li .active").fadeIn();
	}


	/**
	 * Modal Functionalities
	 **/
	positionModal = function(){
		 var wWidth = window.innerWidth;
		 var wHeight = window.innerHeight;

		 if (wWidth==undefined) {
			 wWidth = document.documentElement.clientWidth;
			 wHeight = document.documentElement.clientHeight;
		 }

		 var boxLeft = parseInt((wWidth / 2) - ( $("#modal").width() / 2 ));
		 var boxTop = parseInt((wHeight / 2) - ( $("#modal").height() / 2 ));

		 // position modal
		 $("#modal").css('margin', boxTop + 'px 0 0 ' + boxLeft + 'px');
	}

	loadModal = function(url, className){
		$("body").append('<div id="modalBackground"></div>');
		$("#modalBackground").css("opacity", 0).fadeTo("slow", "0.55");
		$("body").append('<div id="modalWrapper"></div>');
		$("#modalWrapper").append('<div id="modal"></div>');
		if (className!='') {
			$('#modal').addClass(className);
		}

		$.ajax({
			url: url,
			cache: false,
			success: function(html) {
				$("#modal").html(html);
				$("#modal").append('<a href="#" class="closeModal"><span class="hide">Close</span></a>');
				positionModal();
				Cufon.replace('.modalvml');
			},
			error: function() {
				alert("Error loading page");
				closeModal();
			}
		 });

		return false;
	}

	closeModal = function(){
		$("#modalWrapper").remove();
		$("#modalBackground").remove();
	}

	// close modal trigger
	$(".closeModal, .cancelModal").live('click', function(){
		closeModal();
		return false;
	});


	// open modal
	$('.modal').live('click', function(){
		var url = $(this).attr('href');
		loadModal(url, '');
		return false;
	});

	// open small modal
	$('.smallmodallaunch').live('click', function(){
		var url = $(this).attr('href');
		loadModal(url, 'smallmodal');
		return false;
	});


	// delete file
	$('.delete').click(function(){
		var url = $(this).attr('href');
		loadModal(url, 'boxLogin');
		$('body').data('row', $(this).parent().parent());
		return false;
	});

	$("#btnContinueDelete").live('click', function(){
		$(this).parent().submit();
		return false;
	});


	// file upload
	$('#file').each(function() {
		$(this).MultiFile({
			STRING: {
				remove:'Remove',
				icon_url: '/static/media/images/'
			},
			list: '#fileContainer'
		});
	});

	$("#uploadFile").click(function(){
		$('#frmUpload').submit();
		
		update_progress();
	});
	
	update_progress = function() {
		$.ajax({
			async: false,
			cache: false,
			data: {'upload_id':$('#upload_id').val()},
			dataType: 'json',
			error: function(request, status, error) {
				$(".progress").animate({width:'0%'});
				$(".uploadStatus").html('unexpected error retrieving progress');
				setTimeout(update_progress, 1000);
			},
			success: function(data, status, request) {
				if(data) {
					if($(".progress").length==0) {
						$("body").append('<div id="modalBackground"></div>');
						$("#modalBackground").css("opacity", 0).fadeTo("slow", "0.55");
						$("body").append('<div id="modalWrapper"></div>');
						$("#modalWrapper").append('<div class="boxLogin" id="modal"></div>');
						$("#modal").html('\
<div class="modalContainer">\
	<div class="wrapper">\
		<h2 class="modalvml">Uploading...</h2>\
		\
		<div class="uploader">\
			<div class="progressBar"><div class="progress"></div></div>\
			<p class="uploadStatus"></p>\
		</div>\
		\
		<div class="row last center">\
			<button type="button" class="cancelModal" onclick="window.location=document.URL;">Cancel</button>\
		</div>\
	</div>\
</div>\
<a href="#" class="closeModal" onclick="window.location=document.URL;"><span class="hide">Close</span></a>\
						');
						positionModal();
						Cufon.replace('.modalvml');
					}
					$(".progress").animate({width:data['received']+'%'});
					$(".uploadStatus").html(data['status']);
				}
				setTimeout(update_progress, 1000);
			},
			type: 'post',
			url: window.location.pathname+'upload-progress/'
		});
	}

	$("label.inField").click(function(){
		$(this).fadeOut('fast');
	});
	$("input.inField").focus(function(){
		$(this).prev().fadeOut('fast');
	});
	$("input.inField").blur(function(){
		if ( $(this).val()=='' ) {
			$(this).prev().fadeIn('fast');
		}
	});
	
	// File Portal file list
	$("select[name='rows']").change(function() {
		$("#rows").val($(this).val());
		$("#frmSearch").submit();
	});
	
	$("a.prev").click(function() {
		$("#page").val(parseInt($("#page").val())-1);
		$("#frmSearch").submit();
	});
	
	$("a.page").click(function() {
		$("#page").val(parseInt($(this).html()));
		$("#frmSearch").submit();
	});
	
	$("a.next").click(function() {
		$("#page").val(parseInt($("#page").val())+1);
		$("#frmSearch").submit();
	});
	
	
	// Twitter feed animation
	if ( $("#home .spotlight li.twitter div li").length>0 ) {
		if ( $(".twitterActive").length==0 ) {
			$("#home .spotlight li.twitter div li").css('opacity', 0);
			$("#home .spotlight li.twitter div li:first").addClass('twitterActive').animate({opacity:1}, 2000);
		}
		var twit_animate = setInterval(function(){
								
								
								next_twit = $(".twitterActive").next();
								$("#home .spotlight li.twitter div li").removeClass('twitterActive');										
																										
								if ( next_twit ) {										
									next_twit.addClass('twitterActive');
								} 									
									
								if ( $(".twitterActive").length==0 ) {
									$("#home .spotlight li.twitter div li:first").addClass('twitterActive');
								}
								$("#home .spotlight li.twitter div li").not('.twitterActive').animate({opacity:0}, 1000);
								$(".twitterActive").css('opacity', 0).animate({opacity:1}, 2000);
																
							}, 6000);
	}

});
