<!-- Begin Script for Loading -->
function Loading() {
  document.getElementById("loading").style.visibility = "hidden";
  document.getElementById("main").style.visibility = "visible";
};
<!-- End Script for Loading -->


<!-- Begin Script for menu Show/Hide Forum -->
function toggleDisplay(TDID) {
var onoff;
	if(document.getElementById(TDID).style.display == 'block') {
		onoff =  'none';
	} else {
		onoff = 'block';
	}
	return onoff;
}
function showHide(TDID)
	{
		var onoff = toggleDisplay(TDID);
		document.getElementById(TDID).style.display = onoff;
	}
<!-- End Script for menu Show/Hide Forum -->


<!-- Begin Mouse Over Color -->
var ie=(document.all)?1:0;
function LightOn(what)
{
if (ie) what.style.backgroundColor = '#E9ECF1'; <!-- Mau khi co chuot dua vao -->
else return;
}
function LightOut(what)
{
if (ie) what.style.backgroundColor = ''; <!-- Mau khi chuot doi di -->
else return;
}
<!-- End Mouse Over Color -->


<!-- Begin Script for Image -->
function high(which2){
theobject=which2
highlighting=setInterval("highlightit(theobject)",50)
}
function low(which2){
clearInterval(highlighting)
if (which2.style.MozOpacity)
which2.style.MozOpacity=0.5
else if (which2.filters)
which2.filters.alpha.opacity=70
}

function highlightit(cur2){
if (cur2.style.MozOpacity<1)
cur2.style.MozOpacity=parseFloat(cur2.style.MozOpacity)+0.1
else if (cur2.filters&&cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
}
<!-- End Script for Image -->


<!-- Begin Script for Title -->
// width of the ticker
var tickerwidth=200

// height of the ticker
var tickerheight=50

// distance from the messagetext to the tickermarrgin (pixels)
var tickerpadding=4

// borderwidth of the ticker (pixels)
var borderwidth=0

// font-family
var fnt="Arial"

// font-size of the text
var fntsize=8

// font-size of the last letter of the ticker
var fntsizelastletter=1

// font-color of the text
var fntcolor="000000"

// font-color of the last letter of the ticker
var fntcolorlastletter="000000"

// font-weight. Set a value between 1 to 9 to adjust the boldness
var fntweight=1

// backgroundcolor
var backgroundcolor="FFFFE1"

// standstill between the messages (microseconds)
var standstill=2000

// speed (a higher value will slow down the ticker)
var speed=10

// horizontal distance from the textlink to the popupbox (pixels)
var xdistance=10

// vertical distance from the textlink to the popupbox (pixels)
var ydistance=10

// Do not edit the variables below
var timer
var topposition=0
var leftposition=0
var x,y
var i_substring=0
var i_presubstring=0
var i_message=0
var message
var messagecontent=""
var messagebackground=""
var messagepresubstring=""
var messageaftersubstring=""
fntweight=fntweight*100

function getmessagebackground() {
		messagebackground="<table border="+borderwidth+" width="+tickerwidth+" height="+tickerheight+" cellspacing=0 cellpadding=0><tr><td valign=top bgcolor='"+backgroundcolor+"' style=\"border: 1px black solid\">"
		messagebackground+="&nbsp;</td></tr></table>"
}

function getmessagecontent() {
		messagecontent="<table border=0 cellspacing=0 cellpadding="+tickerpadding+" width="+tickerwidth+" height="+tickerheight+"><tr><td valign=top><div style=\"text-align:justify\">"
		messagecontent+="<span style='position:relative; font-family:"+fnt+";color:"+fntcolor+";font-size:"+fntsize+"pt;font-weight:"+fntweight+"'>"
		messagecontent+="<font color='"+fntcolor+"'>"
		messagecontent+=messagepresubstring
		messagecontent+="</font>"
		messagecontent+="</span>"
		messagecontent+="<span style='position:relative; font-family:"+fnt+";color:"+fntcolor+";font-size:"+fntsizelastletter+"pt;font-weight:900'>"
		messagecontent+="<font color='"+fntcolorlastletter+"'>"
		messagecontent+=messageaftersubstring
		messagecontent+="</font>"
		messagecontent+="</span>"
		messagecontent+="</div></td></tr></table>"
}

function showticker() {
	if (i_substring<=message.length-1) {
			i_substring++
			i_presubstring=i_substring-1
			if (i_presubstring<0) {i_presubstring=0}
            messagepresubstring=message.substring(0,i_presubstring)
	        messageaftersubstring=message.substring(i_presubstring,i_substring)
			getmessagecontent()
		if (document.all) {
			ticker.innerHTML=messagecontent
			timer=setTimeout("showticker()", speed)
		}
		if (document.layers) {
			document.ticker.document.write(messagecontent)
			document.ticker.document.close()
			timer=setTimeout("showticker()", speed)
		}
	}
	else {
		clearTimeout(timer)
	}
}

function hideticker() {
    clearTimeout(timer)
    i_substring=0
	i_presubstring=0
    if (document.all) {
	    document.all.ticker.style.visibility="hidden"
        document.all.tickerbg.style.visibility="hidden"
	}
	if (document.layers) {
		document.ticker.visibility="hidden"
        document.tickerbg.visibility="hidden"
	}
}

function showmessage(linkmessage) {
    getmessagebackground()
    message=linkmessage

	i_substring=0
	i_presubstring=0
    leftposition=x+xdistance
    topposition=y+ydistance
	if (document.all) {
		document.all.ticker.style.posLeft=leftposition
		document.all.ticker.style.posTop=topposition
		document.all.tickerbg.style.posLeft=leftposition
		document.all.tickerbg.style.posTop=topposition
		tickerbg.innerHTML=messagebackground
        document.all.ticker.style.visibility="visible"
        document.all.tickerbg.style.visibility="visible"
		showticker()
	}
	if (document.layers) {
        document.ticker.left=leftposition
		document.ticker.top=topposition
		document.tickerbg.left=leftposition
		document.tickerbg.top=topposition
		document.tickerbg.document.write(messagebackground)
		document.tickerbg.document.close()
        document.ticker.visibility="visible"
        document.tickerbg.visibility="visible"
		showticker()
	}
}

function handlerMM(e){
	x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX
	y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY
}

if (document.layers){
	document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
<!-- End Script for Title -->


<!-- Begin Script for Face -->
  function initPage() {
    triggerEffect(document.getElementById("face").innerHTML, "face", "red", "yellow",  250);
  }
  
  function triggerEffect(l_text, l_targetId, l_color1, l_color2, l_milli) {
    l_text = l_text.split("\"").join("'");
    setTimeout("runEffect(\"" + l_text + "\", \"" + l_targetId + "\", 0, " + l_milli + ", \"" + l_color1 + "\", \"" + l_color2 + "\");", l_milli);
  }
  
  function runEffect(l_origStr, l_strTarget, l_index, l_timeout, l_color1, l_color2) {
    var char1, char2, char3;
    var indexleft = l_index > 0 ? l_index - 1 : l_index;
    var indexright = l_index < (l_origStr.length - 1) ? l_index + 1 : l_index;
    var strLeft = l_origStr.substring(0, indexleft);
    var strRight = l_origStr.substring(indexright+1, l_origStr.length);
 
    var charleft = l_index > 0 ? l_index - 1 : l_index;
    var indexright = l_index < (l_origStr.length-1) ? l_index + 1 : l_index;

    char2=l_origStr.charAt(l_index);
    
    if (l_index > 0) char1 = l_origStr.charAt(indexleft);
    else char1 = "";

    if (l_index < (l_origStr.length-1)) char3 = l_origStr.charAt(indexright);
    else char3 = "";

    var strMiddle = "<font color=" + l_color1 + ">" + char1 + "<font color=" + l_color2 + ">" + char2 + "</font>" + char3 + "</font>";

    var objTarget = document.getElementById(l_strTarget);
    objTarget.innerHTML = strLeft + strMiddle + strRight;
    
    if (l_index + 1 == l_origStr.length) {
      l_index = 0;
    } else {
      l_index++;
    }
    setTimeout("runEffect(\"" + l_origStr + "\", \"" + l_strTarget + "\", " + l_index + ", " + l_timeout + ", \"" + l_color1 + "\", \"" + l_color2 + "\");", l_timeout);
  }

<!-- End Script for Face -->


<!--cac chuc nang moi -->
//Function to change page from option list
function linkURL(URL) {
	
	if (URL.options[URL.selectedIndex].value != "") self.location.href = URL.options[URL.selectedIndex].value;	
	return true;
}

//Function to open pop up window
function winOpener(theURL, winName, scrollbars, resizable, width, height) {
	
	winFeatures = 'left=' + (screen.availWidth-10-width)/2 + ',top=' + (screen.availHeight-30-height)/2 + ',scrollbars=' + scrollbars + ',resizable=' + resizable + ',width=' + width + ',height=' + height + ',toolbar=0,location=0,status=1,menubar=0'
  	window.open(theURL, winName, winFeatures);
}

function ShowHide(id1, id2) {
	  if (id1 != '') expMenu(id1);
	  if (id2 != '') expMenu(id2);
	}
	
	function expMenu(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];
	  }
	
	  if (!itm) {
	   // do nothing
	  }
	  else if (itm.style) {
		if (itm.style.display == "none") { itm.style.display = ""; }
		else { itm.style.display = "none"; }
	  }
	  else { itm.visibility = "show"; }
	}
function toggle(iself,name1,name2,divID) {
	if (iself.src.lastIndexOf(name1)==iself.src.length-name1.length) {	
		iself.src = name2;
		document.all[divID].style.display='';
Set_Cookie('[divID]');
		
	}
	else {
		iself.src = name1;
		document.all[divID].style.display='none';
Set_Cookie('[divID]');
	}
}


// Mod by Venky, http://venki.seccomnetworks.net, hrvojevencl@gmail.com




function ResizeImages(){
	if(document.images.length > 0){
		var intImgHeight = 0, intImgWidth = 0, intForCounter = 0;
		for(intForCounter; intForCounter < document.images.length; intForCounter++){
			intImgWidth = document.images[intForCounter].width;
         			if(intImgWidth > 400){



				intImgHeight = document.images[intForCounter].height;
				document.images[intForCounter].width = 400;
				document.images[intForCounter].height = (intImgHeight / (intImgWidth / 400));

document.images[intForCounter].onclick = vbImagecodeWinOpen;
			}
		}
	}
}


NcodeImageResizer.IMAGE_ID_BASE = 'ncode_imageresizer_container_';
NcodeImageResizer.WARNING_ID_BASE = 'ncode_imageresizer_warning_';

function NcodeImageResizer(id, img) {
	this.id = id;
	this.img = img;
	this.originalWidth = 0;
	this.originalHeight = 0;
	this.warning = null;
	this.warningTextNode = null;
	
	img.id = NcodeImageResizer.IMAGE_ID_BASE+id;
}

NcodeImageResizer.getNextId = function() {
	id = 1;
	while(document.getElementById(NcodeImageResizer.IMAGE_ID_BASE+id) != null) {
		id++;
	}
	return id;
}

NcodeImageResizer.createOn = function(img) {
	isRecovery = false; // if this is a recovery from QuickEdit, which only restores the HTML, not the OO structure
	if(img.id && img.id.indexOf(NcodeImageResizer.IMAGE_ID_BASE) == 0 && document.getElementById(NcodeImageResizer.WARNING_ID_BASE+img.id.substr(NcodeImageResizer.IMAGE_ID_BASE.length)) != null) {
		newid = img.id.substr(NcodeImageResizer.IMAGE_ID_BASE.length);
		resizer = new NcodeImageResizer(newid, img);
		isRecovery = true;
		resizer.restoreImage();
	} else {
		newid = NcodeImageResizer.getNextId();
		resizer = new NcodeImageResizer(id, img);
	}
	
	if (resizer.originalWidth == 0) resizer.originalWidth = img.width;
	if (resizer.originalHeight == 0) resizer.originalHeight = img.height;
	
	if((NcodeImageResizer.MAXWIDTH > 0 && resizer.originalWidth > NcodeImageResizer.MAXWIDTH) || (NcodeImageResizer.MAXHEIGHT > 0 && resizer.originalHeight > NcodeImageResizer.MAXHEIGHT)) {
		if(isRecovery) {
			resizer.reclaimWarning(warning);
		} else {
			resizer.createWarning();
		}
		resizer.scale();
	}
}

NcodeImageResizer.prototype.restoreImage = function() {
	newimg = document.createElement('IMG');
	newimg.src = this.img.src;
	this.img.width = newimg.width;
	this.img.height = newimg.height;
}

NcodeImageResizer.prototype.reclaimWarning = function() {
	warning = document.getElementById(NcodeImageResizer.WARNING_ID_BASE+newid);
	
	this.warning = warning;
	this.warningTextNode = warning.firstChild.firstChild.childNodes[1].firstChild;
	this.warning.resize = this;
	
	this.scale();
}

NcodeImageResizer.prototype.createWarning = function() {
	mtable = document.createElement('TABLE');
	mtbody = document.createElement('TBODY');
	mtr = document.createElement('TR');
	mtd1 = document.createElement('TD');
	mtd2 = document.createElement('TD');
	mimg = document.createElement('IMG');
	mtext = document.createTextNode('');
	
	mimg.src = 'images/statusicon/wol_error.gif';
	mimg.width = 16;
	mimg.height = 16;
	mimg.alt = '';
	mimg.border = 0;
	
	mtd1.width = 20;
	mtd1.className = 'td1';
	
	mtd2.unselectable = 'on';
	mtd2.className = 'td2';
	
	mtable.className = 'ncode_imageresizer_warning';
	mtable.textNode = mtext;
	mtable.resize = this;
	mtable.id = NcodeImageResizer.WARNING_ID_BASE+this.id;
	
	mtd1.appendChild(mimg);
	mtd2.appendChild(mtext);
	
	mtr.appendChild(mtd1);
	mtr.appendChild(mtd2);
	
	mtbody.appendChild(mtr);
	
	mtable.appendChild(mtbody);
	
	this.img.parentNode.insertBefore(mtable, this.img);
	
	this.warning = mtable;
	this.warningTextNode = mtext;
}

NcodeImageResizer.prototype.scale = function() {
	if(NcodeImageResizer.MAXWIDTH > 0 && this.originalWidth > NcodeImageResizer.MAXWIDTH) {
		resized = true;
		this.img.width = NcodeImageResizer.MAXWIDTH;
		this.img.height = (NcodeImageResizer.MAXWIDTH / this.originalWidth) * this.originalHeight;
	}
	if(NcodeImageResizer.MAXHEIGHT > 0 && this.originalHeight > NcodeImageResizer.MAXHEIGHT) {
		resized = true;
		this.img.height = NcodeImageResizer.MAXHEIGHT;
		this.img.width = (NcodeImageResizer.MAXHEIGHT / this.originalHeight) * this.originalWidth;
	}
	
	this.warning.width = this.img.width;
	this.warning.onclick = function() { return this.resize.unScale(); }
	
	if(this.img.width < 450) {
		this.warningTextNode.data = vbphrase['ncode_imageresizer_warning_small'];
	} else if(this.img.fileSize && this.img.fileSize > 0) {
		this.warningTextNode.data = vbphrase['ncode_imageresizer_warning_filesize'].replace('%1$s', this.originalWidth).replace('%2$s', this.originalHeight).replace('%3$s', Math.round(this.img.fileSize/1024));
		//mtext.data = '<phrase 1="'+this.originalWidth+'" 2="'+this.originalHeight+'" 3="'+Math.round(this.img.fileSize/1024)+'">$vbphrase[ncode_imageresizer_warning_filesize]</phrase>';
	} else {
		this.warningTextNode.data = vbphrase['ncode_imageresizer_warning_no_filesize'].replace('%1$s', this.originalWidth).replace('%2$s', this.originalHeight);
		//mtext.data = '<phrase 1="'+this.originalWidth+'" 2="'+this.originalHeight+'">$vbphrase[ncode_imageresizer_warning_no_filesize]</phrase>';
	}
	
	return false;
}

NcodeImageResizer.prototype.unScale = function() {
	switch(NcodeImageResizer.MODE) {
		case 'samewindow':
			window.open(this.img.src, '_self');
			break;
		case 'newwindow':
			window.open(this.img.src, '_blank');
			break;
		case 'enlarge':
		default:
			this.img.width = this.originalWidth;
			this.img.height = this.originalHeight;
			this.img.className = 'ncode_imageresizer_original';
			if(this.warning != null) {
				this.warningTextNode.data = vbphrase['ncode_imageresizer_warning_fullsize'];
				this.warning.width = this.img.width;
				this.warning.onclick = function() { return this.resize.scale() };
			}
			break;
	}
	
	return false;
}


function toggle_collapse(objid)
{
	if (!is_regexp)
	{
		return false;
	}

	obj = fetch_object('collapseobj_' + objid);
	img = fetch_object('collapseimg_' + objid);
	cel = fetch_object('collapsecel_' + objid);

	if (!obj)
	{
		// nothing to collapse!
		if (img)
		{
			// hide the clicky image if there is one
			img.style.display = 'none';
		}
		return false;
	}

	if (obj.style.display == 'none')
	{
		obj.style.display = '';
		save_collapsed(objid, false);
		if (img)
		{
			img_re = new RegExp("_collapsed\\.gif$");
			img.src = img.src.replace(img_re, '.gif');
		}
		if (cel)
		{
			cel_re = new RegExp("^(thead|tcat)(_collapsed)$");
			cel.className = cel.className.replace(cel_re, '$1');
		}
	}
	else
	{
		obj.style.display = 'none';
		save_collapsed(objid, true);
		if (img)
		{
			img_re = new RegExp("\\.gif$");
			img.src = img.src.replace(img_re, '_collapsed.gif');
		}
		if (cel)
		{
			cel_re = new RegExp("^(thead|tcat)$");
			cel.className = cel.className.replace(cel_re, '$1_collapsed');
		}
	}
	return false;
}

/**
* Updates vbulletin_collapse cookie with collapse preferences
*
* @param	string	Unique ID for the collapse group
* @param	boolean	Add a cookie
*/
function save_collapsed(objid, addcollapsed)
{
	var collapsed = fetch_cookie('vbulletin_collapse');
	var tmp = new Array();

	if (collapsed != null)
	{
		collapsed = collapsed.split('\n');

		for (var i in collapsed)
		{
			if (collapsed[i] != objid && collapsed[i] != '')
			{
				tmp[tmp.length] = collapsed[i];
			}
		}
	}

	if (addcollapsed)
	{
		tmp[tmp.length] = objid;
	}

	expires = new Date();
	expires.setTime(expires.getTime() + (1000 * 86400 * 365));
	set_cookie('vbulletin_collapse', tmp.join('\n'), expires);
}

// 


