$(document).ready(function(){
   
   if($('#biztabs').length > 0) {
		$('#biztabs a').click(function(event) {
			event.preventDefault();
			event.stopPropagation();
			
			var id = $(this).parents('li').attr('id');
			$('.biztabcontent').hide();
			$('#' + id + 'content').show();
			
			$('#biztabs li').removeClass('active');
			$(this).parents('li').addClass('active');
		});
	}
	
	if($('#apps').length > 0) {
		$('#apps ul a').mouseover(function(event) {
			var appid;
			event.preventDefault();
			event.stopPropagation();
			
			appid = $(this).attr('id');
			$('#apps ul li').removeClass('active');
			$(this).parent('li').addClass('active');
			
			$('#apps img').hide();
			$('#apps img#' + appid + '-img').show();
		});
	}
	
	$('a.mobile-popup').click(function(event) {
			event.preventDefault();
			event.stopPropagation();
			var exceptions, thisUrl;
			
			exceptions = ['http://vfczwebgameg.prod.mobivillage.com/index.php4?ig=5185', 'http://vfczwebgameg.prod.mobivillage.com/index.php4?ig=5763', 'http://vfczwebgameg.prod.mobivillage.com/index.php4?ig=5954','http://vfczwebgameg.prod.mobivillage.com/index.php4?ig=6369','http://vfczwebgameg.prod.mobivillage.com/index.php4?ig=6202'];
			thisUrl = $(this).attr('href');
			
			if(jQuery.inArray(thisUrl, exceptions) > -1) {
				window.open(thisUrl, 'mPopup');
			} else {
				window.open('/emulator.html?murl=' + thisUrl, 'emulator', 'width=370, height=760, resizable=no, scrollbars=no');
			}
		});
	
	if($('#video-tabs').length > 0) {
		$('#video-tabs a').click(function(event) {
			var videoid;
			event.preventDefault();
			event.stopPropagation();
			
			videoid = $(this).attr('class');
			$('#video-tabs a').attr('id', '');
			$(this).attr('id', 'video-tab-active');
			
			$('.video-tab').hide();
			$('#' + videoid).show();
		});
	}
	
	$("a[rel='external']").click(function(e){
			e.preventDefault();
			window.open(this.href);
	});
});