/*Trung thêm*/
var BlueChipHoSE = new Array('BVH','CTG','DPM','EIB','FPT','GMD','HAG','HPG','HSG','ITA','PPC','PVD','PVF','PVT','REE','SAM','SJS','SSI','STB','VCB','VIC','VIP','VNM','VSH','VTO');
var BlueChipHNX = new Array('ACB','KLS', 'SHB', 'SHS','VCG');

function IsBlueChip(symbol)
{
	var BlueChip = BlueChipHoSE.concat(BlueChipHNX);
	
	for (var i in BlueChip)
	{
		if (symbol == BlueChip[i])
			return true;
	}
	
	return false;
}

function IsBlueChip_HOSE(symbol)
{	
	for (var i in BlueChipHoSE)
	{
		if (symbol == BlueChipHoSE[i])
			return true;
	}
	
	return false;
}

function IsBlueChip_HNX(symbol)
{	
	for (var i in BlueChipHNX)
	{
		if (symbol == BlueChipHNX[i])
			return true;
	}
	
	return false;
}

function SetDisplay(obj)
{
	var h = 1;
	var _h = gup(obj);
	if (_h != null && _h != '' && (_h == 1 || _h == 0))
		h = _h;
		
	return h;		
}

function GetCurrentFloor()
{
	if (location.href.indexOf('HOSE')!=-1)
		return 'HOSE';
	else if (location.href.indexOf('HNX')!=-1)
		return 'HNX';
		
	return '';
}

/*Cookie*/
function setCookie(c_name, value, expiredays)
{
	var exdate = new Date();
	exdate.setDate(exdate.getDate() + expiredays);
	document.cookie = c_name + "=" + escape(value) + ((expiredays==null) ? "" : ";expires=" + exdate.toGMTString());
}

function getCookie(c_name)
{
	if (document.cookie.length > 0)
	{
		var c_start = document.cookie.indexOf(c_name + "=");
		if (c_start != -1)
		{
			c_start = c_start + c_name.length + 1;
			var c_end = document.cookie.indexOf(";", c_start);
			if (c_end == -1) 
				c_end=document.cookie.length;
			
			return unescape(document.cookie.substring(c_start, c_end));
		}
	}
	
	return "";
}

function deleteCookie(c_name)
{	
	var obj = getCookie(c_name);
	if (obj != null && obj != '')
	{
		document.cookie = c_name + "=;expires=Thu, 01-Jan-1970 00:00:01 GMT";
	}
}

/*Query String*/
function gup(name)
{   
	name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
	var regexS = "[\\?&]" + name + "=([^&#]*)";
	var regex = new RegExp(regexS);
	var results = regex.exec(window.location.href);
	
	if( results == null )
	  return "";
	else
	  return results[1];
}

function goStatistic(stockCode)
{
	/*if (GetCurrentFloor()=='HOSE')
	{
		try
		{
			rWin = window.open('http://192.168.68.5/Test?Code=' + stockCode, '_blank', 'width=840, height=790, toolbar=no, location=no, status=no, menubar=no, scrollbars=no, resizable=no');
			rWin.moveTo(200, 70);
			rWin.focus();	
		}
		catch (e)
		{}
	}*/
}

function redirect()
{
	if (location.href.indexOf("/VDSC/") != -1)
		location.href = location.href.replace("/VDSC/", "/VDSC_2/");
	else if (location.href.indexOf("/VDSC_2/") != -1)
		location.href = location.href.replace("/VDSC_2/", "/VDSC/");
}

function Small()
{
	if (window.screen.availWidth <= 1024)
		return true;
		
	return false;
}