function nav_overs(id,h,spd){
	$('#'+id+' li').hover(function() {
 		$(this).children('.link a').animate({ marginTop: -h }, spd);
		}, function() {
		$(this).children('.link a').animate({ marginTop: -0 }, spd);          
		});	
}

function btn_overs(cls){
	$('.'+cls).hover(function() {
 		$(this).addClass('act');
		}, function() {
		$(this).removeClass('act');       
		});	
}


function vid_overs(cls){
	$('.'+cls).click(function() {
		var currstate = $(this).siblings('.video').css("display");
		if(currstate == 'block'){
			$(this).parent('.st-btn').children('.video').hide();
			$(this).parent('.st-btn').addClass('rnd');
 			$(this).parent('.st-btn').removeClass('rndbt');
 			$(this).children('.png').removeClass('ru');
 			$(this).children('.png').addClass('rd');
		}else{
			$(this).parent('.st-btn').children('.video').show();
 			$(this).children('.png').removeClass('rd');
 			$(this).children('.png').addClass('ru');
 			$(this).parent('.st-btn').addClass('rndbt');
 			$(this).parent('.st-btn').removeClass('rnd');
		}
		});	
}

function hide(id){
	$('#'+id).hide();
}

function show_subnav(id){
	$('.circ-btn.'+id).hover(
		function(){fadeIn('#'+id+'-tip',id);}, 
		function (){fadeOut('#'+id+'-tip',id);}
	);
}

timer = null;

function fadeIn(id,bid){
	if(timer) clearTimeout(timer);
	var tid= $('.circ-btn.'+bid).attr('id');
	var pos = $('#'+tid).offset();
	var twid = $(id).width() / 2;
	var posLeft = (pos.left - twid) + 20;
	var posTop = pos.top + 30;
	$(id).css('left', posLeft);
	$(id).css('top', posTop);

	$(id).fadeIn('fast');
}

function fadeOut(id,bid){
	timer = setTimeout("doFade('"+id+"')",100);
}

function doFade(id){
	$(id).fadeOut('fast');
}

function tip_overs(cls){
	$('.'+cls).hover(function() {
 		var tid= $(this).attr('id');
 		fadeIn('#'+tid);
		}, function() {
		var tid= $(this).attr('id');
 		fadeOut('#'+tid);      
		});	
}


$(document).ready(function(){
	btn_overs('st-btn');
	vid_overs('vid-btn');
	tip_overs('tooltip');
	show_subnav('iis');
	show_subnav('wsw');
	//$(".shadow").dropShadow({left:0, top:0, opacity: 0.7, blur: 5});
});
