﻿// JScript File
function ShowDisplay(s)
{
	if(document.getElementById(s).style.display == "none")
	{
		document.getElementById(s).style.display = "block";
	}
	else
	{
		document.getElementById(s).style.display = "none";
	}
}

function KeepStatusDataList()
{
    try
    {
	    var vars = [], hash;
	    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
	    for (var i = 0; i < hashes.length; i++)
	    {
		    hash = hashes[i].split('=');
		    //vars.push(hash[0]);
		    //vars[hash[0]] = hash[1];
	    }
	    var p = hashes[0].split('=');
	    if(p[1] == "nsp" || p[1] == "bsp" || p[1] == "ctsp")
	    {
		    var s = hashes[1].split('=');
		    if(s[0] == "cid")
			    document.getElementById('show'+s[1]).style.display = "block";
	    }
	}
	catch (err)
	{}
}

function thunho(s,hqc,yqc,mt)
{    
    var h;
    var y;
    var t;
    
    eval("h = " + hqc +";");
    eval("y = " + yqc +";");
    eval("t  = " + mt + ";");
    if (h>50)
    {
        h = h - 10;
        y = y - 5;
        t = t + 5;
        
        eval(hqc + " = h" +";");        
        eval(yqc + " = y" + ";");
        eval(mt + " = t" + ";");    
        
        var height;   
        var py;    
        var pmt;
        height = h + "px";       
        py = y + "px";
        pmt = t + "px";    
        document.getElementById(s).style.height = height;
        document.getElementById(s).style.backgroundPositionY = py;
        //document.getElementById(s).style.marginTop = pmt;
        eval ("setTimeout(\"thunho('" + s + "', '" + hqc + "', '" + yqc + "', '" + mt + "')\",50);");        
    }
}

function phongto(s,hqc,yqc,mt)
{
    var h;
    var y;
    var t;
    
    eval("h = " + hqc +";");
    eval("y = " + yqc +";");
    eval("t  = " + mt + ";");
    if (h<150)
    {
        h = h + 10;
        y = y + 5;
        t = t - 5;
        
        eval(hqc + " = h" +";");        
        eval(yqc + " = y" + ";");
        eval(mt + " = t" + ";");    
        
        var height;   
        var py;    
        var pmt;
        height = h + "px";       
        py = y + "px";
        pmt = t + "px";    
        document.getElementById(s).style.height = height;
        document.getElementById(s).style.backgroundPositionY = py;
        //document.getElementById(s).style.marginTop = pmt;
        eval ("setTimeout(\"phongto('" + s + "', '" + hqc + "', '" + yqc + "', '" + mt + "')\",50);"); 
    }  
}

function LinkSearchLon(s, manhom)
{
    x.innerHTML = document.getElementById(s).innerHTML;
    x.style.background = "#316ac5";
    x.style.color = "#ffffff";
	z.value = manhom;
	document.getElementById("show").style.display = "none";
}

function LinkSearchNho(s, manhom)
{  
    x.innerHTML = document.getElementById(s).innerHTML;
    x.style.background = "#316ac5";
    x.style.color = "#ffffff";
	z.value = manhom;
	document.getElementById("show").style.display = "none";
}

function LinkSearchLBL()
{
    x.innerHTML = y.innerHTML;
    x.style.background = "#316ac5";
    x.style.color = "#ffffff";
    z.value = "0";
	t.value = "0";
	document.getElementById("show").style.display = "none";
	document.getElementById("divkd").style.display = "none";
	document.getElementById("divcm").style.display = "none";
	document.getElementById("divdccho").style.display = "none";
	document.getElementById("divcho").style.display = "none";
	document.getElementById("divdc").style.display = "block";
	document.getElementById("divquan").style.display = "block";
}

function setShow(s)
{
    bdivshow = s;
}

function ShowDDL(s)
{
	if(document.getElementById("show").style.display == "none")
	{
		document.getElementById("show").style.display = "block";
	    y.style.background = "#316ac5";
        y.style.color = "#ffffff";
        if(x.style.background == "#316ac5")
        {
            x.style.background = "#ffffff";
            x.style.color = "#000000";
        }		
	}
	else
	{
		document.getElementById("show").style.display = "none";
        x.style.background = "#316ac5";
        x.style.color = "#ffffff";
	}
}

function HideDDL(s)
{
    if (bdivshow == 0)
    {
	    document.getElementById("show").style.display = "none";
	}
    x.style.background = "#ffffff";
    x.style.color = "#000000";
}

function setBglbl()
{
    y.style.background = "#316ac5";
    y.style.color = "#ffffff";
}

function setOver(s)
{
    y.style.background = "#ffffff";
    y.style.color = "#000000";
    document.getElementById(s).style.background = "#316ac5";
    document.getElementById(s).style.color = "#ffffff";
}

function setOut(s)
{
    document.getElementById(s).style.background = "#ffffff";
    document.getElementById(s).style.color = "#000000";
}

function bgOver()
{
    img.style.background = "#ffffff url(images/hover.jpg) no-repeat right";
}

function bgOut()
{
    img.style.background = "#ffffff url(images/arrow.jpg) no-repeat right";
}

function setBg()
{
    x.style.background = "#ffffff";
    x.style.color = "#000000";
}

function LinkImgBo(hinhanh, ten)
{
    i.innerHTML = "<img src='" + hinhanh + "' />";
    j.innerHTML = ten;
}

function LinkSearchCS(s)
{
    x.innerHTML = document.getElementById(s).innerHTML;
    x.style.background = "#316ac5";
    x.style.color = "#ffffff";
	z.value = "cs";
	t.value = "Tin chia sẻ";
	document.getElementById("show").style.display = "none";
	document.getElementById("divkd").style.display = "none";
	document.getElementById("divcm").style.display = "none";
	document.getElementById("divdccho").style.display = "none";
	document.getElementById("divcho").style.display = "none";
	document.getElementById("divdc").style.display = "block";
	document.getElementById("divquan").style.display = "block";
}

function LinkSearchKD(s)
{
    x.innerHTML = document.getElementById(s).innerHTML;
    x.style.background = "#316ac5";
    x.style.color = "#ffffff";
	z.value = "kd";
	t.value = "Tin kinh doanh";
	document.getElementById("show").style.display = "none";
	document.getElementById("divkd").style.display = "block";
	document.getElementById("divcm").style.display = "none";
	document.getElementById("divdccho").style.display = "none";
	document.getElementById("divcho").style.display = "none";
	document.getElementById("divdc").style.display = "block";
	document.getElementById("divquan").style.display = "block";
}

function LinkSearchCM(s)
{
    x.innerHTML = document.getElementById(s).innerHTML;
    x.style.background = "#316ac5";
    x.style.color = "#ffffff";
	z.value = "cm";
	t.value = "Tin chuyên mục";
	document.getElementById("show").style.display = "none";
	document.getElementById("divcm").style.display = "block";
	document.getElementById("divdccho").style.display = "none";
	document.getElementById("divcho").style.display = "none";
	document.getElementById("divkd").style.display = "none";
	document.getElementById("divdc").style.display = "block";
	document.getElementById("divquan").style.display = "block";
}

function LinkSearchCH(s)
{
    x.innerHTML = document.getElementById(s).innerHTML;
    x.style.background = "#316ac5";
    x.style.color = "#ffffff";
	z.value = "ch";
	t.value = "Gian hàng chợ";
	document.getElementById("show").style.display = "none";
	document.getElementById("divdccho").style.display = "block";
	document.getElementById("divcho").style.display = "block";
	document.getElementById("divkd").style.display = "none";
	document.getElementById("divcm").style.display = "none";
	document.getElementById("divdc").style.display = "none";
	document.getElementById("divquan").style.display = "none";
}
