function opacity(id, opacStart, opacEnd, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
 
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++){
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
	return 'hello';
}

function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function fisherYates ( myArray ){
  var i = myArray.length;
  if ( i == 0 ) return false;
  while ( --i ) {
     var j = Math.floor( Math.random() * ( i + 1 ) );
     var tempi = myArray[i];
     var tempj = myArray[j];
     myArray[i] = tempj;
     myArray[j] = tempi;
   }
}

var companytext=new Array();
companytext[0] = "Our large inventory of hard-to-find and unusual sizes makes us the #1 single source for the industry.";
companytext[1] = "Specialists in Heavy Wall Pipe &amp; Tubing.";
companytext[2] = "Providing the Highest Quality Products in the Industry, with the fastest delivery time!";
companytext[3] = "With over 20,000 tons in inventory, we\'re your single-source for heavy wall pipe and tube.";
companytext[4] = "Setting the industry standard for service and reliability.";
companytext[5] = "Our huge inventory is backed by career specialists who can provide reliable price and availability information within seconds from our state-of-the-art computerized inventory tracking system.";
companytext[6] = "Specialty stocks more sizes and tonnage of carbon and alloy heavy wall tubing and pipe than any other source.";
companytext[7] = "The country's largest selection.";
fisherYates(companytext);
var textcount = 0;

function nextNews() {
	opacity('companyinfo', 100, 0, 500);
	setTimeout(changeText,500);
}
function changeText(){
	document.getElementById('companyinfo').innerHTML = companytext[textcount];
	textcount = textcount + 1;
	if(textcount > 7){
		textcount = 0;
	}
	setTimeout(fadein,1000);
}
function fadein(){
	opacity('companyinfo', 0, 100, 500);
}


function HideContent(d) {
	if(d.length < 1) { 
		return; 
	}
	document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
	if(d.length < 1) { 
		return; 
	}
	document.getElementById(d).style.display = "block";
}
