
	home_slide = {
		a:null,
		n:null,
		o:null,
		next:function(){
			home_slide.a = home_slide.o.filter('.active');
			if (home_slide.a.length == 0 ){ home_slide.a = home_slide.o.filter(':last'); }
			home_slide.n =  home_slide.a.next().length ? home_slide.a.next() : home_slide.o.filter(':first');
			home_slide.a.addClass('last-active');
			home_slide.n.css({opacity: 0.0}).addClass('active').animate({opacity:1.0}, 1500, function() { home_slide.a.removeClass('active last-active'); });
		},
		start:function(){
			var o = "";
			for(var i=1,m=15;i<m;i=i+1){ o += "<div class=\"slide"+i+"\">&nbsp;</div>"; }
			var $o = $(o);
			$o.appendTo($("#container.home #banner"));
			$o.filter(':first').addClass('active');
			home_slide.o = $o;
			window.setInterval("home_slide.next()", 2000 );
		}
	};
	
	/*
	home_slide = {
		a:null,
		n:null,
		o:null,
		next:function(){
			home_slide.a = $('#container.home #banner div.active');
			if (home_slide.a.length == 0 ){ home_slide.a = $('#container.home #banner div:last'); }
			home_slide.n =  home_slide.a.next().length ? home_slide.a.next() : $('#container.home #banner div:first');
			home_slide.a.addClass('last-active');
			home_slide.n.css({opacity: 0.0}).addClass('active').animate({opacity:1.0}, 1000, function() { home_slide.a.removeClass('active last-active'); });
		},
		start:function(){
			var o = "";
			for(var i=1,m=15;i<m;i=i+1){ o += "<div class=\"slide"+i+"\">&nbsp;</div>"; }
			var $o = $(o);
			$o.appendTo($("#container.home #banner"));
			home_slide.o = $o;
			$('#container.home #banner div:first').addClass('active');
			window.setInterval("home_slide.next()", 2000 );
		}
	};*/
	

hair_fader = {
	pos:0,
	posa:[-42,-255,-468,-682,-895,-1108,-1321,-1535,-1747,-1961,-2174,-2387,-2600,-2814,-3026,-3240,-3453,-3666,-3879,-4092],
	slices:20,
	sliceheight:-213,
	bgoffset:-42,
	obj:null,
	next:function(){
		//window.setTimeout(function(){
			//hair_fader.obj.fadeOut(750, function(){
				if(hair_fader.pos == hair_fader.slices){ hair_fader.pos = 0; }
				hair_fader.obj.css('backgroundPosition',"0 "+hair_fader.posa[hair_fader.pos]+"px");//.css({opacity:1});//fadeIn(750, hair_fader.next );
				hair_fader.pos++;
				//hair_fader.next();
			//});
		//},750);
	},
	start:function(o){
		hair_fader.obj = $(o);
		hair_fader.obj.css('backgroundPosition',"0 "+hair_fader.bgoffset+"px");
		//hair_fader.obj.css({opacity:1});//fadeIn(750, hair_fader.next );
		//hair_fader.next();
		window.setInterval("hair_fader.next()", 1000 );
	}
};	
	
	
$(function() {
 	$("body").addClass("js");
	
	if($.browser.msie){
		//var $pngs = $('img[src$=.png]');
		//if($pngs.length>0){ $pngs.ifixpng(); }
		$("#content table td:last-child").addClass('lastChild');
	}
	
	
	hair_fader.start("#bg_image_img");
	
	
	//home_slide.start();
	
	
	
	if($("#container").hasClass('home')){
		var imgdir = "images/";
		var imgname = "slidesliced_";
		var swfvars = "max="+13+"&amp;imgDir="+encodeURIComponent(imgdir)+"&amp;imgName="+encodeURIComponent(imgname)+"&amp;imgStart=-1&amp;imgNamePad=10";
		var swfdir = "";
		var swffont = "images.swf";
		var newwidth_t = "650px";
		var newheight_t = "325px";
		//var swftext = encodeURIComponent();
		var newid = "swfimages"+Math.floor(Math.random()*100000);
		if($.browser.msie){
			var obj = "<object data=\""+swfdir+swffont+"\" id=\""+newid+"\" width=\""+newwidth_t+"\" height=\""+newheight_t+"\" type=\"application/x-shockwave-flash\"><param name=\"type\" value=\"application/x-shockwave-flash\" /><param name=\"src\" value=\""+swfdir+swffont+"\" /><param name=\"data\" value=\""+swfdir+swffont+"\" /><param name=\"codebase\" value=\""+swfdir+swffont+"\" /><param name=\"movie\" value=\""+swfdir+swffont+"\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\"><param name=\"pluginurl\" value=\"http://www.macromedia.com/go/getflashplayer\" /><param name=\"flashvars\" value=\""+swfvars+"\" /></object>";
		}else{
			var obj = "<object data=\""+swfdir+swffont+"\" id=\""+newid+"\" width=\""+newwidth_t+"\" height=\""+newheight_t+"\" type=\"application/x-shockwave-flash\"><param name=\"type\" value=\"application/x-shockwave-flash\" /><param name=\"src\" value=\""+swfdir+swffont+"\" /><param name=\"data\" value=\""+swfdir+swffont+"\" /><param name=\"codebase\" value=\""+swfdir+swffont+"\" /><param name=\"movie\" value=\""+swfdir+swffont+"\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\"><param name=\"pluginurl\" value=\"http://www.macromedia.com/go/getflashplayer\" /><param name=\"flashvars\" value=\""+swfvars+"\" /></object>";
		}
		$(obj).appendTo("#banner");
	}
	
	
	$("h1").each(function(){
			$t = $(this);
			var swfdir = "";
			var t_size = 19;
			var swffont = "headings.swf";
			var newwidth_t = "510px";
			var newheight_t = "40px";
			var swftext = encodeURIComponent(String($t.text()).toLowerCase());
			var newid = "swftext"+Math.floor(Math.random()*100000);
			$t.css('textIndent',"-999em");
			if($.browser.msie){
				var obj = "<object data=\""+swfdir+swffont+"\" id=\""+newid+"\" width=\""+newwidth_t+"\" height=\""+newheight_t+"\" type=\"application/x-shockwave-flash\"><param name=\"type\" value=\"application/x-shockwave-flash\" /><param name=\"src\" value=\""+swfdir+swffont+"\" /><param name=\"data\" value=\""+swfdir+swffont+"\" /><param name=\"codebase\" value=\""+swfdir+swffont+"\" /><param name=\"movie\" value=\""+swfdir+swffont+"\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\"><param name=\"pluginurl\" value=\"http://www.macromedia.com/go/getflashplayer\" /><param name=\"flashvars\" value=\"t_txt="+swftext+"&amp;t_size="+t_size+"\" /></object>";
			}else{
				var obj = "<object data=\""+swfdir+swffont+"\" id=\""+newid+"\" width=\""+newwidth_t+"\" height=\""+newheight_t+"\" type=\"application/x-shockwave-flash\"><param name=\"type\" value=\"application/x-shockwave-flash\" /><param name=\"src\" value=\""+swfdir+swffont+"\" /><param name=\"data\" value=\""+swfdir+swffont+"\" /><param name=\"codebase\" value=\""+swfdir+swffont+"\" /><param name=\"movie\" value=\""+swfdir+swffont+"\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\"><param name=\"pluginurl\" value=\"http://www.macromedia.com/go/getflashplayer\" /><param name=\"flashvars\" value=\"t_txt="+swftext+"&amp;t_size="+t_size+"\" /></object>";
			}
			$(obj).appendTo($t);
	});
	
	$("h2").each(function(){
			$t = $(this);
			var swfdir = "";
			var t_size = 12;
			var swffont = "headings.swf";
			var newwidth_t = "510px";
			var newheight_t = "40px";
			var swftext = encodeURIComponent(String($t.text()).toLowerCase());
			var newid = "swftext"+Math.floor(Math.random()*100000);
			$t.css('textIndent',"-999em");
			if($.browser.msie){
				var obj = "<object data=\""+swfdir+swffont+"\" id=\""+newid+"\" width=\""+newwidth_t+"\" height=\""+newheight_t+"\" type=\"application/x-shockwave-flash\"><param name=\"type\" value=\"application/x-shockwave-flash\" /><param name=\"src\" value=\""+swfdir+swffont+"\" /><param name=\"data\" value=\""+swfdir+swffont+"\" /><param name=\"codebase\" value=\""+swfdir+swffont+"\" /><param name=\"movie\" value=\""+swfdir+swffont+"\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\"><param name=\"pluginurl\" value=\"http://www.macromedia.com/go/getflashplayer\" /><param name=\"flashvars\" value=\"t_txt="+swftext+"&amp;t_size="+t_size+"\" /></object>";
			}else{
				var obj = "<object data=\""+swfdir+swffont+"\" id=\""+newid+"\" width=\""+newwidth_t+"\" height=\""+newheight_t+"\" type=\"application/x-shockwave-flash\"><param name=\"type\" value=\"application/x-shockwave-flash\" /><param name=\"src\" value=\""+swfdir+swffont+"\" /><param name=\"data\" value=\""+swfdir+swffont+"\" /><param name=\"codebase\" value=\""+swfdir+swffont+"\" /><param name=\"movie\" value=\""+swfdir+swffont+"\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\"><param name=\"pluginurl\" value=\"http://www.macromedia.com/go/getflashplayer\" /><param name=\"flashvars\" value=\"t_txt="+swftext+"&amp;t_size="+t_size+"\" /></object>";
			}
			$(obj).appendTo($t);
	});
	
	$("#navigation > ul").superfish({delay: 500, speed: 'fast', dropShadows: false });
	
	$("a[title^='New Window: ']").each(function(){
		var newtitle = String($(this).attr('title')).substring(String("New Window: ").length);
		$(this).attr('title',newtitle);
		$(this).click(function(){ var newwin = window.open($(this).attr('href'),'newwin'); newwin.focus(); return false; });
	});
	
 });
