//Site functions
function setHomePage() {
  if (document.all) 
  {
    document.body.style.behavior = "url(#default#homepage)";
    document.body.setHomePage('http://www.simphuquy.com');
  }
  else
    alert("only works in IE 4.0 or higher!");
}

// Show flash functions

function CreateControlFlash(UrlObjectID, WIDTH, HEIGHT)
{
  document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'"); 
  document.write("codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='" + WIDTH + "' height='" + HEIGHT + "'>" );
  document.write("<param name='movie' value='" + UrlObjectID + "' />");
  document.write("<param name='quality' value='high' />");
  document.write("<PARAM NAME='WMode' VALUE='Transparent'/>");
  document.write("<embed src='" + UrlObjectID + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + WIDTH + "' height='" + HEIGHT + "' ></embed></object> " );
 
}	
	


	
//////Ajax functions

var xmlHttp;
function createXMLHttpRequest() {
	if (window.ActiveXObject) {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}
	
}



function startRequest(strUrl, strDivName, strObj) {
	createXMLHttpRequest();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	if (strDivName == "BodyContent"){
	window.scrollTo(0,0);
	};
	if (strObj!=null && strObj!="")
		strUrl = strUrl + document.getElementById(strObj).value;
	xmlHttp.onreadystatechange = function(){
		if(xmlHttp.readyState == 4) {
			if(xmlHttp.status == 200) {
				document.getElementById(strDivName).innerHTML = xmlHttp.responseText;
			}
		}
		else
			document.getElementById(strDivName).innerHTML = "<br><p align=\"center\"> <br> <br> <font  color='#FF0000' style='font-size:24px' > &#272;ang t&#7843;i v&#7873;...</font> <br><img border=\"0\" src=\"/images/loading.gif\"></p><br>";
	};
	xmlHttp.open("GET",strUrl, true);
	xmlHttp.send(null);
}




// Box functions

function GetElement(id)
		{
		var itm = null;

		if (document.getElementById)
				{
				itm = document.getElementById(id);
				}

		else if (document.all)
				{
				itm = document.all[id];
				}

		else if (document.layers)
				{
				itm = document.layers[id];
				}

		return itm;
		}
		
function ShowItem(id)
		{
		var itm = null;
		itm = GetElement(id);

		if (!itm)
				{
				}

		else if (itm.style)
				{
				itm.style.display = "";
				}

		else
				{
				itm.visibility = "show";
				}
		}

function HideItem(id)
		{
		var itm = null;
		itm = GetElement(id);

		if (!itm)
				{
				}

		else if (itm.style)
				{
				itm.style.display = "none";
				}

		else
				{
				itm.visibility = "none";
				}
		}

function CloseItem(id)
		{
		var itm = null;
		itm = GetElement(id);
		

		if (!itm)
				{
				}

		else if (itm.style)
				{
				itm.style.display = "none";
				itm.style.visibility = "hidden";
				itm.style.height = 0;
				}

		else
				{
				itm.visibility = "none";
				}
		
			 alert ("Ấn F5 trên bàn phím\n\n Để hiển thị cửa sổ này khi bạn cần dùng!");
		 
		}
/////////////
function Activemenu(id)
		{
		var itm = null;
		itm = GetElement(id);
		itm.className="current";
		}
/////////////////  Du bao thoi tiet ty gia
function showModalDialog(vLink, vWidth, vHeight)
{
return showWindow(vLink, false, false, false, false, false, false, false, true, true, vWidth, vHeight, 0, 0);
}
function showWindow(vLink, vStatus, vResizeable, vScrollbars, vMenubar, vToolbar, vLocation, vFullscreen, vTitlebar, vCentered, vWidth, vHeight, vTop, vLeft)
{
var sLink = (typeof(vLink.href) == 'undefined') ? vLink : vLink.href;

winDef = '';
winDef = winDef.concat('status=').concat((vStatus) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('resizable=').concat((vResizeable) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('menubar=').concat((vMenubar) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('scrollbars=').concat((vScrollbars) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('toolbar=').concat((vToolbar) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('location=').concat((vLocation) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('fullscreen=').concat((vFullscreen) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('titlebar=').concat((vTitlebar) ? 'yes' : 'no').concat(',');
winDef = winDef.concat('height=').concat(vHeight).concat(',');
winDef = winDef.concat('width=').concat(vWidth).concat(',');

if (vCentered)
{
	winDef = winDef.concat('top=').concat((screen.height - vHeight)/2).concat(',');
	winDef = winDef.concat('left=').concat((screen.width - vWidth)/2);
}
else
{
	winDef = winDef.concat('top=').concat(vTop).concat(',');
	winDef = winDef.concat('left=').concat(vLeft);
}

open(sLink, '_blank', winDef);

if (typeof(vLink.href) != 'undefined')
{
	return false;
}
}


///////////////////////////////////////////////
function openWindow(strurl) {
  myWindow=window.open(strurl ,'','width=720,height=195,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');
  myWindow.focus();

} 
//-----------------------------------------


function showToolTip(e,text){
	if(document.all)e = event;
	
	var obj = document.getElementById('bubble_tooltip');
	var obj2 = document.getElementById('bubble_tooltip_content');
	obj2.innerHTML = text;
	obj.style.display = 'block';
	var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
	if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0; 
	var leftPos = e.clientX - 100;
	if(leftPos<0)leftPos = -20;
	obj.style.left = leftPos + 'px';
	obj.style.top = e.clientY - obj.offsetHeight -1 + st + 'px';
}	

function hideToolTip()
{
	document.getElementById('bubble_tooltip').style.display = 'none';
	
}

//-----------------------------------------------

