// JavaScript Document

var sPath = window.location.pathname;
//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);

var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
//alert(sPage)
switch(sPage)
{
	case "index.php":
	case "":
	document.getElementById("td1").className = 'menubakon';
	document.getElementById("mnu1").className = 'topmenuon';
	curmnu=1;
	break;
	case "aboutus.html":
	document.getElementById("td2").className = 'menubakon';
	document.getElementById("mnu2").className = 'topmenuon';
	curmnu=2;
	break;
	case "commercial_custom.html":
	case "commercial_special.html":
	document.getElementById("td3").className = 'menubakon';
	document.getElementById("mnu3").className = 'topmenuon';
	curmnu=3;
	break;
	case "residential_custom.html":
	case "residential_installation.html":
	document.getElementById("td4").className = 'menubakon';
	document.getElementById("mnu4").className = 'topmenuon';
	curmnu=4;
	break;
	case "products.php":
	case "product_stone_care.html":
	document.getElementById("td5").className = 'menubakon';
	document.getElementById("mnu5").className = 'topmenuon';
	curmnu=5;
	break;
	case "contactus.html":
	document.getElementById("td6").className = 'menubakon';
	document.getElementById("mnu6").className = 'topmenuon';
	curmnu=6;
	break;
	
}

function lightOn(objLink, mnunum)
{
	if(curmnu == mnunum)
	{
		return true;
	}
	objLink.parentNode.className = "menubakon";
}

function lightOff(objLink, mnunum)
{
	if(curmnu == mnunum)
	{
		return true;
	}
	objLink.parentNode.className = "menubak";
	
	
}




//-----------------------------------------------

/*Open Popup Window*/
var popUpWin=0;
function popUpWindow(URLStr,mywidth,myheight,myleft,mytop,myscroll)
	{
	if(popUpWin)
		{
		if(!popUpWin.closed) 
			{popUpWin.close();}
		}
	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + myscroll + ',resizable=no,copyhistory=yes,width='+mywidth+',height='+myheight+',left='+myleft+', top='+mytop+',screenX='+myleft+',screenY='+mytop+'');
	}

/*Open 2nd Popup Window*/
var popUpWin2=0;
function popUpWindow2(URLStr,mywidth,myheight,myleft,mytop,myscroll)
	{
	if(popUpWin2)
		{
		if(!popUpWin2.closed) 
			{popUpWin2.close();}
		}
	popUpWin2 = open(URLStr, 'popUpWin2', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + myscroll + ',resizable=no,copyhistory=yes,width='+mywidth+',height='+myheight+',left='+myleft+', top='+mytop+',screenX='+myleft+',screenY='+mytop+'');
	}


/*Check if single checkbox is selected*/
/*function isSingleSelected_bak(frm, chkname, recs)
	{
	if(recs == 0)
	  {
	  alert("no record");
	  return false;
	  }
	else
	  {
	  alert(eval("document." + frm.name + "." + chkname + "_" + 1));
	  alert("record found");
	  return false;
	  }
	
	var cboxes = eval("document." + frm.name + "." + chkname + "_" + 1);
	var cnt = 0;
	if(cboxes != null)
		{
		if(cboxes.length>0)
			{
			for(var m=0; m < cboxes.length; m++)
				{
				if(cboxes[m].checked == true)
					{cnt++;}
				}
			}
		else
			{
			if(cboxes.checked == true)
				{cnt++;}
			}
		}

	if(cnt == 1)
		{return true;}
	else
		{
		alert("Please select only a single row to proceed...");
		return false;
		}
	}
*/

//--------------------------------------------------//

function hideRow(rowId)
{
	curRow = document.getElementById(rowId);
	if(curRow)
	{
		curRow.style.display='none';
	}
}

function showRow(rowId)
{
	curRow = document.getElementById(rowId);
	if(curRow)
	{
		curRow.style.display='';
	}
}

var tmr = null;
var cur_shown_row = "";

function hideCurrentRow()
{
	hideRow(cur_shown_row);
}

function startHideTimer()
{
	window.clearTimeout(tmr);
	tmr = window.setTimeout("hideCurrentRow()", 1000);
}

function stopHideTimer()
{
	window.clearTimeout(tmr);
}

function showThisItem(itemPrefix, itemNo) 
{
	var i, objElement;
	cur_shown_row = itemPrefix +"_" +itemNo ;
	
	for(i=1;i<=999;i++)
	{
		objElement = document.getElementById(itemPrefix+"_"+i);
		if(!objElement)
		{
			break;
		}
		else 
		{
			if (i==itemNo)
			{
				showRow(itemPrefix+"_"+i);
			}
			else
			{
				hideRow(itemPrefix+"_"+i);
			}
			
		}
	}
}


//-----------------------------------------------//

