window.onload=function()
{
  	// Preload Background Image for squares

  	pic1= new Image(160,133);
	pic1.src="images/IconSquareBG_on.gif";

	// Rollover Effect For Squares

	gtEl = document.getElementsByTagName('div');
	for (i=0; i<gtEl.length; i++)
	{
     if (gtEl[i].className == 'IconSquare')
     {
       	gtEl[i].style.backgroundImage="url(images/IconSquareBG_off.gif)";

			gtEl[i].onmouseover = function()
			{
           this.style.backgroundImage="url(images/IconSquareBG_on.gif)";
   		}
   		gtEl[i].onmouseout = function()
			{
           this.style.backgroundImage="url(images/IconSquareBG_off.gif)";
   		}
     }
 	}

	// OnClick url for each square

 	var square1 = document.getElementById('square1');
   square1.onclick=function()
   {
    window.location.href="/atlanta/granite-countertops.html";
    this.style.backgroundImage="url(images/IconSquareBG_off.gif)";
   }
 	var square2 = document.getElementById('square2');
 	square2.onclick=function()
   {
    window.location.href="/atlanta/movers.html";
    this.style.backgroundImage="url(images/IconSquareBG_off.gif)";
   }
 	var square3 = document.getElementById('square3');
 	square3.onclick=function()
   {
    window.location.href="/atlanta/portable-storage.html";
    this.style.backgroundImage="url(images/IconSquareBG_off.gif)";
   }
 	var square4 = document.getElementById('square4');
 	square4.onclick=function()
   {
    window.location.href="/atlanta/homesecurity.html";
    this.style.backgroundImage="url(images/IconSquareBG_off.gif)";
   }
 	var square5 = document.getElementById('square5');
 	square5.onclick=function()
   {
    window.location.href="/atlanta/lasik.html";
    this.style.backgroundImage="url(images/IconSquareBG_off.gif)";
   }
 	var square6 = document.getElementById('square6');
 	square6.onclick=function()
   {
    window.location.href="/atlanta/pest-control.html";
    this.style.backgroundImage="url(images/IconSquareBG_off.gif)";
   }
 	var square7 = document.getElementById('square7');
 	square7.onclick=function()
   {
    window.location.href="/atlanta/limos.html";
    this.style.backgroundImage="url(images/IconSquareBG_off.gif)";
   }
 	var square8 = document.getElementById('square8');
 	square8.onclick=function()
   {
    window.location.href="/atlanta/locksmiths.html";
    this.style.backgroundImage="url(images/IconSquareBG_off.gif)";
   }
 	var square9 = document.getElementById('square9');
 	square9.onclick=function()
   {
    window.location.href="/atlanta/dentists.html";
    this.style.backgroundImage="url(images/IconSquareBG_off.gif)";
   }
   
   // Controls for dropdown
   
   var ViewAll = document.getElementById('ViewAll');
   var Categories = document.getElementById('CategoryList');
   Categories.style.display = 'none';
   ViewAll.onmouseover=function()
   {
		Categories.style.display = 'block';
   }
   ViewAll.onmouseout=function()
   {
		Categories.style.display = 'none';
   }

   var CategoryList = document.getElementById('CategoryList');
   CategoryList.onmouseover=function()
   {
		Categories.style.display = 'block';
   }
   CategoryList.onmouseout=function()
   {
		Categories.style.display = 'none';
   }
}

window.onbeforeunload=function()
{
  	var square1 = document.getElementById('square1');
	square1.style.backgroundImage="url(images/IconSquareBG_off.gif)";
   var square2 = document.getElementById('square2');
	square2.style.backgroundImage="url(images/IconSquareBG_off.gif)";
  	var square3 = document.getElementById('square3');
	square3.style.backgroundImage="url(images/IconSquareBG_off.gif)";
  	var square4 = document.getElementById('square4');
	square4.style.backgroundImage="url(images/IconSquareBG_off.gif)";
	var square5 = document.getElementById('square5');
	square5.style.backgroundImage="url(images/IconSquareBG_off.gif)";
	var square6 = document.getElementById('square6');
	square6.style.backgroundImage="url(images/IconSquareBG_off.gif)";
	var square7 = document.getElementById('square7');
	square7.style.backgroundImage="url(images/IconSquareBG_off.gif)";
	var square8 = document.getElementById('square8');
	square8.style.backgroundImage="url(images/IconSquareBG_off.gif)";
	var square9 = document.getElementById('square9');
	square9.style.backgroundImage="url(images/IconSquareBG_off.gif)";
  	var Categories = document.getElementById('CategoryList');
  	Categories.style.display='none';
}