/* Search */
function checkKey()
{
	if(document.form1.key.value=="")
	{
		alert("Bạn chưa nhập từ khóa để tìm kiếm.");
		document.form1.key.focus();
		return false;
	}
	return true;
}

/* Tab */
var isIE=(navigator.userAgent.indexOf('MSIE')!=-1);function $(objID)
{return document.getElementById(objID);};function $SetTargetBlankForAllHref()
{var _as=document.getElementsByTagName('a');for(var i=0;i<_as.length;i++)
{if(_as[i].target=='')
{var hrf=_as[i].href;if(hrf=='')
break;var reg=new RegExp(/javascript/ig);if(!reg.test(hrf))
_as[i].target='_blank';}}};function $CreateFlashControl(src_,width,height)
{var HTML='<object align="baseline" border="0" classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" ';if(width!=0)
HTML+=' width="'+width+'"';else
HTML+=' width="200"';if(height!=0)
HTML+=' height="'+height+'"';else
HTML+=' height="150"';HTML+=' >';HTML+='<param name="_cx" value="5292" />';HTML+='<param name="_cy" value="3969" />';HTML+='<param name="FlashVars" value="5292" />';HTML+='<param name="Movie" value="'+src_+'" />';HTML+='<param name="Src" value="'+src_+'" />';HTML+='<param name="WMode" value="Transparent" />';HTML+='<param name="Play" value="-1" />';HTML+='<param name="Loop" value="-1" />';HTML+='<param name="Quality" value="High" />';HTML+='<param name="SAlign" value="" />';HTML+='<param name="Menu" value="-1" />';HTML+='<param name="Base" value="" />';HTML+='<param name="AllowScriptAccess" value="always" />';HTML+='<param name="Scale" value="ShowAll" />';HTML+='<param name="DeviceFont" value="0" />';HTML+='<param name="EmbedMovie" value="0" />';HTML+='<param name="BGColor" value="" />';HTML+='<param name="SWRemote" value="" />';HTML+='<embed src="'+src_+'"';HTML+=' wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer"';HTML+=' type="application/x-shockwave-flash"';HTML+=' name="AdObj1" quality="High"';if(width!=0)
HTML+=' width="'+width+'"';else
HTML+=' width="200"';if(height!=0)
HTML+=' height="'+height+'"';else
HTML+=' height="150"';HTML+=' >';HTML+='</object>';return HTML;};function $TabClick(this_)
{Os_Tab.$Click(this_,function(){document.getElementById('mode').value=this_.id;});};var o_Tab={$c:function(this_,function_)
{var _parentNode=this_.parentNode;var Nodes=_parentNode.childNodes;for(var i=0;i<Nodes.length;i++)
{var tab_=Nodes[i];if(tab_.nodeName.toLowerCase()!='div')
continue;if(this_==tab_)
tab_.className='curnav';else
tab_.className='';}
if(function_)
function_();}};

function o_Tab3(this_,id_) {
	o_Tab.$c(this_,function(){var objid=$('_box_'+id_);if(objid) {var objcontainer=objid.parentNode.childNodes;for(var i=0;i<objcontainer.length;i++)
{var tab_=objcontainer[i];if(tab_.nodeName.toLowerCase()!='div')
continue;if(objid.id==tab_.id)
tab_.style.display='block';else
tab_.style.display='none';}}});};


/* Tooltip */

var tooltipID='dhtmltooltip';var imgtipID='AdPortaldhtmltooltip';document.write('<div id="'+tooltipID+'" style="VISIBILITY: hidden;"></div>');document.write('<img id="'+imgtipID+'" style="VISIBILITY: hidden;" src="Images/AdPortal_Tooltiparrow.gif" width="0" height="0">');var offsetfromcursorX=12;var offsetfromcursorY=10;var offsetdivfrompointerX=10;var offsetdivfrompointerY=14;var ie=document.all;var ns6=document.getElementById&&!document.all;var enabletip=false;if(ie||ns6)
var tipobj=document.getElementById(tooltipID);var pointerobj=document.getElementById(imgtipID);function ietruebody(){return(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;}
function showtip(thetext,thewidth,thecolor){try{if(!tipobj.style)
return;if(ns6||ie){if(thewidth)
tipobj.style.width=thewidth+"px";if(thecolor&&thecolor!="")
tipobj.style.backgroundColor=thecolor;tipobj.innerHTML=thetext;enabletip=true;return false;}}
catch(e)
{}}
function positiontip(e){if(!tipobj.style)
return;if(enabletip&&pointerobj){var nondefaultpos=false;var curX=(ns6)?e.pageX:event.clientX+ietruebody().scrollLeft;var curY=(ns6)?e.pageY:event.clientY+ietruebody().scrollTop;var winwidth=ie&&!window.opera?ietruebody().clientWidth:window.innerWidth-20;var winheight=ie&&!window.opera?ietruebody().clientHeight:window.innerHeight-20;var rightedge=ie&&!window.opera?winwidth-event.clientX-offsetfromcursorX:winwidth-e.clientX-offsetfromcursorX;var bottomedge=ie&&!window.opera?winheight-event.clientY-offsetfromcursorY:winheight-e.clientY-offsetfromcursorY;var leftedge=(offsetfromcursorX<0)?offsetfromcursorX*(-1):-1000;if(rightedge<tipobj.offsetWidth){tipobj.style.left=curX-tipobj.offsetWidth+"px";nondefaultpos=true;}
else if(curX<leftedge)
tipobj.style.left="5px";else{tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px";pointerobj.style.left=curX+offsetfromcursorX+"px";}
if(bottomedge<tipobj.offsetHeight){tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px";nondefaultpos=true;}
else{tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px";pointerobj.style.top=curY+offsetfromcursorY+"px";}
tipobj.style.visibility="visible";if(!nondefaultpos)
pointerobj.style.visibility="visible";else
pointerobj.style.visibility="hidden";}}
function hidetip(){if(!tipobj.style)
return;if(ns6||ie){enabletip=false;tipobj.style.visibility="hidden";pointerobj.style.visibility="hidden";tipobj.style.left="-1000px";tipobj.style.backgroundColor='';tipobj.style.width='';}}
document.onmousemove=positiontip;


/* Slide */

function start() {
	obj = document.getElementById('scroll_clipper');
	if(obj != null){
		obj.scrollLeft = 0 + i;
		i=i+1;
		timerId = setTimeout("start()", 100);
	}
}

var i = 0;
var timerId, timerId1;
function startp() {
	scroll_clipper.scrollLeft = 0 + i;
	i=i-11;
	timerId1 = setTimeout("startp()", 100);
}
function startf() {
	scroll_clipper.scrollLeft = 0 + i;
	i=i+9;
	timerId1 = setTimeout("startf()", 100);
}
function stop(){
	if(timerId1){
		clearTimeout(timerId1);
		timerId1 = 0;
	}
}
function gotobyleft(id){
	obj = document.getElementById(id);
	scroll_clipper.scrollLeft = obj.offsetLeft;
	i = obj.offsetLeft;
}

/* Zoom Image */

function openimage(vLink, vWidth,  vHeight, vTitle)
{
	var sLink = (typeof(vLink.href) == 'undefined') ? vLink : vLink.href;

	if (sLink == '')
	{
		return false;
	}

	winDef = 'status=no,resizable=yes,scrollbars=yes,toolbar=no,location=no,fullscreen=no,titlebar=yes,height='.concat(vHeight).concat(',').concat('width=').concat(vWidth).concat(',');
	winDef = winDef.concat('top=').concat((screen.height - vHeight)/2).concat(',');
	winDef = winDef.concat('left=').concat((screen.width - vWidth)/2);
	newwin = open('', '_blank', winDef);

	newwin.document.writeln('<title>', vTitle, '</title><body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">');
	newwin.document.writeln('<a href="" onClick="window.close(); return false;"><img src="', sLink, '" alt="', 'Đóng Lại', '" border=0></a>');
	newwin.document.writeln('</body>');

	if (typeof(vLink.href) != 'undefined')
	{
		return false;
	}
}

function openimage2(vLink, vWidth,  vHeight, vTitle)
{
	var sLink = (typeof(vLink.href) == 'undefined') ? vLink : vLink.href;

	if (sLink == '')
	{
		return false;
	}

	winDef = 'status=no,resizable=no,scrollbars=no,toolbar=no,location=no,fullscreen=no,titlebar=yes,height='.concat(vHeight).concat(',').concat('width=').concat(vWidth).concat(',');
	winDef = winDef.concat('top=').concat((screen.height - vHeight)/2).concat(',');
	winDef = winDef.concat('left=').concat((screen.width - vWidth)/2);
	newwin = open('', '_blank', winDef);

	newwin.document.writeln('<title>', vTitle, '</title><body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">');
	newwin.document.writeln('<a href="" onClick="window.close(); return false;"><img src="', sLink, '" alt="', 'Đóng Lại', '" border=0></a>');
	newwin.document.writeln('</body>');

	if (typeof(vLink.href) != 'undefined')
	{
		return false;
	}
}

