	/*
	function Dump(ob)
	{
		var txt = "";
		for( var element in ob )
		{
			txt += "Element: " + element + ", Typeof(ob[element]) " + typeof(ob[element]) + "\n";
		}
		WriteDebug("Typeof(ob): "+typeof(ob)+",  Object " + ob);
		WriteDebug(txt);
	}
	function WriteDebug(message, file_debug)
	{
		try{
			if( file_debug == null ) file_debug = "D:\\Nhat\\Projects\\BiQuyet\\log_js\\logs.log";
			var fso = new ActiveXObject("Scripting.FileSystemObject");
			var f = fso.OpenTextFile(file_debug, 8, true);
			f.WriteLine(message);
			f.Close();
		}catch(e)
		{
			alert("WriteDebug Error: " + e.message);
		}
	}
	*/
	var ie=null, ns6 = null, opera = null;
	if( document.all )
	{
		ie = document.all;
		ns6 = null;
	}
	else if( document.getElementById )
	{
		ie = null;
		ns6 = document.getElementById && !document.all;
	}
	if( window.opera ) opera = window.opera;
	
	var offsetfromcursorX=12 //Customize x offset of tooltip
	var offsetfromcursorY=10 //Customize y offset of tooltip
	
	function ietruebody()
	{
		if( document.body )
			return document.body;
		if( document.documentElement )
			return document.documentElement;
		return null;
	}
	
	function getMouseX(e)
	{
		if (!e) /* For IE. */
			e = window.event;
		
		return ((ns6)?e.pageX : e.clientX+ietruebody().scrollLeft);
	}
	
	function getMouseY(e)
	{
		if (!e) /* For IE. */
			e = window.event;
		
		return ((ns6)?e.pageY : e.clientY+ietruebody().scrollTop);
	}
	
	var timeIntervalShowImage;
	var activeImage = null;
	var oldImage = null;
	
	var winwidth = (ie && !opera)? ietruebody().clientWidth : window.innerWidth-20
	var winheight = (ie && !opera)? ietruebody().clientHeight : window.innerHeight-20
	var divImage = null;
	var old_x = 0;
	var old_y = 0;
	var INNER  = 1;
	var OUTTER = 2;
	
	function enableMouseDown()
	{
		document.onmousedown = actionMouseDown;
	}
	function disableMouseDown()
	{
		document.onmousedown = '';
	}
	function actionMouseDown(event)
	{
		
	}

var timeInterval;
var img_name = '';
var winwidth = (ie&&!window.opera) ? ietruebody().clientWidth : (window.innerWidth-20);
var winheight = (ie&&!window.opera) ? ietruebody().clientHeight : (window.innerHeight-20);
var img_div_id = 'divShowImg';

var img_div = null;						
initDivShowImg();
	
function initDivShowImg()
{
	img_div = document.getElementById('divShowImg'); 
}
function setTime_Hidden()
{
	// timeInterval = setInterval("hideDivImage();",5000);
}					
function clearTime_Hidden()	
{
	try{ clearInterval(timeInterval); } catch(ex){}															
}

function isImgDisplay(e)
{
	for( var i = 0; i < e.attributes.length; i++ )
	{
		if( e.attributes[i].nodeName == '_display' ) return true;
	}
	return false;
}
function imgAddThumbnail(e) {
	var imgPreloader = new Image();
	imgPreloader.src = e.src;
	var a = document.createElement('a');
	var href = "#thumb";
	// alert("Width " + imgPreloader.width + ", Height " + imgPreloader.height + ', W ' + e.width + ', H ' + e.height);
	/*
	if(e.parentNode.tagName == 'DIV')
	{
		// e.parentNode.style.width = e.width + 10 + 'px';
		// e.parentNode.style.height = e.height + 10 + 'px';
	}
	else 
	*/
	if(e.parentNode.tagName == 'A')
	{
		a = e.parentNode;
		href = "";
	}
	if( (imgPreloader.width > e.width) || (imgPreloader.height > e.height)) 
	{
		a.className="thumbnail";
		if(href != "")
		{
			a.href = href;
			a.innerHTML = '<img width="'+e.width+'" height="'+e.height+'" border="0" alt="" src="'+e.src+'"/><span><img src="'+e.src+'" alt="" border="0" /></span>';
			e.parentNode.insertBefore(a, e);
			a = e.previousSibling;
			a.parentNode.removeChild(e);
		}
		else
			a.innerHTML = '<img width="'+e.width+'" height="'+e.height+'" border="0" alt="" src="'+e.src+'"/><span><img src="'+e.src+'" alt="" border="0" /></span>';
	}
}

function initAllImageDisplay() {
	if(true) return;
	var aImg = document.getElementsByTagName('img');
	if(!aImg) aImg = document.getElementsByTagName('IMG');
	for( var i = 0; i < aImg.length; i++)
	{
		// if( isImgDisplay(aImg[i]) ) imgAddThumbnail(aImg[i]);
	}
}

function $() 
{
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) 
	{
		var element = arguments[i];
		if (typeof element == 'string')
		{
			if(document.getElementById)
				element = document.getElementById(element);
			else element = document.all(element);
		}
		if (arguments.length == 1)
		  return element;
		elements.push(element);
	}
	return elements;
}
function ObjByTagAtt(tag, att, attVal)
{
    var o = document.getElementsByTagName(tag);
    if(att && o)
    {
        var a = [];
        if(att)
        {
            if( attVal )
            {
                for(var i = 0; i < o.length; i++)
                    if( o[i].attributes[att] && o[i].attributes[att].nodeValue==attVal) a.push(o[i]);
            }
            else
            {
                for(var i = 0; i < o.length; i++)
                    if( o[i].attributes[att] ) a.push(o[i]);
            }
        }
        return a;
    }
    return o;
}

function RemoveAdvs()
{
	var divs = document.body.childNodes;
	var i = 0;
	for(i = 0; i < divs.length; i++)
	{
		if( (typeof(divs[i]) == 'object') && (divs[i].tagName == 'DIV') && (divs[i].className == 'footer') )
		{
			while( divs[i] )
			{
				if((typeof(divs[i]) == 'object') && (divs[i].tagName == 'SCRIPT'))
					break;
				document.body.removeChild(divs[i]);
			}
			break;
		}
	}
}
function addYahooScript() {
	var head = document.getElementsByTagName("head").item(0);
	var root = '/biquyet';
	var script = document.createElement('script');
	script.type='text/javascript';
	script.src=root+'/js/yahoo/DDOnTop.js';
	head.appendChild(script);
	
	script = document.createElement('script');
	script.type='text/javascript';
	script.src=root+'/js/yahoo/dom.js';
	head.appendChild(script);
	
	script = document.createElement('script');
	script.type='text/javascript';
	script.src=root+'/js/yahoo/dragdrop.js';
	head.appendChild(script);
	
	script = document.createElement('script');
	script.type='text/javascript';
	script.src=root+'/js/yahoo/event.js';
	head.appendChild(script);
	
	script = document.createElement('script');
	script.type='text/javascript';
	script.src=root+'/js/yahoo/yahoo.js';
	head.appendChild(script);
}

var aText = Array("Home", "Trang chủ", "Administrator", "Nam", "Nữ", "Nước hoa cho nam", "Nước hoa cho nữ", "Nước hoa mới&nbsp;", "Bclub!" );
var fault = "";
function Find( t  )
{
	for( var i = 0; i < aText.length; i++ )
	{
		if(aText[i] == t)
		{
			fault += "Founded: \"" + t + "\"\n";
			return i;
		}
	}
	return -1;
}

function init_all_A() {
	var pro = document.getElementById("pro");
	alert('provalue'+pro.value);
	if( typeof(pro) == "undefined" ) return;
	var rootLink = "";
	var newLink = "";
	var ea = document.getElementsByTagName("A");
	if( !ea ) ea = document.getElementsByTagName("a");
	
	var url = document.location.href;
	var i=url.indexOf("index.php");
	if( i > -1 )
	{
		rootLink = url.substr(0, i+9);
		newLink = rootLink + "#";
		// alert("rootLink: " + rootLink + "\n newLink: " + newLink);
	}
	if( ea.length > 0 && pro.value != "" )
	{
		var iii = 0;
		for(i = 0; i < ea.length; i++)
		{
			if( ea[i].tagName == "A" )
			{
				var ref = ea[i].href.indexOf("javascript");
				if( ref == -1 ) 
				{
					if(!((ea[i].href == "index.php") || 
						 (Find(ea[i].innerHTML) > -1) 
						) )
					{
						if( ea[i].innerHTML != "Trang chủ" ) 
						{
							if( ea[i].href.indexOf("#") > -1 ) 
							{
								// ea[i].href = rootLink + "?pro=" + pro.value;
							}
							else if(ea[i].href != "" && ea[i].href ) {}
								//ea[i].href = ea[i].href + "&pro=" + pro.value;
								//ea[i].href = ea[i].href + "/" + pro.value;
						}
					}
				}
			}
		}
		// if(fault.length > 0) alert(fault);
	}
	// alert("2 ea.length: \"" + ea.length + "\", pro: \"" + pro.value + "\"");
}

String.prototype.trim = function() {
	var s = this.replace(/^\s+|\s+$/g,"");
	var p = -1;
	var nbsp = "&nbsp;";
	p = s.indexOf(nbsp);
	while(p == 0)
	{
		s = s.substr(6).t.replace(/^\s+/,"");
		p = s.indexOf(nbsp);
	}
	p = s.substr(s.length-nbsp.length);
	while(p == nbsp)
	{
		s = s.substr(0, s.length-nbsp.length).replace(/^\s+/,"");
		p = s.substr(s.length-nbsp.length);
	}
	return s;
	// return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	var s = this.replace(/^\s+/,"");
	var p = -1;
	var nbsp = "&nbsp;";
	p = s.indexOf(nbsp);
	while(p == 0)
	{
		s = s.substr(6).replace(/^\s+/,"");
		p = s.indexOf(nbsp);
	}
	return s;
	//return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	var s = this.replace(/^\s+/,"");
	var p = -1;
	var nbsp = "&nbsp;";
	p = s.indexOf(nbsp);
	p = s.substr(s.length-nbsp.length);
	while(p == nbsp)
	{
		s = s.substr(0, s.length-nbsp.length).replace(/^\s+/,"");
		p = s.substr(s.length-nbsp.length);
	}
	return s;
	// return this.replace(/\s+$/,"");
}
function showImageFullSize() {
	var a = ObjByTagAtt('div', 'class', 'mosimagespan');
	var i = 0;
	for(i=0; i < a.length; i++) {
		a[i].style.width="";
		a[i].style.height="";
		for(var j = 0; j < a[i].childNodes.length; j++) {
			if(a[i].childNodes[j].nodeName == 'IMG') {
				a[i].childNodes[j].width="";
				a[i].childNodes[j].height="";
				// var img = document.createElement('img');
				// img.src = a[i].childNodes[j].src;
			}
		}
	}
	return true;
}
function hideLinkTrangChu() {
	var a = $('active_menu_main_menu');
	if(!a) {
		var _a = ObjByTagAtt('a', 'class', 'mainlevel_main_menu');
		for(var i = 0; i < _a.length; i++) {
			if(_a[i].innerHTML == 'Trang chủ' || _a[i].innerHTML == 'Trang Chủ') {
				a = _a[i];
				break;
			}
		}
	}
	if(!a) {
		var div = $('jsCookMenuID1');
		if( div.childNodes[0] && div.childNodes[0].nodeName == 'TABLE' ) {
			div.childNodes[0].rows[0].style.display = 'none';
		}
	}
	if(a != undefined && a && a.nodeName == 'A') {
		a.style.display='none';
		a.parentNode.style.display='none';
		a.parentNode.parentNode.style.display='none';
		var td = a.parentNode.parentNode.nextSibling;
		if(td.nodeName == '#text') td = a.parentNode.parentNode.nextSibling.nextSibling.cells[0];
		else td = a.parentNode.parentNode.nextSibling.cells[0];
		td.style.paddingTop = "6px";
	}
	return true;
}
function hideDivObsolute() {
	var div = $("div_obsolute");
	if( div != null ) {
		div.style.visibility = "visible";
		div.style.left = 0;
	}
	if( div != null ) {
		div.style.visibility = "hidden";
		div.style.left = -1024;
	}
}

function a51(){
	var a = null, table = null;
	var d = $('buttons');
	var i = 0;
	for(i = 0; i < d.childNodes.length; ) {
		if(d.childNodes[i].nodeName == "#text")
			d.removeChild(d.childNodes[i]);
		else if( d.childNodes[i].nodeName == "TABLE" ) {
			table = d.childNodes[i]; 
			i++
		}
		else
			i++
	}
	a = table.rows[0].cells[0].childNodes[0];
	a.href = a.href.replace("Itemid=51", "Itemid=1");
}

function MyPageOnLoad() {
	this._loaded = false; 
	this.page_func = new Array();
	var myPage = this;
	
	this.autoRun = function()
	{
		var i = 0; 
		for(i = 0; i < myPage.page_func.length; i++) {
			try{
				if(typeof(myPage.page_func[i]) == 'function' )
					myPage.page_func[i].call();
				else 
					eval(myPage.page_func[i]);
			}catch(e){}
		}
	},
	this.AddLoadObserve=function(sNameObserver, useCapture)
	{
		if( !((typeof(sNameObserver) == 'string') || (typeof(sNameObserver) == 'function' )) ) return;
		if( typeof(myPage.page_func) == "undefined" )
			myPage.page_func = new Array();
		myPage.page_func.push(sNameObserver);
		if( myPage._loaded == true ) return;
		if (window.addEventListener) window.addEventListener('load', myPage.autoRun, useCapture);
		else if (window.attachEvent) window.attachEvent('onload', myPage.autoRun);
		myPage._loaded = true;
	}
}

//var pageLoad = new MyPageOnLoad();
//pageLoad.AddLoadObserve(hideDivObsolute, false);
//pageLoad.AddLoadObserve(hideLinkTrangChu, false);
//pageLoad.AddLoadObserve(init_all_A, false);
//pageLoad.AddLoadObserve(a51, false);
	