// JavaScript Document
var p1, p2, p3, c1, c2, c3, l_col, r_col, ph;

// window.onload = DynarchMenu.setup('menu', {electric: true});

function StartMain()
{
	InitPromo();
	InitBody();
	correctPNG();
}

function StartInner()
{
	InitPromo();
	InitInnerBody();
	correctPNG();
}


function ExpandPromo(item)
{
	if(item == 1)
	{
		p1.style.width = '333px';
		p2.style.width = '183px';
		p3.style.width = '184px';
		
		t1.style.visibility = 'visible';
	}
	if(item == 2)
	{
		p1.style.width = '183px';
		p2.style.width = '333px';
		p3.style.width = '184px';
		
		t2.style.visibility = 'visible';
	}
	if(item == 3)
	{
		p1.style.width = '183px';
		p2.style.width = '184px';
		p3.style.width = '333px';
		
		t3.style.visibility = 'visible';
		ph.src = "../img/phone_over.gif";
	}
}


function ClosePromo()
{
	// Determining if a page has loaded completely.
//	if(document.readyState == 'complete')
//	{
		p1.style.width = '233px';
		p2.style.width = '233px';
		p3.style.width = '234px';	
		
		t1.style.visibility = 'hidden';
		t2.style.visibility = 'hidden';
		t3.style.visibility = 'hidden';
		ph.src = "../img/phone_top.jpg";
//	}
}


function InitPromo()
{
	p1 = document.getElementById('promo1');
	p2 = document.getElementById('promo2');
	p3 = document.getElementById('promo3');
	
	t1 = document.getElementById('promo_txt1');
	t2 = document.getElementById('promo_txt2');
	t3 = document.getElementById('promo_txt3');
	ph = document.getElementById('phone');
}


function getObjByEvent(evt)
{
	evt = (evt) ? evt : ((window.event) ? event : null);
	if(evt)
	{
		return obj = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null );
	}
	return null;
}

function InitBody()
{
	var max_height;
		
	c1 = document.getElementById('col1');	
	c2 = document.getElementById('col2');	
	c3 = document.getElementById('col3');		
	
	if(c1.offsetHeight > c2.offsetHeight)
	{
		if(c1.offsetHeight > c3.offsetHeight)
		{
			max_height = c1.offsetHeight;
		}
		else
		{
			max_height = c3.offsetHeight;			
		}
	}
	else if(c2.offsetHeight > c3.offsetHeight)
	{
		max_height = c2.offsetHeight;
	}
	else
	{
		max_height = c3.offsetHeight;			
	}
	c1.style.height = c2.style.height = c3.style.height = max_height + 10 + 'px';
}


function InitInnerBody()
{
	var max_height;
		
	l_col = document.getElementById('l_column');	
	r_col = document.getElementById('r_column');	
	
	if(l_col.offsetHeight > r_col.offsetHeight)
	{
		max_height = l_col.offsetHeight;
	}
	else
	{
		max_height = r_col.offsetHeight;
	}
	l_col.style.height = r_col.style.height = max_height + 10 + 'px';
}




function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.

{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])

   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()

         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText
			
            if (img.align == "left") imgStyle = "float:left;" + imgStyle

            if (img.align == "right") imgStyle = "float:right;" + imgStyle

            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle

            var strNewHTML = "<span " + imgID + imgClass + imgTitle

            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"

            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"

            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 

            img.outerHTML = strNewHTML
			//alert(strNewHTML);
            i = i-1

         }

      }

   }    

}

// window.attachEvent("onload", correctPNG);

