//Defaults

jQuery('#about-pantech li img').css('opacity','0');
jQuery('#about-pantech li').attr('opening','false');
jQuery('#about-pantech li').attr('closing','false');

//Actions
jQuery('#about-pantech li').hover(
	function () { 
		closeAllAbouts();
		jQuery(this).attr('opening','true')
		.stop()
		.animate(
			{"width":"204px"},
			{
				queue:false,duration:500,easing:"easeInOutCirc",complete:function(){finishOpening(this);}
			}
		);
		jQuery(this).children('span').stop()
		.animate(
			{"color":"#3f3f3f","fontSize":"16px","lineHeight":"16px"},
			500,
			"easeInOutCirc"
		);
		jQuery(this).children('img').stop()
		.animate(
			{"opacity":"1"},
			500,
			"easeInOutCirc"
		);
	},
	function () {
		if(jQuery(this).attr('opening')=='true'){
			jQuery(this).attr('closing','waiting');
		}
		else{
			jQuery(this).attr('closing','true')
			.stop()
			.animate(
				{width:"115px"},
				{
					queue:false,duration:500,easing:"easeInOutCirc",complete:function(){finishClosing(this);}
				}
			);
			jQuery(this).children('span').stop()
			.animate(
				{"color":"#959595","fontSize":"14px","lineHeight":"13px"},
				500,
				"easeInOutCirc"
			);
			jQuery(this).children('img').stop()
			.animate(
				{"opacity":"0"},
				500,
				"easeInOutCirc"
			);
		}
	}
);

function callSwfVideo(videoLink,height,width,style){
	jQuery('#swf').html('<embed height="'+height+'" align="" width="'+width+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" quality="best" src="'+videoLink+'" style="'+style+'"></embed>');
	jQuery('#swf').attr('style',style);
	jQuery('#ap_video').css('display','block');
	jQuery('#dimmer').css('display','block');
}

jQuery('#ap_unlimited').click(function(){callSwfVideo('/images/flash/unlimited.swf','510','900','');});
jQuery('#ap_history').click(function(){callSwfVideo('/images/flash/history_main.swf','510','900','');});
jQuery('#ap_mobile-collection').click(function(){callSwfVideo('/images/flash/showroom.swf','510','900','');});
jQuery('#ap_ceo').click(function(){callSwfVideo('/images/flash/ceo.swf','510','900','');});
jQuery('#ap_ci-story').click(function(){callSwfVideo('/images/flash/cistory.swf','510','900','');});

function closeAllAbouts(){
	jQuery('#about-pantech li').attr('opening','false')
	.attr('closing','false')
	.stop()
	.animate(
		{width:"115px"},
		500,
		'easeInOutCirc'
	);
	jQuery('#about-pantech li').children('span').stop()
	.animate(
		{"color":"#959595","fontSize":"14px","lineHeight":"13px"},
		500,
		"easeInOutCirc"
	);
	jQuery('#about-pantech li').children('img').stop()
	.animate(
		{"opacity":"0"},
		500,
		"easeInOutCirc"
	);
}

function finishOpening(me){
	jQuery(me).attr('opening','false');
	
	if(jQuery(me).attr('closing')=='waiting'){
		jQuery(me).attr('closing','true')
		.animate(
			{width:"115px"},
			500,
			'easeInOutCirc',
			function(){finishClosing(me);}
		);
		jQuery(me).children('span').stop()
		.animate(
			{"color":"#959595","fontSize":"14px","lineHeight":"13px"},
			500,
			"easeInOutCirc"
		);
		jQuery(me).children('img').stop()
		.animate(
			{"opacity":"0"},
			500,
			"easeInOutCirc"
		);
	}
}

function finishClosing(me){
	jQuery(me).attr('closing','false');
}

//Video Container Actions
jQuery('#close-x').hover(
	function () { 
		jQuery(this).stop()
		.animate(
			{"right":"-35px"},
			{duration:200,easing:"easeInOutCirc"}
		);
	},
	function () { 
		jQuery(this).stop()
		.animate(
			{"right":"-25px"},
			{duration:200,easing:"easeInOutCirc"}
		);
	}
);

jQuery('#close-x').click(
	function(){
		jQuery('#swf').html('');
		jQuery('#swf').attr('style','');
		jQuery('#ap_video').css('display','none');
		jQuery('#dimmer').css('display','none');
	}
);