$(document).ready(function(){
	(function($){
		$('#company').mouseover(function(){
			$('#company_submenu').show();
			$('#company_link').removeClass('menu_link').addClass('menu_link_on');
		}).mouseout(function(){
			$('#company_link').removeClass('menu_link_on').addClass('menu_link');
			$('#company_submenu').hide();
		});

		$('#technology').mouseover(function(){
			$('#technology_submenu').show();
			$('#technology_link').removeClass('menu_link').addClass('menu_link_on');
		}).mouseout(function(){
			$('#technology_link').removeClass('menu_link_on').addClass('menu_link');
			$('#technology_submenu').hide();
		});

		$('#solutions').mouseover(function(){
			$('#solutions_submenu').show();
			$('#solutions_link').removeClass('menu_link').addClass('menu_link_on');
		}).mouseout(function(){
			$('#solutions_link').removeClass('menu_link_on').addClass('menu_link');
			$('#solutions_submenu').hide();
		});

		$('#news').mouseover(function(){
			$('#news_submenu').show();
			$('#news_link').removeClass('menu_link').addClass('menu_link_on');
		}).mouseout(function(){
			$('#news_link').removeClass('menu_link_on').addClass('menu_link');
			$('#news_submenu').hide();
		});


		//fancybox
		$("a#single_image").fancybox();

		$("a#inline").fancybox({
			'hideOnContentClick': true
		});

		$("a.iframe").fancybox({
			'hideOnContentClick': false,
			'frameWidth' : jQuery(window).width() - 200,
			'frameHeight': jQuery(window).height() - 100
		});

		$("a.group").fancybox({
			'zoomSpeedIn':	200,
			'zoomSpeedOut':	200,
			'overlayShow':	true,
			'overlayOpacity': 0.7
		});

	})(jQuery);
});

splashtimeout='';
function splash(x){
	if(x=='play'){
		document.getElementById('play_amigos').style.display='none';
		document.getElementById('play_barefoot').style.display='none';
		document.getElementById('stop_amigos').style.display='';
		document.getElementById('stop_barefoot').style.display='';
		if(document.getElementById('amigos').style.display==''){
			document.getElementById('amigos').style.display='none';
			document.getElementById('barefoot').style.display='';
		}
		else{
			document.getElementById('amigos').style.display='';
			document.getElementById('barefoot').style.display='none';
		}
		splashtimeout=setTimeout("splash('play')", 5000);

	}
	else{
		document.getElementById('play_amigos').style.display='';
		document.getElementById('play_barefoot').style.display='';
		document.getElementById('stop_amigos').style.display='none';
		document.getElementById('stop_barefoot').style.display='none';
		clearTimeout(splashtimeout);
	}
}


function change_country(x){
	document.getElementById('usa_address').style.display='none';
	document.getElementById('korea_address').style.display='none';
	document.getElementById('taiwan_address').style.display='none';
	document.getElementById('usa_address_link').className='';
	document.getElementById('korea_address_link').className='';
	document.getElementById('taiwan_address_link').className='';
	document.getElementById(x).style.display='block';
	document.getElementById(x+'_link').className='on';
}

function change_prod_tab(x){
	document.getElementById('products_overview').className='';
	document.getElementById('products_specs').className='';
	document.getElementById(x).className='products_on';
	document.getElementById('products_overview_content').style.display='none';
	document.getElementById('products_specs_content').style.display='none';
	document.getElementById(x+'_content').style.display='block';
}

function show_splash(x, y){
	document.getElementById(x).style.display='';
	document.getElementById(y).style.display='none';
}

function checkForm(frm){
	un=frm.elements['username'].value;
	err='';

	if(un.length<4 || un=='username')
		err+='Please enter username.\n';

	if(err!=''){
		alert(err);
		return false;
	}
	else
		return;
}
