﻿// JavaScript Document
function ShowLeftMenu()
{
	var leftMenu = new Array();
	
	//<a class="link" href="../phongtruchuot.php#chuot">Phòng trừ chuột</a>
	//<a class="link" href="../phongtrumoi.php#moi">Phòng trừ mối</a>
	//<a class="link" href="../phongtrucontrung.php#contrung">Phòng trừ côn trùng</a>
	
	leftMenu[0] = '<a class="link" href="phongtruchuot.php">Phòng trừ chuột</a>';
	leftMenu[1] = '<a class="link" href="phongtrumoi.php">Phòng trừ mối</a>';
	leftMenu[2] = '<a class="link" href="phongtrucontrung.php">Phòng trừ côn trùng</a>';

	var url = document.URL;
	
	if (url.search("phongtruchuot.php") != -1)
		leftMenu[0] = '<a class="link" style="color: #ffcc00">Phòng trừ chuột</a>';
	if (url.search("phongtrumoi.php") != -1)
		leftMenu[1] = '<a class="link" style="color: #ffcc00">Phòng trừ mối</a>';
	if (url.search("phongtrucontrung.php") != -1)
		leftMenu[2] = '<a class="link" style="color: #ffcc00">Phòng trừ côn trùng</a>';
	return leftMenu;
}

function ShowTopMenu()
{
	var topMenu = new Array();
	
	//<a class="link" href="index.php">Trang chủ</a>
	//<a class="link" href="service.php">Dịch vụ</a>
	//<a class="link" href="products.php">Sản phẩm</a>
	//<a class="link" href="contact.php">Liên hệ</a>
	
	//<a class="link" style="color: #ffcc00">Trang chủ</a>
	
	topMenu[0] = '<a class="link" href="index.php">Trang chủ</a>';
	topMenu[1] = '<a class="link" href="dichvu.php">Dịch vụ</a>';
	topMenu[2] = '<a class="link" href="sanpham.php">Sản phẩm</a>';
	topMenu[3] = '<a class="link" href="tintuc.php">Tin tức</a>';
	topMenu[4] = '<a class="link" href="lienhe.php">Liên hệ</a>';
	
	var url = document.URL;
	
	if (url.search("index.php") != -1)
		topMenu[0] = '<a class="link" style="color: #ffcc00">Trang chủ</a>';
	if (url.search("dichvu.php") != -1)
		topMenu[1] = '<a class="link" style="color: #ffcc00">Dịch vụ</a>';
	if (url.search("sanpham.php") != -1)
		topMenu[2] = '<a class="link" style="color: #ffcc00">Sản phẩm</a>';
	if (url.search("tintuc.php") != -1)
		topMenu[3] = '<a class="link" style="color: #ffcc00">Tin tức</a>';
	if (url.search("lienhe.php") != -1)
		topMenu[4] = '<a class="link" style="color: #ffcc00">Liên hệ</a>';
	return topMenu;
}


function ShowGoBack()
{
	var goback = "";
	var url = document.URL;
	var site = new Array("index.php", "index.htm", "lienhe.php", "sanpham.php", "tintuc.php", "phongtruchuot.php", "phongtrucontrung.php", "phongtrumoi.php", "khutrungnongsan.php", "xulynuocthai.php", "vesinhmoitruong.php" );
	var i;
	var found = 0;
	for (i in site)
	{
		str_search = site[i];
		if (url.search(str_search) != -1)
		{
			found = 1;
			break;
		}
	}
	
	if ( (url == "http://dietchuotdietmoi.com") || (url == "http://www.dietchuotdietmoi.com") || (url == "http://dietchuotdietmoi.com/") || (url == "http://www.dietchuotdietmoi.com/") || (url == "http://www.dietchuot.co.cc") || (url == "http://dietchuot.co.cc") || (url == "http://www.dietchuot.co.cc/") || (url == "http://dietchuot.co.cc/") || (url == "http://www.dietchuotvn.com") || (url == "http://dietchuotvn.com") || (url == "http://www.dietchuotvn.com/") || (url == "http://dietchuotvn.com/") )
	{
		found = 1;
	}
	
	if (found == 0) {
		goback = "<tr><td align='right' bgcolor='#cfdef3' height='20'><a href='javascript:history.go(-1)' class='goback'>Quay Lại</a>&nbsp;&nbsp;</td></tr>";
	}
	return goback;
}

function mouseOverSubMenu(id)
{
	
	document.getElementById(id).style.display = 'block';	
	document.getElementById(id).style.visibility = 'visible';	
}

function mouseOver(id)
{
	if (id.search('_') != -1)
	{
		id = id.substr(0, id.length - 1);
	}
	
	document.getElementById(id).style.backgroundColor = '#cfdef3';	
	id = id + '_';
	document.getElementById(id).style.backgroundColor = '#cfdef3';
	id = id + '_';
	document.getElementById(id).src = 'images/topmenu_icon_.gif';
}

function mouseOut(id)
{
	if (id.search('_') != -1)
	{
		id = id.substr(0, id.length - 1);
	}
	
	document.getElementById(id).style.backgroundColor = '';		
	id = id + '_';
	document.getElementById(id).style.backgroundColor = '';
	id = id + '_';
	document.getElementById(id).src = 'images/topmenu_icon.gif';
}
