
var txt=new Array();
var txt1=new Array();
var txt2=new Array();
txt[0]="RBC Center";
txt[1]="Ave Maria Oratory^Piedmont Towne Center";
txt[2]="I-485 C.A.T.S Parking Garage";
txt[3]="Piedmont Triad Research Park"
txt[4]="NC Research Campus &quot;Corelab&quot;";
txt[5]="UNC Charlotte Classroom/Office Building";
txt[6]="Bellsouth Building";
txt[7]="";
txt[8]="RBC Center";

txt1[0]="Raleigh, NC";
txt1[1]="Naples, FL^Charlotte, NC";
txt1[2]="Charlotte, NC";
txt1[3]="Winston Salem, NC"
txt1[4]="Kannapolis, NC";
txt1[5]="Charlotte, NC";
txt1[6]="Atlanta, GA";
txt1[7]="";
txt1[8]="Raleigh, NC";

txt2[0]="";
txt2[1]="Carbon steel fabricated cross w/ goldleaf finish^Bronze handrails";
txt2[2]="Decorative panels";
txt2[3]="Annodized Aluminum Handrail"
txt2[4]="Platform, stair and handrail";
txt2[5]="";
txt2[6]="Stairs (Front and side view)";
txt2[7]="";
txt2[8]="";

function changeBGcolor(id,c){
	if(prvClick){document.getElementById(prvClick).style.background = '';}
	document.getElementById(id).style.background = c;
	prvClick = id
}

function hideShowLayer(layer) {
	if(document.getElementById(layer).style.display == 'none'){
		document.getElementById(layer).style.display = '';
	}else{
		document.getElementById(layer).style.display = 'none';
	}
}

var loadStart=function(){
	var sp,st,t,m,sa,l,w,sw,ot;
	return{
		build:function(sm,sw,mt,s,sl,h){
			sp=s; st=sw; t=mt;
			m=document.getElementById(sm);
			sa=m.getElementsByTagName('li');
			l=sa.length; w=m.offsetWidth; sw=w/l;
			ot=Math.floor((w-st)/(l-1)); var i=0;

			for(i;i<l;i++){s=sa[i]; s.style.width=sw+'px'; this.timer(s)}
			if(sl!=null){
				m.timer=setInterval(function(){loadStart.slide(sa[sl-1])},t);
				document.getElementById("indexproductsFooter").innerHTML = sl-1;
			}
		},
		timer:function(s){s.onmouseover=function(){clearInterval(m.timer);m.timer=setInterval(function(){loadStart.slide(s)},t)}},
		slide:function(s){
			var cw=parseInt(s.style.width,'10');
			if(cw<st){
				var owt=0; var i=0;
				for(i;i<l;i++){
					if(sa[i]!=s){
						var o,ow; var oi=0; o=sa[i]; ow=parseInt(o.style.width,'10');
						if(ow>ot){oi=Math.floor((ow-ot)/sp); oi=(oi>0)?oi:1; o.style.width=(ow-oi)+'px'}owt=owt+(ow-oi)
					}else{
						building = txt[i];
						loc = txt1[i];
						desc = txt2[i];
						
						//document.getElementById("indexproductsFooter").innerHTML = building.search("/^/i");
						///*
					if(building.indexOf('^') < 0)
						{
							document.getElementById("indexproductsFooter").innerHTML = '<span class="building">' + building + '</span><span class="loc">' + loc + '</span><span class="desc">' + desc + '</span>';
						}
						else
						{

							buildarr = building.split("^");
							locarr = loc.split("^");
							descarr = desc.split("^");
							
							document.getElementById("indexproductsFooter").innerHTML = '<u>Left:</u> <span class="building">' + buildarr[0] + '</span><span class="loc">' + locarr[0] + '</span><span class="desc">' + descarr[0] + '</span><br><u>Right:</u> <span class="building">' + buildarr[1] + '</span><span class="loc">' + locarr[1] + '</span><span class="desc">' + descarr[1] + '</span>';
							
						}
						//*/
					}

				}
				s.style.width=(w-owt)+'px';
			}else{
				clearInterval(m.timer);
			}

		}
	};
}();



var tooltip=function(){
	var id = 'tt';
	var top = 3;
	var left = 3;
	var maxw = 300;
	var speed = 10;
	var timer = 20;
	var endalpha = 95;
	var alpha = 0;
	var tt,t,c,b,h;
	var ie = document.all ? true : false;
	return{
		show:function(v,w){
			if(tt == null){
				tt = document.createElement('div');
				tt.setAttribute('id',id);
				t = document.createElement('div');
				t.setAttribute('id',id + 'top');
				c = document.createElement('div');
				c.setAttribute('id',id + 'cont');
				b = document.createElement('div');
				b.setAttribute('id',id + 'bot');
				tt.appendChild(t);
				tt.appendChild(c);
				tt.appendChild(b);
				document.body.appendChild(tt);
				tt.style.opacity = 0;
				tt.style.filter = 'alpha(opacity=0)';
				document.onmousemove = this.pos;
			}
			tt.style.display = 'block';
			c.innerHTML = v;
			tt.style.width = w ? w + 'px' : 'auto';
			if(!w && ie){
				t.style.display = 'none';
				b.style.display = 'none';
				tt.style.width = tt.offsetWidth;
				t.style.display = 'block';
				b.style.display = 'block';
			}
			if(tt.offsetWidth > maxw){tt.style.width = maxw + 'px'}
			h = parseInt(tt.offsetHeight) + top;
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(1)},timer);
		},
		pos:function(e){
			var u = ie ? event.clientY + document.documentElement.scrollTop : e.pageY;
			var l = ie ? event.clientX + document.documentElement.scrollLeft : e.pageX;
			tt.style.top = (u - h) + 'px';
			tt.style.left = (l + left) + 'px';
		},
		fade:function(d){
			var a = alpha;
			if((a != endalpha && d == 1) || (a != 0 && d == -1)){
				var i = speed;
				if(endalpha - a < speed && d == 1){
					i = endalpha - a;
				}else if(alpha < speed && d == -1){
					i = a;
				}
				alpha = a + (i * d);
				tt.style.opacity = alpha * .01;
				tt.style.filter = 'alpha(opacity=' + alpha + ')';
			}else{
				clearInterval(tt.timer);
				if(d == -1){tt.style.display = 'none'}
			}
		},
		hide:function(){
			clearInterval(tt.timer);
			tt.timer = setInterval(function(){tooltip.fade(-1)},timer);
		}
	};
}();


//-------------Contact page
var eRLastID = -1;

function eR(id)
{
	erClearLast();
	document.getElementById("repopt" + id).selected =true;
	document.getElementById("rep" + id).style.backgroundColor = 'lightblue';
	document.getElementById('contactsendto').style.color = 'blue';
	eRLastID = id;
	document.getElementById('contactspan' + id).style.color = 'white';	
}
function eRCb()
{
	erClearLast();
	var selected_index = document.getElementById('repdropdown').selectedIndex;
	if(selected_index > 0) {
		var selected_option_value = document.getElementById('repdropdown').options[selected_index].value;
		id = selected_option_value;
//		alert(id);
		document.getElementById('rep' + id).style.backgroundColor = 'lightblue';	
		eRLastID = id;
	}

}

function erClearLast()
{
	if (eRLastID >-1 )
	{
		document.getElementById("rep" + eRLastID).style.backgroundColor = '';
	}
}

function changeFont(id)
{
	if (document.getElementById('rep' + id).style.backgroundColor == 'lightblue')
	{
		document.getElementById('contactspan' + id).style.color = 'white';
	}
	else
	{
		document.getElementById('contactspan' + id).style.color = 'lightblue';	
	}
	
}

function changeFontBack(id)
{
	document.getElementById('contactspan' + id).style.color = 'blue';
}

//------------Cert page


function certHL(id)
{
	document.getElementById("cert" + id).style.backgroundColor = 'lightblue';
}
function certClear(id)
{
	document.getElementById("cert" + id).style.backgroundColor = '';
}

function validate(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {
    alert(alerttxt);return false;
    }
  else
    {
    return true;
    }
  }
}

