// 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;

}

//Phongtx news

function news(id)

{

	var	query	=	"act=news&i="+id;

	var http 	=	khoitao_ajax();

	try

	{

		$$$('box_content').innerHTML = "<center style = 'padding-top:10px'><img src='/images/ajax-loader.gif' /></center>";

		http.open("POST", "/action.php");

		

		http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

		http.setRequestHeader("Cache-control", "no-cache");		

    	http.onreadystatechange = function()

		{

			if (http.readyState == 4)

			{

				if (http.status == 200)

				{

					$$$('box_content').innerHTML = http.responseText;

				}

				else

				{

					alert('Co loi he thong. Vui long thu lai sau.');

				}

			}

		}

		http.send(query);

	}

	catch (e)

	{

	}

	return false;

}

//Func Khoa dao tao

function khoadt(id)

{

	var	query	=	"act=khoa_dao_tao&i="+id;

	var http 	=	khoitao_ajax();

	try

	{

		$$$('box_content_khoadt').innerHTML = "<center style = 'padding-top:10px'><img src='/images/ajax-loader.gif' /></center>";

		http.open("POST", "/action.php");

		

		http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

		http.setRequestHeader("Cache-control", "no-cache");		

    	http.onreadystatechange = function()

		{

			if (http.readyState == 4)

			{

				if (http.status == 200)

				{

					$$$('box_content_khoadt').innerHTML = http.responseText;

				}

				else

				{

					alert('Co loi he thong. Vui long thu lai sau.');

				}

			}

		}

		http.send(query);

	}

	catch (e)

	{

	}

	return false;

}

function	Forward(url)

{

	window.location.href = url;

}

function	_postback()

{

	return void(1);

}

$(function(){

Cufon.replace('.tgp_tt', {fontFamily:'HP-Goudy',color: '-linear-gradient(#FC3, #FC3)'});

Cufon.replace('.tt', {fontFamily:'HP-GeoSlab',color: '-linear-gradient(#FC0, #FC0)'});

Cufon.replace('h3.title p,.tgp_content_right_tt,.tgp_content_left_tt', {fontFamily:'HP-Goudy',color: '-linear-gradient(#633, #633)'});

});



/*So sanh height cua 2 the div tgp_body_content & tgp_right*/

function EqualHeight(elements) { 

    //Xác định chiều cao của cột cao nhất 

    tallest = 0; 

    elements.each(function() { 

        elementHeight = jQuery(this).height(); 

        if(elementHeight > tallest) { 

            tallest = elementHeight; 

        } 

    }); 

    //Chỉnh chiều cao cho tất cả các cột 

    //theo chiều cao của cột cao nhất 

    elements.height(tallest); 

} 

//Áp đặt chiều cao cho các cột khi trang 

//đã được load hoàn tất. 

jQuery(window).load(function(){ 

 

    EqualHeight(jQuery(".tgp_body_content, .tgp_right")); 

  $(document).ready(function(){

					$('#photos').show().galleryView({

						filmstrip_size: 4,

						panel_width: 590,

						panel_height: 100,

						frame_width: 138,

						frame_height: 90,

						background_color: 'transparent',

						nav_theme: 'dark',

						border: 'none',
						transition_interval: 0,

						show_captions:false,

						caption_text_color: 'black'

					});

					$('#pointer').css({width:0,height:0});

				});


    //Tự động điều chỉnh lại chiều cao sau khi 

    //resize browser. Nếu không quan tâm đến việc 

    //resize browser, bạn có thể gỡ bỏ hàm này 

    jQuery(window).resize(function(){ 

        EqualHeight(jQuery(".tgp_body_content, .tgp_right")); 
		

		

    });

	//select box hinh_anh

	$('#myselectbox').selectbox();
	
	

}); 


