$(document).ready(
	function(){ 
		
		$("#menu li").hover(function(){
			$(this).addClass("hoverOver");
			$(this).find("ul").fadeIn();
		},function(){
			$(this).removeClass("hoverOver");
			$(this).find("ul").fadeOut();
		});
		
		$("#menu li").click(function(){
			var goto=$(this).children('a').attr('href');
			if (goto){
	 		window.open(goto,'_self');
			}
		}); 
		
		//if ($(".info").height()>50) $('#columns').columnize({lastNeverTallest:true});
		
		$('#headerTiny').prepend('<div style="position:absolute;"><div class="contactus" style="width:200px;height:80px;cursor:pointer;position:absolute;top:-10px;left:780px;.left:480px;"></div><div>');
		
		$(".contactus").click(function(){
									   window.open('/contact_us.html','_self');
									   });
		
		var sampleImages=$("#images img");
		if ($(sampleImages).length<2) $('#minis').css('display','none');
		$("#images").css('width',$(sampleImages).length*115);
		sampleImages.hover(
							   function(){
								   $(this).stop(true,true);
								   $(this).animate({
										width:"96px",height:"96px",borderWidth: "2px"},0);
							   },
							   function(){
								   $(this).stop(true,true);
								   $(this).animate({
										width:"88px",height:"88px",borderWidth: "6px"},0);
							  
							 });
		
		sampleImages.click(function(){
									var meme=$(this).attr('large');
									var extention=(meme.split('.')[1]);
									if (extention!='flv') {
										$("#FLVPlayer").fadeOut(0);
										$("#fullsize").fadeIn(0);
										$("#fullsize").attr('src',meme);
									}else{
										$("#fullsize").fadeOut(0);
										$("#FLVPlayer").fadeIn(0);
									}
									});
		var meme=$(sampleImages[0]).attr('large');
		if (meme){
		var extention=(meme.split('.')[1]);
		if (extention!='flv') {
			$("#FLVPlayer").fadeOut(0);
			$("#fullsize").attr('src',meme);
		}else{
			$("#fullsize").fadeOut(0);
			$("#FLVPlayer").fadeIn(0);
		}
		}	
		
		var current=0;
		var time=10;
		var slides=$("#homeSlides").find('li');
		for (i=0;i!=slides.length;i++){
			$("#controls").append("<div class='button' val='"+i+"'></div>");
		}
		var controls=$(".button");
		$(controls).click(function(){
			if ($(this).attr('val')!=current){
				current=$(this).attr('val');
				$('#timer').stop(true)
				loadSlide(current);
			}
		})
		function loadSlide(which){
			$(slides).fadeOut(1000);
			$(slides[which]).fadeIn(1000);
			$(controls).removeClass("selected");
			$(controls[which]).addClass("selected");
			$('#timer').fadeTo(time*1000,0,function (){
				current++;
				if (current>=slides.length) current=0;
				loadSlide(current);
			});
		}
		loadSlide(0);
		


	}
);