// 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);
}
//cuongnt - kt member
function kt_member(frm)
{
	txt_username = frm.txt_username.value
	txt_password = frm.txt_password.value
	if(!txt_username)
	{
		alert("Vui lòng nhập tên đăng nhập!");
		frm.txt_username.focus();
		return false;
	}
	if(!txt_password)
	{
		alert("Vui lòng nhập mật khẩu!");
		frm.txt_password.focus();
		return false;
	}
	else

	{
		var	query	=	"act=kt_member&txt_username="+txt_username+"&txt_password="+txt_password;
		var http 	=	khoitao_ajax();
		try
		{
			$$$('kt_member').innerHTML = "<center style='margin-top:50px'><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)
					{
						if(http.responseText)
						{
							$$$('kt_member').innerHTML = http.responseText;
							window.location.href = "/";
						}
						else
						{
							return false;
						}
					}
					else
					{
							return false;
					}
				}
			}
			http.send(query);
		}
		catch (e)
		{
		}
		return false;
	}
}
//cuongnt - sign out kt member
function kt_member_signout()
{
		var	query	=	"act=kt_member_signout";
		var http 	=	khoitao_ajax();
		try
		{
			$$$('kt_member').innerHTML = "<center style='margin-top:50px'><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)
					{
						$$$('kt_member').innerHTML = http.responseText;
						window.location.href = "/";
					}
					else
					{
							return false;
					}
				}
			}
			http.send(query);
		}
		catch (e)
		{
		}
		return false;
}
function tab_choice(number)
{
   if (number == '1')
    {
        $$$('tab_conten_1').style.display='block';
        $$$('menu_1').className = 'active';
        $$$('tab_conten_2').style.display='none';
        $$$('menu_2').className = 'none';
        $$$('tab_conten_3').style.display='none';
        $$$('menu_3').className = 'none';
    }
    if (number == '2')
    {
        $$$('tab_conten_2').style.display='block';
        $$$('menu_2').className = 'active';
        $$$('tab_conten_1').style.display='none';
        $$$('menu_1').className = 'none';
        $$$('tab_conten_3').style.display='none';
        $$$('menu_3').className = 'none';
    }
    if (number == '3')
    {
        $$$('tab_conten_3').style.display='block';
        $$$('menu_3').className = 'active';
        $$$('tab_conten_1').style.display='none';
        $$$('menu_1').className = 'none';
        $$$('tab_conten_2').style.display='none';
        $$$('menu_2').className = 'none';
    }
	 
}
/*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 .div_3 .box_1, .tgp_body .div_3 .box_2")); 
    //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 .div_3 .box_1, .tgp_body .div_3 .box_2 ")); 
    }); 
	//Cufon.replace('.title, .tgp_body .div_4 .box_3 .panel_1 .counter', {fontFamily: 'Verdana'});
}); 
$(document).ready(function(){ 
						   
	 $('#slides1').bxSlider({
	        wrapper_class: 'slides1_wrap',
			margin: 10,
			alignment: 'vertical',
	        auto: true,
			speed: 1000,
	        auto_controls: false
	    });
	 
	$('#myselectbox').selectbox();
   
});




