// AJAX INIT
function $$$(id) {
	return document.getElementById(id);
}
function khoitao_ajax()
{
	var x;
	try 
	{
		x	=	new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
    	try 
		{
			x	=	new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(f) { x	=	null; }
  	}
	if	((!x)&&(typeof XMLHttpRequest!="undefined"))
	{
		x=new XMLHttpRequest();
  	}
	return  x;
}
function	Forward(url)
{
	window.location.href = url;
}
function	_postback()
{
	return void(1);
}
//phongtx - cufon
$(document).ready(function()
{
	$(".tgp_container .tgp_banner .tgp_navigation").show("slide", { direction: "up" }, 2000, function(){
		$(".tgp_container .tgp_banner .tgp_navigation").css("visibility","hidden");
		$(".tgp_container .tgp_banner .tgp_navigation").css("visibility","visible");
	});
	$(".tgp_container .tgp_banner .tgp_introduction_home").show("slide", { direction: "down" }, 2000, function(){
		$(".tgp_container .tgp_banner .tgp_introduction_home").css("visibility","hidden");
		$(".tgp_container .tgp_banner .tgp_introduction_home").css("visibility","visible");
	});
	$(".tgp_container .tgp_banner .tgp_nang_luc").show("slide", { direction: "left" }, 2000, function(){
		$(".tgp_container .tgp_banner .tgp_nang_luc").css("visibility","hidden");
		$(".tgp_container .tgp_banner .tgp_nang_luc").css("visibility","visible");
	});
	$(function(){
		//Cufon.replace('.tgp_container .tgp_banner .tgp_navigation ul.main_menu li', {fontFamily:'MyriadPro'});
	    Cufon.replace('.tgp_container .tgp_banner .tgp_navigation ul.main_menu li', {fontFamily:'MyriadPro', textShadow: '#000000 1px 1px', hover:true,hoverables:{a:true}});
	    Cufon.replace('.tgp_right .right_box h1.title', {fontFamily:'MyriadPro',color: '-linear-gradient(#888887, #888887)'});
	    Cufon.replace('.tgp_right .right_box h1.title span', {fontFamily:'MyriadPro',color: '-linear-gradient(#00788a, #00788a)'});
	    Cufon.replace('.tgp_right .right_box h1.count', {fontFamily:'MyriadPro',color: '-linear-gradient(#888887, #888887)'});
	    Cufon.replace('.tgp_right .right_box h1.count span', {fontFamily:'MyriadPro',color: '-linear-gradient(#00788a, #00788a)'});
	    Cufon.replace('.tgp_content .tgp_left .left h1.title', {fontFamily:'MyriadPro',color: '-linear-gradient(#888887, #888887)'});
	    Cufon.replace('.tgp_content .tgp_left .left h1.title span', {fontFamily:'MyriadPro',color: '-linear-gradient(#00788a, #00788a)'});
	    Cufon.replace('.tgp_content .tgp_left .right h1.title', {fontFamily:'MyriadPro',color: '-linear-gradient(#888887, #888887)'});
	    Cufon.replace('.tgp_content .tgp_left .right h1.title span', {fontFamily:'MyriadPro',color: '-linear-gradient(#00788a, #00788a)'});
	    Cufon.replace('h1.hinh_title', {fontFamily:'MyriadPro',color: '-linear-gradient(#00788a, #00788a)'});
	    Cufon.replace('.tgp_container .tgp_body .tgp_content .tgp_left h1.title', {fontFamily:'MyriadPro',color: '-linear-gradient(#00788a, #00788a)'});
	});
	/*PhongTX - So sanh height cua 2 the div tgp_left & tgp_right*/
	function EqualHeight(elements) { 
		tallest = 0; 
		elements.each(function() { 
			elementHeight = jQuery(this).height(); 
			if(elementHeight > tallest) { 
				tallest = elementHeight; 
			} 
		}); 
		elements.height(tallest); 
	} 
	jQuery(window).load(function(){ 
		EqualHeight(jQuery(".tgp_container .tgp_body .tgp_content .tgp_left,.tgp_container .tgp_body .tgp_content .tgp_right")); 
		jQuery(window).resize(function(){ 
			EqualHeight(jQuery(".tgp_container .tgp_body .tgp_content .tgp_left,.tgp_container .tgp_body .tgp_content .tgp_right")); 
		});
	}); 
	/*So sanh height cua 2 the div left & right*/
	function EqualHeight(elements) { 
		tallest = 0; 
		elements.each(function() { 
			elementHeight = jQuery(this).height(); 
			if(elementHeight > tallest) { 
				tallest = elementHeight; 
			} 
		}); 
		elements.height(tallest); 
	} 
	jQuery(window).load(function(){ 
		EqualHeight(jQuery(".tgp_container .tgp_body .tgp_content .tgp_left .left,.tgp_container .tgp_body .tgp_content .tgp_left .right")); 
		jQuery(window).resize(function(){ 
			EqualHeight(jQuery(".tgp_container .tgp_body .tgp_content .tgp_left .left,.tgp_container .tgp_body .tgp_content .tgp_left .right")); 
		});
	});
});
$(document).ready(function()
{
	function formatText(index, panel) {
	  return index + "";
	}
	jQuery(function( $ ){
	$('.newsSlider').css('display','block').anythingSlider({
		easing: "easeInOutBack",        // Anything other than "linear" or "swing" requires the easing plugin
		autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
		delay: 5000,                    // How long between slide transitions in AutoPlay mode
		startStopped: false,            // If autoPlay is on, this can force it to start stopped
		animationTime: 300,             // How long the slide transition takes
		hashTags: false,                 // Should links change the hashtag in the URL?
		buildNavigation: false,          // If true, builds and list of anchor links to link to each slide
		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
		startText: "Go",             // Start text
		stopText: "Stop",               // Stop text
		navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
	});
	});
	//phongtx - select box
   $("#select-wrapper").jqTransform();
   	//phongtx - thu vien hinh anh
	$("a.spp").fancybox({
		'titlePosition'	: 'inside'
	});
});
