function changeTechMenu(newSrc,show)
{
	//window.event.preventDefault();
	$("#tech_content div").hide();
	$("#"+show).fadeIn(500);
	$("#tech_menu img").attr("src",newSrc);
}

function cycleTechImages()
{
	var active = $("#tech_content1 img").first().attr("src");
	var images = $("#tech_content4 img");
	var set_next = false;
	var next = 0;
	for (var i = 0; i < images.length; i++) {  
		var img_src = $("#tech_content4 img").eq(i).attr("src").replace("thumbs","med");
		//alert("source"+img_src);
		//alert("active"+active);
		if(set_next)
		{
			next = img_src;
			set_next = false;
		}
		if(img_src == active)
		{
			set_next = true;
		}
		
	}
	if(!next)
	{
		next = $("#tech_content4 img").first().attr("src").replace("thumbs","med");
	}
	//alert(next);
	//alert(active);
	$("#tech_content1 img").first().animate({
	    opacity: 0.25
	  }, 200);
	$("#tech_content1 img").first().attr("src",next);
	$("#tech_content1 img").first().animate({
	    opacity: 1
	  }, 200);
	
}


function hidebox(id)
{
	//alert(id);
	$("#"+id).fadeOut("normal");
	if($("#bv_paper_container").html())
	{
		$("#bv_paper_container").fadeIn("normal");
	}
}


function removeValue(text,id)
{
	if($("#"+id).attr("value") == text)
		$("#"+id).attr("value","");
}

function showTipBox(boxName,leftt,topp,width)
{
	$("#"+boxName).css("left",leftt + "px");
	$("#"+boxName).css("top", topp + "px");
	$("#"+boxName).css("z-index","100");
	$("#"+boxName).animate({opacity: 1},1);
	$("#"+boxName).fadeIn(200);
}

function showTpl(data)
{
	$("#content").append(data);
}

$(document).ready(function(){
	if($("#ooops").html())
	{
		//alert("ok");
		$("#ooops").css("position","absolute");
		$("#ooops").css("left","280px");
		$("#ooops").css("top","170px");
		$("#ooops").css("z-index","30");
	}
	$(".hover-box-small,.hover-box,.hover-box-large").prepend('<div></div>');
	$(".hover-box-small,.hover-box,.hover-box-large").hide();
	
	$(".hover-box,.hover-box-small,.hover-box-large").mouseleave(function(){
		$(this).fadeOut(200);
		
	});
	$(".hover-box-small,.hover-box,.hover-box-large").mouseenter(function(){
		$(this).stop();	
		$(this).animate({opacity: 1},200);
	});
	
	$('a[rel="hover-box"]').mouseenter(function(){
		
		var boxName = $(this).attr("href");
		boxName = boxName.substring(1);
		$("#"+boxName).stop();
		$("#"+boxName).hide();	
		topp = $(this).position().top;
		//alert(top);
		leftt = $(this).position().left;
		var width = $(this).width();
		width = width + 12;
		leftt = leftt + width;
		topp = topp - 27;
		
		//alert(boxName);
		showTipBox(boxName,leftt,topp,width);
	});
	
	$('a[rel="hover-box"]').mouseleave(function(){
		var boxName = $(this).attr("href");
		boxName = boxName.substring(1);
		
		$("#"+boxName).animate({opacity: 0},1000);
		
		
		
	});
	
	if($("#tech_content1 img").attr("src") && $("#tech_content4 img").length)
	{
		var first_url = $("#tech_content4 img").first().attr("src").replace("thumbs","med");
		$("#tech_content1 img").first().attr("src",first_url);
		cycling = setInterval("cycleTechImages();", 3000); 
	}
	
	
	/*
	$('a[rel="send-sample"]').click(function(event){
		event.preventDefault();
		var type = $(this).attr("id");
		$.post( './fn_sites/send_sample.php', {sample: type}, function(data){
			showTpl(data);}, "html" ); 
		
	});
	*/
	
});

