function ShowPlayer(fname) {
	//alert(fname);
   		document.getElementById('MyBox').innerHTML = '<iframe name="Play" src="http://ephim.com'+fname+'" width="0%" height="0" frameborder=0></iframe>';					
}



function PageSet(str,vPage)

{

	initProgressBar('movie/movie.php?p='+ vPage+'&Link='+str,'','Show_movie',10);
}

/*
var fBrw=(navigator.userAgent.indexOf('MSIE')!= -1 && navigator.userAgent.indexOf('Windows')!= -1);

var fDSp=(typeof(document.getElementById)!='undefined');

if (typeof(PageHost) == 'undefined') {

	var PageHost = '';

}

function ShowPlayer(fname) {
   		document.getElementById('MyBox').innerHTML = '<iframe name="Play" src="'+fname+'" 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 LanguageSet(PageLang) {
	setCookie('Profile.Langs', '/', '', PageLang);
	getURL = document.location.href;
	if (NoOfChar('/', getURL) >= 7) {	
//	if (getURL.length>=43) {
		if (PageLang==1) {
			getURL = getURL + "Page_1.Asp";
		} else {
			getURL = getURL.replace("Page_1.Asp","");
		}
		document.location.href = getURL;
	} else {
		document.location.reload();
	}
}

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 ChangeBanner()

{

	if (RefBanner.length==0)

		return;



	CurBanner++;

	if (CurBanner >= RefBanner.length)

	{

		CurBanner=0;

	}



	document.links[BannerLnk].href= RefBanner[CurBanner][1];

	document.images['TopBanner'].src = PageHost.concat(RefBanner[CurBanner][0]);

	if (RefBanner[CurBanner][1] == '')

	{

		document.links[BannerLnk].onclick = function() { return false; };

	}

	else

	{

		document.links[BannerLnk].onclick = function() { return eval('openMeExt(this, '.concat(RefBanner[CurBanner][2]).concat(', 1)')); };

	}

}



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;

	}

	

	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 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 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 req;
var response;

function loadXMLDoc(url, callbackFunction, QUERY_STRING) 
{		
	
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
		req.onreadystatechange =	function()
									{
										// only if req shows "complete"
										if (req.readyState == 4) {
											// only if "OK"
											if (req.status == 200) {
												// ...processing statements go here...
												if(req.responseXML)
												{
													if(req.responseXML.getElementsByTagName('server').length)
													{
														alert(req.responseXML.getElementsByTagName('server').item(0).getAttribute('message'));
													}
													else
													{
														response  = req.responseXML.documentElement;
														eval(callbackFunction);
													}
												}
											}
											else {
												window.status = ("There was a problem retrieving the XML data:\n" + req.statusText);
											}
										}
									}
		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) {
												// only if "OK"
												if (req.status == 200) {
													// ...processing statements go here...
													if(req.responseXML)
													{
														if(req.responseXML.getElementsByTagName('server').length)
														{
															alert(req.responseXML.getElementsByTagName('server').item(0).getAttribute('message'));
														}
														else
														{
															response  = req.responseXML.documentElement;
															eval(callbackFunction);
														}
													}
												}
												else {
													window.status = ("There was a problem retrieving the XML data:\n" + req.statusText);
												}
											}
										}
			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);
			}
        }
    }
}
/********************************************************/

/*--Start Popup--------------------------------------------------------*/
function modelesswin(url,mwidth,mheight){
	if (document.all&&window.print) //if ie5
		eval('window.showModelessDialog(url,"","help:0;resizable:0;dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px")')
	else
		eval('window.open(url,"","width='+mwidth+'px,height='+mheight+'px,resizable=1,scrollbars=1")')
}

function modalwin(url,mwidth,mheight){
	if (document.all&&window.print) //if ie5
		//eval('window.showModalDialog(url,"","help:0;resizable:0;dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px")')
		eval('window.open(url,"","width='+mwidth+'px,height='+mheight+'px,resizable=0,scrollbars=0")')
	else
		eval('window.open(url,"","width='+mwidth+'px,height='+mheight+'px,resizable=0,scrollbars=0")')
}
/*--End Popup--------------------------------------------------------*/

/*--Start PopupMenu--------------------------------------------------*/
/*
var defaultMenuWidth="150px" //set default menu width.

var linkset=new Array()
//SPECIFY MENU SETS AND THEIR LINKS. FOLLOW SYNTAX LAID OUT

linkset[0]='<a href="/F/Giai-Tri/The-Thao">Th&#7875; thao</a>'
linkset[0]+='<a href="/F/Giai-Tri/Quang-Cao">Qu&#7843;ng c&#225;o</a>'
linkset[0]+='<a href="/F/Giai-Tri/Bieu-Dien">Bi&#7875;u di&#7877;n</a>'
linkset[0]+='<a href="/F/Giai-Tri/Tong-Hop">T&#7893;ng h&#7907;p</a>'
	
linkset[1]='<a href="javascript:modalwin(\'/M/Album/AlbumSong.asp?AlbumID=20329\',295,550)">Billboard top 100 - 1997</a>'
linkset[1]+='<a href="javascript:modalwin(\'/M/Album/AlbumSong.asp?AlbumID=20330\',295,550)">Billboard top 100 - 1998</a>'
linkset[1]+='<a href="javascript:modalwin(\'/M/Album/AlbumSong.asp?AlbumID=20331\',295,550)">Billboard top 100 - 1999</a>'
linkset[1]+='<a href="javascript:modalwin(\'/M/Album/AlbumSong.asp?AlbumID=20332\',295,550)">Billboard top 100 - 2000</a>'
linkset[1]+='<a href="javascript:modalwin(\'/M/Album/AlbumSong.asp?AlbumID=20333\',295,550)">Billboard top 100 - 2001</a>'
linkset[1]+='<a href="javascript:modalwin(\'/M/Album/AlbumSong.asp?AlbumID=21000\',295,550)">Billboard top 100 - 2002</a>'
linkset[1]+='<a href="javascript:modalwin(\'/M/Album/AlbumSong.asp?AlbumID=20334\',295,550)">Billboard top 100 - 2003</a>'
linkset[1]+='<a href="javascript:modalwin(\'/M/Album/AlbumSong.asp?AlbumID=20335\',295,550)">Billboard top 100 - 2004</a>'
linkset[1]+='<a href="#">Billboard top 100 - 2005</a>'

////No need to edit beyond here

var ie5=document.all && !window.opera
var ns6=document.getElementById

if (ie5||ns6)
document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')

function iecompattest(){
return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
}

function showmenu(e, which, optWidth){
if (!document.all&&!document.getElementById)
return
clearhidemenu()
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
menuobj.innerHTML=which
menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth
menuobj.contentwidth=menuobj.offsetWidth
menuobj.contentheight=menuobj.offsetHeight
eventX=ie5? event.clientX : e.clientX
eventY=ie5? event.clientY : e.clientY
//Find out how close the mouse is to the corner of the window
var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.contentwidth)
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px"
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX+"px" : window.pageXOffset+eventX+"px"
//same concept with the vertical position
if (bottomedge<menuobj.contentheight)
menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px"
else
menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY+"px" : window.pageYOffset+eventY+"px"
menuobj.style.visibility="visible"
return false
}

function contains_ns6(a, b) {
//Determines if 1 element in contained in another- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function hidemenu(){
if (window.menuobj)
menuobj.style.visibility="hidden"
}

function dynamichide(e){
if (ie5&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}

if (ie5||ns6)
document.onclick=hidemenu
*/
/*--End PopupMenu----------------------------------------------------------*/

