var fBrw=(navigator.userAgent.indexOf('MSIE')!= -1 && navigator.userAgent.indexOf('Windows')!= -1);

var fDSp=(typeof(document.getElementById)!='undefined');

var RefColumn = new Array();

var SkpFolder = true;

var LastChild = 0;

var LComplete = 0;

var DNS = location.host;

var arr_AdHeight = new Array();
arr_AdHeight[0] = 450;

if (typeof(PageHost) == 'undefined') {

	var PageHost = '';

}

function ViewMedia(link) {
	document.getElementById('ShowMedia').innerHTML = '<iframe name="Player" src="'+link+'" width="0%" height="0" frameborder="0"></iframe>';					
}

function setCookie(Name, Path, Expires, Value) {
	var cstr = Name.concat('=').concat(Value);
	
	if (Path=='')
		path='/';

	cstr=cstr.concat(';path=').concat(Path);


	if (Expires=='')
		Expires=(new Date(2020, 11, 14)).toGMTString();

	document.cookie=cstr.concat(';expires=').concat(Expires);
}

function getCookie(Name, Default)
{
	var cookie = document.cookie;
	var ir = 0, ie = 0, sf = '', i = 0, j = 0;
	Name = Name.toLowerCase();

	if (typeof(Default) == 'undefined')
		Default = '';

	if (cookie.length == 0)
		return Default;

	if ((ir = Name.indexOf('.')) == -1)
	{
		if (cookie.substr(0, Name.length + 1).toLowerCase() == Name.concat('='))
		{
			if ((ie = cookie.indexOf(';')) != -1)
			{
				cookie = cookie.substr(0, ie);
			}
		}
		else
		{
			if ((ie = cookie.toLowerCase().indexOf('; '.concat(Name).concat('='))) == -1)
				return Default;

			cookie = cookie.substr(ie + 2);

			if ((ie = cookie.indexOf(';')) != -1)
			{
				cookie = cookie.substr(0, ie);
			}
		}
		sf = ';';
	}
	else
	{
		if ((i=cookie.toLowerCase().indexOf(Name.concat('='))) != -1)
		{
			if ((j = cookie.indexOf(';', i)) > i + Name.length + 1)
			{
				return ReplaceAll(unescape(cookie.substr(i + Name.length + 1, j - i - Name.length - 1)), '+', ' ');
			}
			else
			{
				j = cookie.length;
				return ReplaceAll(unescape(cookie.substr(i + Name.length + 1, j - i - Name.length - 1)), '+', ' ');
			}
		}

		var Root = Name.substr(0, ir);
		Name = Name.substr(ir + 1);

		if (cookie.substr(0, Root.length + 1).toLowerCase() == Root.concat('='))
		{
			if ((ie = cookie.indexOf(';')) != -1)
			{
				cookie = cookie.substr(0, ie);
			}
		}
		else
		{
			if ((ie = cookie.toLowerCase().indexOf('; '.concat(Root).concat('='))) == -1)
				return Default;

			cookie = cookie.substr(ie + 2);

			if ((ie = cookie.indexOf(';')) != -1)
			{
				cookie = cookie.substr(0, ie);
			}
		}

		cookie = cookie.substr(Root.length + 1);
		sf = '&';
	}

	if (cookie.substr(0, Name.length + 1).toLowerCase() == Name.concat('=')) {
		ir = Name.length + 1;
	} else {
		if ((ir = cookie.toLowerCase().indexOf('&'.concat(Name).concat('='))) == -1)
			return Default;

		ir+=Name.length + 2;
	}

	if ((ie=cookie.indexOf(sf, ir)) == -1) {
		return ReplaceAll(unescape(cookie.substr(ir)), '+', ' ');
	} else {
		return ReplaceAll(unescape(cookie.substring(ir, ie)), '+', ' ');
	}
}
function NoOfChar(Char, Str) {
	var num =0;
	for (i = 0; i < Str.length  ; i ++) {
			if (Str.charAt(i) == '/') {
				num += 1 ;				
			}
	}
	return num ;
}

function ReplaceChar(iStr){

	var	r1=/&/g;

	var	r2=/ /g;

	var	r3=/"/g;



	iStr	=iStr.replace(r1, '%26');

	iStr	=iStr.replace(r2, '%20');

	iStr	=iStr.replace(r3, '%22');



	return iStr;

}



function CharReplace(iStr)

{

	var	r1=/%26/g;

	var	r2=/%20/g;

	var	r3=/%22/g;



	iStr	=iStr.replace(r1, '&');

	iStr	=iStr.replace(r2, ' ');

	iStr	=iStr.replace(r3, '"');



	return iStr;

}



function GetPostVariable(vName, vDef)

{

	var	str=location.href;

	var	pos=str.indexOf('?'.concat(vName).concat('='));



	if (pos==-1)

	{

		pos=str.indexOf('&'.concat(vName).concat('='));

		if (pos==-1) return vDef;

	}

	

	str=str.substring(pos + vName.length + 2);

	pos=str.indexOf('&');



	if (pos==-1)

	{

		pos=str.length;

	}	



	if (pos > 0)

	{

		str=str.substring(0, pos);

	}



	return (typeof(vDef)=='number') ? parseInt(str) : CharReplace(str);

}


function AddBreakSpace(Pixel)

{

	if (typeof(Pixel)=='undefined')

	{

		Pixel=3;

	}

	document.writeln('<table cellspacing=0 cellpadding=0 border=0 width="100%" bgcolor="#FFFFFF"><tr><td height=', Pixel, '><img src="Images/White.gif" border=0 height=1 width=1></td></tr></table>');

}



function SetParameter(pFile, pName, pVal)

{

	if ((cPost=pFile.indexOf('&'.concat(pName).concat('=')))==-1)

		cPost=pFile.indexOf('?'.concat(pName).concat('='));



	if (cPost >= 0)

	{

		if ((pPost=pFile.indexOf('&', cPost + 1))==-1)

		{

			pFile=pFile.substring(0, cPost + pName.length + 2).concat(pVal);

		}

		else

		{

			pFile=pFile.substring(0, cPost + pName.length + 2).concat(pVal).concat(pFile.substr(pPost));

		}

	}

	else

	{

		if (pFile.indexOf('?')==-1)

		{

			pFile=pFile.concat('?').concat(pName).concat('=').concat(pVal);

		}

		else

		{

			pFile=pFile.concat('&').concat(pName).concat('=').concat(pVal);

		}

	}



	return pFile;

}





function openMe(url, inNew, winDef)

{

	if (url == '')

		return;



	if (typeof(inNew)=='undefined')

		inNew = 0;



	if (typeof(winDef)=='undefined')

		winDef = 'scrollbars=yes,status=yes,toolbar=yes,location=yes,menubar=yes,resizable=yes,height=300,width=400,top='.concat((screen.height - 400)/2).concat(',left=0');



	if (inNew)

	{

		open(url, 'Advertising', winDef);

	}

	else

	{

		location.href = url;

	}

}



function openMeExt(vLink, vStatus, vResizeable, vScrollbars, vToolbar, vLocation, vFullscreen, vTitlebar, vCentered, vHeight, vWidth, vTop, vLeft, vID, vCounter)

{

	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('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);

	}



	if (typeof(vCounter) == 'undefined')

	{

		vCounter = 0;

	}



	if (typeof(vID) == 'undefined')

	{

		vID = 0;

	}

	

	if (vCounter)

	{

		//sLink = '';

	}



	open(sLink, '_blank', winDef);



	if (typeof(vLink.href) != 'undefined')

	{

		return false;

	}

}



function openImage(vLink, vHeight, vWidth)

{

	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('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">');

	newwin.document.writeln('<a href="" onClick="window.close(); return false;"><img src="', sLink, '" alt="', (fBrw) ? '&#272;&#243;ng l&#7841;i' : 'Dong lai', '" border=0></a>');

	newwin.document.writeln('</body>');



	if (typeof(vLink.href) != 'undefined')

	{

		return false;

	}

}



function PageSet(vPage)

{

	location.replace(SetParameter(location.href, 'p', vPage));

}


function UnicodeSet(iStr)
{
	for (i=0, oStr=''; i < iStr.length; i++)
	{
		switch ((j=iStr.charCodeAt(i)))
		{
		case 34:
			oStr=oStr.concat('&quot;');
			break;
		case 38:
			oStr=oStr.concat('&amp;');
			break;
		case 39:
			oStr = oStr.concat('&#39;');
			break;
		case 60:
			oStr = oStr.concat('&lt;');
			break;
		case 62:
			oStr = oStr.concat('&gt;');
			break;
		default:
			if (j < 32 || j > 127 || j==34 || j==39)
			{
				oStr=oStr.concat('&#').concat(j).concat(';');
			}
			else
			{
				oStr=oStr.concat(iStr.charAt(i)); 
			}
			break;
		}
	}
	
	return oStr;
}

function UnicodeGet(iStr)
{
	for (i=0, oStr=''; i < iStr.length; )
	{
		if (iStr.charCodeAt(i)==38)
		{
			if (iStr.charCodeAt(i + 1)==35)
			{
				p=iStr.indexOf(';', i  + 2);
				if (p!=-1)
				{
					if (p - i <= 7)
					{
						if (isFinite(iStr.substr(i + 2, p - i - 2)))
						{
							oStr = oStr.concat(String.fromCharCode(iStr.substr(i + 2, p - i - 2)));
							i = p + 1;
							continue;
						}
					}
				}
			}
			else
			{
				p=iStr.indexOf(';', i  + 1);
				if (p!=-1)
				{
					switch (iStr.substr(i + 1, p - i - 1))
					{
					case 'amp':
						oStr = oStr.concat('&');
						i = p + 1;
						break;
					case 'quot':
						oStr = oStr.concat('"');
						i = p + 1;
						break;
					case 'lt':
						oStr = oStr.concat('<');
						i = p + 1;
						break;
					case 'gt':
						oStr = oStr.concat('>');
						i = p + 1;
						break;
					}
				}
			}
		}
	
	
		oStr=oStr.concat(iStr.charAt(i));
		i++;
	}
	
	return oStr;
}


function CheckThisVote(field)

{

	form = field.form;

	if (field.checked)

	{

		form.fvotefor.value = field.value;

	}

	else

	{

		form.fvotefor.value = '';

		return;

	}



	for (i=0; i < form.elements.length - 2; i++)

	{

		if(form.elements[i].type=='checkbox')

			if (form.elements[i] != field)

				if (form.elements[i].checked)

					form.elements[i].checked = false;

	}

}



function ShowExpand(sobj1, sobj2)

{

	sobj1.style.display = 'none';

	sobj2.style.display = '';

}



function SetSelectValue(Field, iStr)

{

	if (iStr=='')

	{

		iStr=' ';

	}



	for (i=0; i < Field.options.length; i++)

	{

		if (Field.options[i].value==iStr)

		{

			Field.selectedIndex=i;

			return;

		}

	}

}



function LTrim(iStr)

{

	while (iStr.charCodeAt(0) <= 32)

	{

		iStr=iStr.substr(1);

	}

	return iStr;

}



function RTrim(iStr)

{

	while (iStr.charCodeAt(iStr.length - 1) <= 32)

	{

		iStr=iStr.substr(0, iStr.length - 1);

	}

	return iStr;

}



function Trim(iStr)

{

	while (iStr.charCodeAt(0) <= 32)

	{

		iStr=iStr.substr(1);

	}



	while (iStr.charCodeAt(iStr.length - 1) <= 32)

	{

		iStr=iStr.substr(0, iStr.length - 1);

	}



	return iStr;

}



function CheckEmailAddress(Email)

{

	Email = Trim(Email);



	while (Email != '')

	{

		c = Email.charAt(0);	

		if (c==' ' || c=='<' || c==39 || c==':' || c=='.')

		{

			Email = Email.substr(1);

		}

		else

		{

			break;

		}

	}



	i = Email.indexOf('>');

	if (i==-1)

	{

		while (Email != '')

		{

			c = Email.charAt(Email.length - 1);

			if (c==' ' || c==39 || c=='.')

			{

				Email = Email.substr(0, Email.length - 1);

			}

			else

			{

				break;

			}

		}

	}

	else

	{

		Email = Email.substr(0, i);

	}



	if (Email.length > 96)

		return '';



	i = Email.lastIndexOf('@');

	j = Email.lastIndexOf('.');

	if (i < j)

		i = j;



	switch (Email.length - i - 1)

	{

	case 2:

		break;

	case 3:

		switch (Email.substr(i))

		{

		case '.com':

		case '.net':

		case '.org':

		case '.edu':

		case '.mil':

		case '.gov':

		case '.biz':

		case '.pro':

		case '.int':

			break;

		default:

			return '';

		}

		break;

	default:

		switch (Email.substr(i))

		{

		case '.name':

		case '.info':

			break;

		default:

			return '';

		}

		break;

	}



	Email = Email.toLowerCase();



	if (Email == '')

		return '';



	if (Email.indexOf(' ') != -1)

		return '';



	if (Email.indexOf('..') != -1)

		return '';



	if (Email.indexOf('.@') != -1)

		return '';



	if (Email.indexOf('@.') != -1)

		return '';



	if (Email.indexOf(':') != -1)

		return '';



	for (i=0; i < Email.length; i++)

	{

		c = Email.charAt(i);



		if (c >= '0' && c <= '9')

			continue;

		

		if (c >= 'a' && c <= 'z')

			continue;

		

		if ('`~!#$%^&*-_+=?/\\|@.'.indexOf(c) != -1)

			continue;



		return '';

	}



	if ((i=Email.indexOf('@'))==-1)

		return '';



	if (Email.substr(i + 1).indexOf('@')!=-1)

		return '';



	if (Email.charAt(0)=='.' || Email.charAt(Email.length - 1)=='.')

		return '';



	return Email;

}



function ReplaceAll(iStr, v1, v2)
{
	var i = 0, oStr = '', j = v1.length;
	while (i < iStr.length)
	{
		if (iStr.substr(i, j) == v1)
		{
			oStr+=v2;
			i+=j
		}
		else
		{
			oStr+=iStr.charAt(i);
			i++;
		}
	}
	return oStr;
}

function TrimAndRDS(iStr)

{

	function IsHyperLink(iStr)

	{

		var i = 0, c = ' ';



		if (iStr.charAt(0) == '.')

			return false;



		for (i=0; i < iStr.length; i++)

		{

			c = iStr.charAt(i).toLowerCase();

			if (c >= '0' && c <= '9')

				continue;

		

			if (c >= 'a' && c <= 'z')

				continue;

		

			if ('@_-&.?#+-/:'.indexOf(c) != -1)

				continue;



			return false;

		}

	

		return true;

	}



	function GetLastBreak(iStr, s)

	{

		var f = new Array('(', ')', '<', '>', ' ', '\r', '\n', '\t', ',', ';', '!'), p = 0, i = 0, r = -1;

	

		for (i = 0; i < f.length; i++)

			if ((p = iStr.lastIndexOf(f[i], s)) != -1)

				if (r == -1 || p > r)

					r = p;

		return r;

	}



	function GetNextBreak(iStr, s)

	{

		var f = new Array('(', ')', '<', '>', ' ', '\r', '\n', '\t', ',', ';', '!'), p = 0, i = 0, r = -1;

	

		for (i = 0; i < f.length; i++)

			if ((p = iStr.indexOf(f[i], s)) != -1)

				if (r == -1 || p < r)

					r = p;

		return r;

	}



	function CheckDotAfter(iStr)

	{

		var p0 = 0, p1 = 0, p2 = 0, p3 = 0;



		while ((p1 = iStr.indexOf('.', p0)) != -1)

		{

			if (iStr.charAt(p1 - 1) == ' ')

			{

				iStr = iStr.substr(0, p1 - 1).concat(iStr.substr(p1));

				p0 = p1;

			}

			else

			{

				p0 = p1 + 1;

			}



			if (iStr.charAt(p0) != ' ')

			{

				if ((p3 = GetLastBreak(iStr, p0)) == -1)

				{

					p3 = p0;

				}

				else

				{

					p3 = p3 + 1;

				}

		

				if ((p2 = GetNextBreak(iStr, p3)) == -1)

				{

					if (IsHyperLink(iStr.substr(p3)))

					{

						iStr = iStr.substr(0, p3).concat(iStr.substr(p3).toLowerCase())

						break;

					}

					else

					{

						if (iStr.charAt(p0) < '0' || iStr.charAt(p0) > '9')

						{

							iStr = iStr.substr(0, p0).concat(' ').concat(iStr.substr(p0, 1).toUpperCase()).concat(iStr.substr(p0 + 1));

							p0++;

						}

					}

				}

				else

				{

					if (IsHyperLink(iStr.substring(p3, p2)))

					{

						iStr = iStr.substr(0, p3).concat(iStr.substring(p3, p2).toLowerCase()).concat(iStr.substr(p2));

						p0 = p2 + 1;

					}

					else

					{

						if (iStr.charAt(p0) < '0' || iStr.charAt(p0) > '9')

						{

							iStr = iStr.substr(0, p0).concat(' ').concat(iStr.substr(p0, 1).toUpperCase()).concat(iStr.substr(p0 + 1));

							p0++;

						}

					}

				}

			}

			else

			{

				iStr = iStr.substr(0, p0 + 1).concat(iStr.substr(p0 + 1, 1).toUpperCase()).concat(iStr.substr(p0 + 2));

			}

		}	



		return iStr;

	}



	function CheckCharAfter(iStr, iChar, iUp)

	{

		var p0 = 0, p1 = 0;



		while ((p1 = iStr.indexOf(iChar, p0)) != -1)

		{

			if (iStr.charAt(p1 - 1) == ' ')

			{

				iStr = iStr.substr(0, p1 - 1).concat(iStr.substr(p1));

				p0 = p1;

			}

			else

			{

				p0 = p1 + 1;

			}



			if (iStr.charAt(p0) != ' ')

			{

				if (iStr.charAt(p0) < '0' || iStr.charAt(p0) > '9')

				{

					if (iUp)

					{

						iStr = iStr.substr(0, p0).concat(' ').concat(iStr.substr(p0, 1).toUpperCase()).concat(iStr.substr(p0 + 1));

					}

					else

					{

						iStr = iStr.substr(0, p0).concat(' ').concat(iStr.substr(p0));

					}

					p0++;

				}

			}

			else

			{

				if (iUp)

				{

					iStr = iStr.substr(0, p0 + 1).concat(iStr.substr(p0 + 1, 1).toUpperCase()).concat(iStr.substr(p0 + 2));

				}

			}

		}



		return iStr;

	}



	function CheckScope(iStr, s1, s2)

	{

		var p0 = 0, p1 = 0;



		for (p0 = 0; (p1 = iStr.indexOf(s1, p0)) != -1; )

		{

			if (iStr.charAt(p1 + 1) == ' ')

				iStr = iStr.substr(0, p1 + 1).concat(iStr.substr(p1 + 2));



			if (p1 > 0)

				if (iStr.charAt(p1 - 1) != ' ')

				{

					iStr = iStr.substr(0, p1).concat(' ').concat(iStr.substr(p1));

					p1++;

				}

			

			p0 = p1 + 1;

		}



		for (p0 = 0; (p1 = iStr.indexOf(s2, p0)) != -1; )

		{

			var SkipChar = ':,.;!?'.concat(s2);



			if (p1 > 0)

				if (iStr.charAt(p1 - 1) == ' ')

				{

					iStr = iStr.substr(0, p1 - 1).concat(iStr.substr(p1));

					p1--;

				}



			if (iStr.charAt(p1 + 1) != ' ' && SkipChar.indexOf(iStr.charAt(p1 + 1)) == -1)

				iStr = iStr.substr(0, p1 + 1).concat(' ').concat(iStr.substr(p1 + 1));



			p0 = p1 + 1;

		}		



		return iStr;

	}

	

	iStr = ReplaceAll(iStr, '  ', ' ');

	iStr = ReplaceAll(iStr, ' \r\n', '\r\n');

	iStr = ReplaceAll(iStr, '\r\n ', '\r\n');



	iStr = CheckCharAfter(iStr, ',', false);

	iStr = CheckCharAfter(iStr, ':', false);

	iStr = CheckCharAfter(iStr, ';', false);

	iStr = CheckCharAfter(iStr, '?', true);

	iStr = CheckCharAfter(iStr, '!', true);



	iStr = CheckScope(iStr, '(', ')');

	iStr = CheckScope(iStr, '[', ']');



	iStr = ReplaceAll(iStr, 'http: //', 'http://');

	iStr = CheckDotAfter(iStr);



	iStr = ReplaceAll(iStr, ', \r\n', ',\r\n');

	iStr = ReplaceAll(iStr, ': \r\n', ':\r\n');

	iStr = ReplaceAll(iStr, '; \r\n', ';\r\n');

	iStr = ReplaceAll(iStr, '? \r\n', '!\r\n');

	iStr = ReplaceAll(iStr, '! \r\n', '!\r\n');

	iStr = ReplaceAll(iStr, '. \r\n', '.\r\n');





	if (iStr.charAt(0) == ' ')

		iStr = iStr.substr(1);



	if (iStr.charAt(iStr.length - 1) == ' ')

		iStr = iStr.substr(0, iStr.length - 1);



	return iStr.substr(0, 1).toUpperCase().concat(iStr.substr(1));

}



function dw(wstr)

{

	document.writeln(unescape(wstr));

}



function ShowFooterAd()

{

	if (RefAdLogo.length==0)

	{

		return;

	}



	CurAdLogo=RefAdStay + (Math.floor(Math.random()*12311) % (RefAdLogo.length - RefAdStay));



	document.writeln('<table width="100%" cellspacing=0 cellpadding=0 border=0 bgcolor="#c0c0c0">');

	document.writeln('<tr><td align=center>');

	document.writeln('<table width="100%" cellspacing=1 cellpadding=4 border=0>');

	document.writeln('<tr>');	



	var AdPost = new Array(new Array(0, RefAdStay), new Array(CurAdLogo, RefAdLogo.length), new Array(RefAdStay, CurAdLogo));



	for (k=0, c=0; c < 4 && k < 3; k++)

	{

		for (i=AdPost[k][0]; c < 4 && i < AdPost[k][1]; i++, c++)

		{

			document.writeln('<td height=64 align=center valign=middle align=right bgcolor="#FFFFFF">');

			if (RefAdLogo[i][1] != '')

			{

				document.writeln('<a href="', RefAdLogo[i][1], '"><img src="', PageHost.concat(RefAdLogo[i][0]), '" border=0 width=130 height=60></a>');

			}

			else

			{

				document.writeln('<img src="', PageHost.concat(RefAdLogo[i][0]), '" border=0 width=130 height=60>');

			}

			document.writeln('</td>');

		}

	}



	document.writeln('</tr>');

	document.writeln('</table>');	

	document.writeln('</td></tr>');

	document.writeln('</table>');

}



function openPopup(vImage, vLink, vTitle, vHeight, vWidth, vTop, vLeft)

{

	open('/Library/Popup.Asp?vImage='.concat(escape(vImage)).concat('&vLink=').concat(escape(vLink)).concat('&vTitle=').concat(escape(vTitle)), 'Popup_'.concat(ReplaceAll(vTitle, ' ', '_')), 'status=no,resizable=no,scrollbars=no,toolbar=no,location=no,fullscreen=no,titlebar=yes,height='.concat(vHeight).concat(',').concat('width=').concat(vWidth).concat(',').concat('top=').concat(vTop).concat(',').concat('left=').concat(vLeft));

}





function AddLineSpace(height)

{

	document.writeln('<tr><td class=BreakLine height=', (typeof(height)=='undefined' ? 1 : height), '></td></tr>');

}

function openBox(width, height, scrollbars, toolbar, top, left, fileSrc) {
	var Param = "width=" + width + ", height=" + height + ", scrollbars ="  + scrollbars + ",toolbar=" + toolbar + ", top=" + top + ", left=" +left ;
	newWindow = open(fileSrc, "a", Param) ;
}

function popupScreenshot(url)
{
	var popUp = window.open(url, "screenshot", 'scrollbars,resizable,width=640,height=480,left=10,top=10')
}

function setTime(speed, size) {
	var time;
	var new_time;
	var hours;
	var mins;
	var mins_left;
	var secs_left;
	var secs;
	time = (size /1024) / (speed / 8);
	time = Math.round(time);
	hours = time / 3600;
	hours = Math.floor(hours);
	if(hours < 10) {
	  hours = '0' + hours;
	}
	if(hours >= 1) {
	  new_time = hours;
	  secs_left = time % 3600;
	  if(secs_left > 60) {
	     mins  = secs_left / 60;
	     mins = Math.floor(mins);
	     if(mins < 10) {
	        mins = '0' + mins;
	     }
	     new_time = new_time + ':' + mins;
	     secs  = secs_left % 60;
	     if(secs < 10) {
	        secs = '0' + secs;
	     }
	     if(secs == '00') {
	        secs = '01';
	     }
	     new_time = new_time + ':' + secs;
	  }
	  else {
	     mins = 0;
	     if(mins < 10) {
	        mins = '0' + mins;
	     }
	     new_time = new_time + ':' + mins;
	     secs = secs_left;
	     if(secs < 10) {
	        secs = '0' + secs;
	     }
	     if(secs == '00') {
	        secs = '01';
	     }
	     new_time = new_time + ':' + secs;
	  }
	}
	else {
	  mins  = time / 60;
	  mins = Math.floor(mins);
	  if(mins < 10) {
	     mins = '0' + mins;
	  }
	  if(mins >= 1) {
	     new_time = '00:' + mins;
	     secs = time % 60;
	     if(secs < 10) {
	        secs = '0' + secs;
	     }
	     if(secs == '00') {
	        secs = '01';
	     }
	     new_time = new_time + ':' + secs;
	  }
	  else {
	     secs = time % 60;
	     if(secs < 10) {
	        secs = '0' + secs;
	     }
	     if(secs == '00') {
	        secs = '01';
	     }
	     new_time = '00:00:' + secs;
	  }
	}
	var div_ref = document.getElementById('dl_time');
	div_ref.innerHTML = new_time + " ";
	setCookie('dl_speed', speed, 365);
}

/*-- Begin script Drag and Drop Menu --*/

N = (document.all) ? 0 : 1;
var ob;
var over = false;

function MD(e) {
	if (over) {
		if (N) {
			ob = document.getElementById("panel");
			X=e.layerX;
			Y=e.layerY;
			return false;
		}
		else {
			ob = document.getElementById("panel");
			ob = ob.style;
			X=event.offsetX;
			Y=event.offsetY;
		}
	}
}

function MM(e) {
	if (ob) {
		if (N) {
			ob.style.top = e.pageY-Y;
			ob.style.left = e.pageX-X;
		}
		else {
			ob.pixelLeft = event.clientX-X + document.body.scrollLeft;
			ob.pixelTop = event.clientY-Y + document.body.scrollTop;
			return false;
		}
	}
}

function MU() {
	ob = null;
}

if (N) {
	document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
}

document.onmousedown = MD;
document.onmousemove = MM;
document.onmouseup = MU;

/*-- End script Drag and Drop Menu --*/


/***********************************************/

//form tags to omit in NS6+:
var omitformtags=["input", "textarea", "select"];

omitformtags=omitformtags.join("|");

function disableselect(e){
	if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
		return false;
}

function reEnable(){
	return true;
}

function NoSelectText() {
	if (typeof document.onselectstart!="undefined")
		document.onselectstart=new Function ("return false");
	else{
		document.onmousedown=disableselect;
		document.onmouseup=reEnable;
	}
}

//
var queryArray = new Array();
var queryRunning = 0;
var queryRunningStatus;

function addQuery(q)
{
	queryArray[queryArray.length] = q;
}

function runQuery()
{
	if( queryArray.length > 0 && queryRunning==0 )
	{
		queryRunning = 1;
		eval(queryArray[queryArray.length-1]);
	}
	if(queryArray.length == 0) 
	{
		window.status = 'Loading 100% complete.';
		queryArray = new Array();
		clearTimeout(queryRunningStatus);
	}
	else
		queryRunningStatus = setTimeout('runQuery()', 100);
}

//
var req;
var reqNews;
var caution = false
function loadXMLDoc(url, callbackFunction, desc, QUERY_STRING) 
{
	if(desc) window.status = desc;
	
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
		req.onreadystatechange =	function()
									{
										// only if req shows "complete"
										if (req.readyState == 4) {
											eval(callbackFunction);
										}
									}
		if(QUERY_STRING)
		{
		    req.open("POST", url, true);
			req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			req.send(QUERY_STRING);
		}
        else
        {
	        req.open("GET", url, true);
	        req.send(null);
	    }
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
        	req.onreadystatechange =	function()
										{
											// only if req shows "complete"
											if (req.readyState == 4) {
												eval(callbackFunction);
											}
										}
			if(QUERY_STRING)
			{
			    req.open("POST", url, true);
				req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				req.send(QUERY_STRING);
			}
			else
			{
			    req.open("GET", url, true);
			    req.send(null);
			}
        }
    }
}
//
function findObj(id)
{
	return document.getElementById(id);
}

//
function musicListenInNewWindow(url)
{
	var win2 = NewWindow('/Include/listenInNewWindow.htm?' + url,'mywin2','300','100','yes','center');	
	win2.focus();
}

//===============================================================================================================

function URLEncode(strURL)
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var plaintext = strURL;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    alert( "Unicode Character '" 
                        + ch 
                        + "' cannot be encoded using standard URL encoding.\n" +
				          "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	return encoded;
};

function URLDecode(strURL)
{
   // Replace + with ' '
   // Replace %xx with equivalent character
   // Put [ERROR] in output if %xx is invalid.
   var HEXCHARS = "0123456789ABCDEFabcdef"; 
   var encoded = strURL;
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2) 
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	} // while
   return plaintext;
}

function Edit_Lead(strLead, charType, intMaxWhitespace)
{
	var intLocationWhitespace;
	var intCountWhitespace;
	intLocationWhitespace = 1;
	intCountWhitespace = 0;
	while(InStr(intLocationWhitespace, strLead, charType)>0)
	{
		intLocationWhitespace = InStr(intLocationWhitespace, strLead, charType) + 1;
		intCountWhitespace = intCountWhitespace + 1;
		if(intCountWhitespace == intMaxWhitespace)
		{
			strLead = Left(strLead,intLocationWhitespace - 1) + '...';
			return strLead;
		}
	}
	if(intCountWhitespace < intMaxWhitespace)
	{
		strLead = strLead + '...';
	}
	strLead = ReplaceAll(strLead,'....','...');
	return strLead;
}

function Edit_Lead_Dyn(strVal, strChar, intLength) {
	if(strVal.length > intLength) {
		intQuant = 1;
		strTemp = strVal;
		while(Edit_Lead(strTemp, strChar, intQuant).length < intLength) {
			intQuant = intQuant + 1;
			strTemp = strVal;
		}
		return Edit_Lead(strVal, strChar, intQuant);
	} else {
		return strVal;
	}
}

function InStr(intLocation, strSearch, charSearchFor)
{
	for (i=intLocation; i < Len(strSearch); i++)
	{
	    if (charSearchFor == Mid(strSearch, i, Len(charSearchFor)))
	    {
			return i;
	    }
	}
	return -1;
}

function InStrRev(strSearch, charSearchFor) {
	for (i=strSearch.length-1; i > 0; i--) {
	    if (charSearchFor == Mid(strSearch, i, Len(charSearchFor))) {
			return i;
	    }
	}
	return -1;
}

function Mid(str, start, len)
{
	if (start < 0 || len < 0) return '';
	var iEnd, iLen = String(str).length;
	if (start + len > iLen)
		iEnd = iLen;
	else
		iEnd = start + len;
	return String(str).substring(start,iEnd);
}

function Len(str)
{
	return String(str).length;
}

function Left(str, n)
{
	if (n <= 0)
		return '';
	else if (n > String(str).length)
		return str;
	else
		return String(str).substring(0,n);
}

function Right(str, n)
{
	if (n <= 0)
	   return "";
	else if (n > String(str).length)
	   return str;
	else {
	   var iLen = String(str).length;
	   return String(str).substring(iLen, iLen - n);
	}
}

function AddressToText(strVal)
{
	strText = '';
	intLocation_dauhaicham = InStr(1,strVal,':')
	//intLocation_www = InStr(1,strVal,'www')
	//if(intLocation_www >0)
	//{
		//strText = Right(strVal,Len(strVal) - intLocation_www - 4);
	//}
	//else if(intLocation_dauhaicham>0)
	if(intLocation_dauhaicham>0)
	{
		strText = Right(strVal,Len(strVal) - intLocation_dauhaicham - 3);
	}
	return strText;
}

function Post_Time(strDate)
{
	var date = new Date(strDate);
	var now = new Date();
	var PostTimeHour = Math.floor((now.getTime() - date.getTime()) / (1000 * 60 * 60));
	var PostTimeMinute = Math.round((now.getTime() - date.getTime()) / (1000 * 60)) % 60;
	var strPost_Time = '';
	if(PostTimeHour>0)
	{
		strPost_Time = PostTimeHour + ' gi&#7901; ';
	}
	if(PostTimeMinute>0)
	{
		strPost_Time = strPost_Time + PostTimeMinute + ' ph&#250;t ';
	}
	if(strPost_Time.length>0)
	{
		strPost_Time = strPost_Time + 'tr&#432;&#7899;c';
	}
	return strPost_Time;
}

function translate(strTxt)
{
	if (strTxt=="") return;
	switch(strTxt)
	{
		case "TP Ho Chi Minh" :
			return "TP.HCM";
			break;
		case "HN" :
			return "Hà Nội"	;
			break;
		case "Hai Phong" :
			return "Hải Phòng";	
			break;
		case "Da Nang" :
			return "Đà Nẵng";
			break;
		case "Hue" :
			return "Huế"
			break;
		case "Can Tho" :
			return "Cần Thơ";
			break;
		case "Binh Thuan" :
			return "Bình Thuận";
			break;
		case "Bac Giang" :
			return "Bắc Giang";	
			break;
		case "Dong Nai" :
			return "Đồng Nai";
			break;
		case "Hoa Binh" :
			return "Hòa Bình";		
			break;
		case "My Tho" :
			return "Mỹ Tho";
			break;
		case "Nam Dinh" :
			return "Nam Định";	
			break;
		case "Phan Thiet" :
			return "Phan Thiết";
			break;
		case "Quy Nhon" :
			return "Quy Nhơn";	
			break;
		case "Song Cau" :
			return "Sông Cầu";
			break;
		case "Thai Nguyen" :
			return "Thái Nguyên";
			break;
		case "Tuy Hoa" :
			return "Tuy Hòa"
			break;
		case "Viet Tri" :
			return "Việt Trì";	
			break;
		case "Vung Tau" :
			return "Vũng Tàu";	
			break;
		case "Lao Cai" :
			return "Lào Cai";
			break;
		case "Cao Bang" :
			return "Cao Bằng";
			break;
		case "Phu Lien":
			return "Phú Liên";	
			break;
		case "Lang Son":
			return "Lạng Sơn";
			break;
		case "Bach Long Vi":
			return "Đảo Bạch Long Vĩ";
			break;
		case "Vinh":
			return "Vinh";
			break;
		case "Thanh Hoa":
			return "Thanh Hóa";
			break;
		case "Dong Hoi":
			return "Đồng Hới";
			break;
		case "Nha Trang":
			return "Nha Trang";
			break;
		case "Dao Song Tu Tay":
			return "Đảo Sông Tử Tây";
			break;
		case "Ca Mau":
			return "Cà Mau";
			break;
		case "Phu Quoc":
			return "Phú Quốc";
			break;
		case "Con Son":
			return "Côn Sơn";
			break;
		case "Truong Sa":
			return "Trường Sa";											 
			break;
		default:
			return strTxt;			
	}
}

function translateWeather(strTxt)
{
	if (strTxt =="") return;
	switch(strTxt)
	{
		case	 "Showers":
			return "M&#432;a r&#224;o";	
			break;
		case	 "Fair":
			return "Tr&#7901;i &#273;&#7865;p";
			break;
		case	 "Drizzle":
			return "M&#432;a ph&#249;n";	
			break;
		case	 "Mist":
			return "C&#243; s&#432;&#417;ng";
			break;
		case	 "Cloudy":
			return "C&#243; m&#226;y";
			break;	
		case	 "Partly Cloudy":
			return "&#205;t m&#226;y";
			break;
		case	 "Mostly Cloudy":
			return "Nhi&#7873;u m&#226;y";
			break;	
		case	 "Sunny":
			return "Tr&#7901;i n&#7855;ng";
			break;
		case	 "Mostly Sunny":
			return "N&#7855;ng g&#7855;t";
			break;
		case	 "Partly Sunny":
			return "&#205;t n&#7855;ng n&#7855;ng";
			break;	
		case	 "Clear":
			return "Kh&#244;ng m&#226;y";
			break;	
		case	 "Mostly Clear":
			return "Tr&#7901;i quang";
			break;
		case	 "Scattered T-Storms":
			return "M&#432;a gi&#244;ng r&#7843;i r&#225;c";	
			break;
		case	 "Scattered T-Storms / Wind":
			return "M&#432;a gi&#244;ng r&#7843;i r&#225;c / Gi&#243; m&#7841;nh";
			break;
		case	 "Isolated T-Storms":
			return "M&#432;a gi&#244;ng nhi&#7873;u n&#417;i";	
			break;
		case	 "Isolated T-Storms / Wind":
			return "M&#432;a gi&#244;ng nhi&#7873;u n&#417;i / Gi&#243; m&#7841;nh";
			break;
		case "Mostly Cloudy / Wind":
			return "Nhi&#7873;u m&#226;y/Gi&#243; nh&#7865;";	
			break;
		case "Partly Cloudy / Wind":
			return "&#205;t m&#226;y/Gi&#243; nh&#7865;";	
			break;	
		case "Sunny / Wind":
			return "Tr&#7901;i n&#7855;ng/Gi&#243; nh&#7865;";	
			break;
		case "Clear / Wind":
			return "Kh&#244;ng m&#226;y/Gi&#243; nh&#7865;";	
			break;	
		case "Cloudy / Wind":
			return "C&#243; m&#226;y/Gi&#243; nh&#7865;";	
			break;	
		default:
			return strTxt;								
	}
}
function dateformat(strDate)
{
	if (strDate=="")	return;
	var strDay,strMonth,strYear;
	
	strMonth=strDate.substr(0,strDate.indexOf("/"));	
	if(parseInt(strMonth)<10)	strMonth="0"+strMonth;
	
	strDay=strDate.substr(strDate.indexOf("/")+1,strDate.lastIndexOf("/")-2)
	if(parseInt(strDay)<10)	strDay="0"+strDay;
	
	strYear=strDate.substr(strDate.lastIndexOf("/")+1,4);
	return strDay+"/"+strMonth+"/"+strYear;
	
}
function timeformat(strTime)
{
	if (strTime=="") return
	switch(strTime)
	{
		case "1am":
			return "01h";
			break;
		case "2am":
			return "02h";
		case "3am":
			return "03h";
			break;
		case "4am":
			return "04h";
			break;
		case "5am":
			return "05h";
			break;
		case "6am":
			return "06h";			
			break;
		case "7am":
			return "07h";
			break;
		case "8am":
			return "08h";
			break;
		case "9am":
			return "09h";
			break;
		case "10am":
			return "10h";
			break;
		case "11am":
			return "11h";
			break;
		case "12am":
			return "00h";
			break;
		case "1pm":
			return "13h";
			break;
		case "2pm":
			return "14h";
			break;
		case "3pm":
			return "15h";
			break;
		case "4pm":
			return "16h";
			break;
		case "5pm":
			return "17h";
			break;
		case "6pm":
			return "18h";
			break;
		case "7pm":
			return "19h";
			break;
		case "8pm":
			return "20h";
			break;
		case "9pm":
			return "21h";
			break;
		case "10pm":
			return "22h";
			break;
		case "11pm":
			return "23h";
			break;
		case "12pm":		
			return "12h";
			break;
		default:
			return strTime	
	}
}

function translateWind(strTxt)
{
	if(strTxt =="") return; 
	strTxt=strTxt.replace("From","")
	
	//SE
	strTxt=strTxt.replace("ESE","&#272;&#272;N")
	strTxt=strTxt.replace("WSE","T&#272;N")	
	strTxt=strTxt.replace("NSE","B&#272;N")
	strTxt=strTxt.replace("SSE","N&#272;N")		
	
	//NE
	strTxt=strTxt.replace("ENE","&#272;&#272;B")
	strTxt=strTxt.replace("WNE","T&#272;B")
	strTxt=strTxt.replace("SNE","N&#272;B")
	strTxt=strTxt.replace("NNE","B&#272;B")
	
	//SW
	strTxt=strTxt.replace("WSW","TTN")
	strTxt=strTxt.replace("ESW","&#272;TN")
	strTxt=strTxt.replace("NSW","BTN")
	strTxt=strTxt.replace("SSW","NTN")
	
	//NW
	strTxt=strTxt.replace("WNW","TTB")
	strTxt=strTxt.replace("ENW","&#272;TB")
	strTxt=strTxt.replace("SNW","NTB")
	strTxt=strTxt.replace("NNW","BTB")	
	
	
	strTxt=strTxt.replace("SW","TN")
	strTxt=strTxt.replace("NW","TB")
	strTxt=strTxt.replace("NE","&#272;B")
	strTxt=strTxt.replace("SE","&#272;N")
	
	strTxt=strTxt.replace("S","N")
	strTxt=strTxt.replace("N","B")
	strTxt=strTxt.replace("W","T")
	strTxt=strTxt.replace("E","&#272;")

	strTxt=strTxt.replace("calm","l&#7863;ng")
	
	return strTxt+"<br>"	
}

/*--Movie rating--*/
var imgVoted = new Image();
var imgHalf = new Image();
var imgEmpty = new Image();
imgVoted.src="Images/Rating/saosang.gif";
imgHalf.src="Images/Rating/saonua.gif";
imgEmpty.src="Images/Rating/saomo.gif";

function DrawVote(nguyen,du)
{
	nguyen=parseInt(nguyen);
	du=parseInt(du);
	for(a=1;a<=nguyen;a++)
	{
		document['level'+a].src=imgVoted.src;	
	}	
	if(nguyen<5)
	{
		if(du==-1)
		{
			document['level'+(nguyen+1)].src=imgHalf.src;
			for(var b=(nguyen+2);b<=5;b++)
			{
				document['level'+b].src=imgEmpty.src;
			}
		}
		else
		{
			for(var b=(nguyen+1);b<=5;b++)
			{
				document['level'+b].src=imgEmpty.src;
			}
		}
	}
}
/*--Movie rating--*/

function Edit_Title(strVal, strChar) {
	if(InStr(0, strVal, strChar) > 0) {
		strVal = Left(strVal, InStr(0, strVal, strChar))
	}
	return strVal;
}

function Check_Title(strVal, intLength) {
	if(strVal.length > intLength) {
		return false;
	}
	else {
		return true;
	}
}

function LeadChar(strVal, strChar, intLength) {
	while(strVal.length < intLength) {
		strVal = strChar + strVal;
	}
	return strVal;
}

// ******************Collapse & Expand***********

imgout=new Image(9,9);
imgin=new Image(9,9);

/////////////////BEGIN USER EDITABLE///////////////////////////////
	imgout.src="Images/u.gif";
	imgin.src="Images/d.gif";
///////////////END USER EDITABLE///////////////////////////////////

//this switches expand collapse icons
function filter(imagename,objectsrc){
	if (document.images){
		document.images[imagename].src=eval(objectsrc+".src");
	}
}

//show OR hide funtion depends on if element is shown or hidden
function shoh(id) { 
	
	if (document.getElementById) { // DOM3 = IE5, NS6
		if (document.getElementById(id).style.display == "none"){
			document.getElementById(id).style.display = 'block';
			filter(("img"+id),'imgin');			
		} else {
			filter(("img"+id),'imgout');
			document.getElementById(id).style.display = 'none';			
		}	
	} else { 
		if (document.layers) {	
			if (document.id.display == "none"){
				document.id.display = 'block';
				filter(("img"+id),'imgin');
			} else {
				filter(("img"+id),'imgout');	
				document.id.display = 'none';
			}
		} else {
			if (document.all.id.style.visibility == "none"){
				document.all.id.style.display = 'block';
			} else {
				filter(("img"+id),'imgout');
				document.all.id.style.display = 'none';
			}
		}
	}
}
//****************************

function checkKeyEnter(e)
{
	 var key;
     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox
      if(key == 13)
          return true;
     else
          return false;
}

// ****************** function selectNodes() for Mozilla Firefox************************

if( document.implementation.hasFeature("XPath", "3.0") )
{
	XMLDocument.prototype.selectNodes = function(cXPathString, xNode)
	{
		if( !xNode ) { xNode = this; } 

		var oNSResolver = this.createNSResolver(this.documentElement)
		var aItems = this.evaluate(cXPathString, xNode, oNSResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
		var aResult = [];
		for( var i = 0; i < aItems.snapshotLength; i++)
		{
			aResult[i] =  aItems.snapshotItem(i);
		}
		
		return aResult;
	}
	XMLDocument.prototype.selectSingleNode = function(cXPathString, xNode)
	{
		if( !xNode ) { xNode = this; } 

		var xItems = this.selectNodes(cXPathString, xNode);
		if( xItems.length > 0 )
		{
			return xItems[0];
		}
		else
		{
			return null;
		}
	}

	Element.prototype.selectNodes = function(cXPathString)
	{
		if(this.ownerDocument.selectNodes)
		{
			return this.ownerDocument.selectNodes(cXPathString, this);
		}
		else{throw "For XML Elements Only";}
	}

	Element.prototype.selectSingleNode = function(cXPathString)
	{	
		if(this.ownerDocument.selectSingleNode)
		{
			return this.ownerDocument.selectSingleNode(cXPathString, this);
		}
		else{throw "For XML Elements Only";}
	}

}

function MM_preloadImages() { //v3.0
  var d=document;
  if(d.images)
  { 
    if(!d.MM_p) 
      d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
    for(i=0; i<a.length; i++)
      if (a[i].indexOf("#")!=0)
      {
        d.MM_p[j]=new Image;
        d.MM_p[j++].src=a[i];
      }
  }
}
//Preload Images Weather
/*for(a=1;a<=48;a++)
{
	MM_preloadImages('Images/Weather/'+a+'.gif');
}
MM_preloadImages('Images/newline.gif');*/
function AutoMoveVertical(sID, intHeight) {	
	if(document.getElementById(sID)) {
		document.getElementById(sID).style.top = document.body.clientHeight + document.body.scrollTop - intHeight;
		document.getElementById('iXGCT').style.top = document.body.clientHeight + document.body.scrollTop - intHeight;
		//DivSetVisible1(100, document.body.clientHeight + document.body.scrollTop - intHeight);
	}
}

function AutoMoveVerticalTry(sID, intHeight) {	
	if(document.getElementById(sID)) {
			document.getElementById(sID).style.top = document.body.clientHeight + document.body.scrollTop - intHeight;
			document.getElementById('iTry').style.top = document.body.clientHeight + document.body.scrollTop - intHeight;
			DivSetVisible1Try(100, document.body.clientHeight + document.body.scrollTop - intHeight);
	}
}

function FormatNo(val1, val2) {
	val1 += '';
	var sResult = '';
	var intLoop = Math.floor(val1.length/3);
	if(val1.length % 3 == 0) intLoop --;
	for(var i=0;i<intLoop;i++) {
		sResult = val2 + '' + val1.substring(val1.length - 3, val1.length) + sResult;
		val1 = val1.substring(0, val1.length - 3);
	}
	sResult = val1 + sResult;
	return sResult;
}
//**************************************************************************************
