if (document.images) {
	tl_corner_red = new Image
	bl_corner_red = new Image
	tr_corner_red = new Image
	br_corner_red = new Image
	tl_corner_blue = new Image
	bl_corner_blue = new Image
	tr_corner_blue = new Image
	br_corner_blue = new Image

	tl_corner_red.src = "/images/corners/tl_corner_red.jpg";
	bl_corner_red.src = "/images/corners/bl_corner_red.jpg";
	tr_corner_red.src = "/images/corners/tr_corner_red.jpg";
	br_corner_red.src = "/images/corners/br_corner_red.jpg";
	tl_corner_blue.src = "/images/corners/tl_corner_blue.jpg";
	bl_corner_blue.src = "/images/corners/bl_corner_blue.jpg";
	tr_corner_blue.src = "/images/corners/tr_corner_blue.jpg";
	br_corner_blue.src = "/images/corners/br_corner_blue.jpg";
}

function showElement(elementName)
	{
	document.getElementById(elementName).style.display="block";
	}
 function hideElement(elementName)
	{
	document.getElementById(elementName).style.display="none";
	}
function rolloverChange(side, newColor, newImageColor) {
  document.getElementById(side + "_bttn").style.backgroundColor="#" + newColor;
  document.getElementById("t" + side + "_corner").src="/images/corners/t" + side + "_corner_" + newImageColor + ".jpg";
  document.getElementById("b" + side + "_corner").src="/images/corners/b" + side + "_corner_" + newImageColor + ".jpg";
  document.getElementById(side + "_pad").style.backgroundColor="#" + newColor;
}
function rolloutChange(side, newColor, newImageColor) {
  document.getElementById(side + "_bttn").style.backgroundColor="#" + newColor;
  document.getElementById("t" + side + "_corner").src="/images/corners/t" + side + "_corner_" + newImageColor + ".jpg";
  document.getElementById("b" + side + "_corner").src="/images/corners/b" + side + "_corner_" + newImageColor + ".jpg";
  document.getElementById(side + "_pad").style.backgroundColor="#" + newColor;
}

billBoard = new Array(2);

billBoard[1] = "<img src='/images/commercial_labels_billboard.jpg' style='cursor:pointer;' onclick='window.location=\"/info.php?type=commercial_labels\"' ";

billBoard[2] = "<img src='/images/industrial_labels_billboard.jpg' style='cursor:pointer;' onclick='window.location=\"/info.php?type=industrial_labels\"' ";

var i = 1;
var stat = "on";
var onLo =  "onload='slideShow()' />"
var offLo =  "/>"

 function changeImage(num) {
   if (stat == "on"){cont = onLo;}else{cont = offLo;}
   document.getElementById('billboard').innerHTML = billBoard[num] + cont;
 }

 function nextImage() {
    if (i < 2) {i = i + 1;}else{i = 1;}
    if (stat == "on"){cont = onLo;}else{cont = offLo;}
    document.getElementById('billboard').innerHTML = billBoard[i] + cont;
    grayButtons();
    document.getElementById('bttn' + i).src = button[i];
 }

 function slideShow() {
    stat = "on";
    s_show = setTimeout("nextImage(onLo)",4000);
 }

  function getXMLHTTPRequest()
{
var request = false;
try
  {
    request = new XMLHttpRequest();
  }
catch(err1)
  {
  try
    {
    request = new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch(err2)
    {
    try
      {
      request = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(err3)
        {
        request = false;
        }
    }
  }
return request;
}

var xmlhttp = getXMLHTTPRequest();

function callAjax(landing, useScript, addVar, printVar) {
  var serverPage = useScript;
  myRand = parseInt(Math.random()*9999999);
  var modurl = serverPage+"?rand="+myRand+addVar+printVar;
  xmlhttp.open("GET", modurl, true);
  xmlhttp.onreadystatechange = function() {
   if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
    document.getElementById(landing).innerHTML = xmlhttp.responseText;
   } else {
  document.getElementById(landing).innerHTML = 'Please Wait....';
  }
}
xmlhttp.send(null);
}

function callAjax2(landing, useScript, addVar, printVar) {
  document.getElementById(landing).innerHTML = "<span style=\"color:red;\">&nbsp;&nbsp;&nbsp;Loading...</span>";
  var serverPage = useScript;
  myRand = parseInt(Math.random()*9999999);
  var modurl = serverPage+"?rand="+myRand+addVar+printVar;
  xmlhttp.open("GET", modurl, true);
  xmlhttp.onreadystatechange = function() {
   if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
    document.getElementById(landing).innerHTML = xmlhttp.responseText;
   } else {
    
  }
}
xmlhttp.send(null);
}

function selectRadio(radioId){
  document.getElementById(radioId).checked='checked';
}  

function showOther(other_id, d_value){
  if (d_value == 'Other'){
    document.getElementById(other_id).style.display='inline';
  }else{
    document.getElementById(other_id).style.display='none';
  }
}

function validEmail(email) {
	invalidChars = " /:,;"
	
	if (email == "") {
		return false
	}
	for (i=0; i<invalidChars.length; i++) {
		badChar = invalidChars.charAt(i)
		if (email.indexOf(badChar,0) > -1) {
			return false
		}
	}
	atPos = email.indexOf("@",1)
	if (atPos == -1) {
		return false
	}
	if (email.indexOf("@",atPos+1) > -1) {
		return false
	}
	periodPos = email.indexOf(".",atPos)
	if (periodPos == -1) {
		return false
	}
	if (periodPos+3 > email.length) {
		return false
	}
	return true
}

function submitIt() {
        document.getElementById('submit_bttn').disabled=true;
        contactMethod = -1
	for (i=0; i<document.contactusForm.contact.length; i++) {
		if (document.contactusForm.contact[i].checked) {
			contactMethod = i
		}
	}
	if (contactMethod == -1) {
		alert("Please select a preferred contact method.")
		document.getElementById('submit_bttn').disabled=false;
	}else if (document.contactusForm.name.value == "") {
		alert("Please enter your name.")
		document.getElementById('submit_bttn').disabled=false;
	}else{
	document.contactusForm.submit();
	}
}

function checkEmail(contactusForm) {
	if (!validEmail(contactusForm.email.value)) {
		alert("Please enter a valid email address.")
		contactusForm.email.focus()
		contactusForm.email.select()
		return false
	}

	return true
}

function checkPhone(contactusForm) {
	if (document.contactusForm.phone.value == "") {
		alert("Please enter a phone number.")
		contactusForm.phone.focus()
		contactusForm.phone.select()
		return false
	}
	return true
}

function checkName(contactusForm) {
	if (document.contactusForm.first_name.value == "") {
		alert("Please enter your name.")
		contactusForm.name.focus()
		contactusForm.name.select()
	}
	document.contactusForm.submit();
}

function setStyle(x)
{
if (document.getElementById(x).value == "email@email.com")
{
document.getElementById(x).style.color="black";
document.getElementById(x).value="";
}
return true
}

function setEmail(x)
{
if (document.getElementById(x).value == "")
{
document.getElementById(x).value="email@email.com";
document.getElementById(x).style.color="#aeaeae";
}
return true
}

function useEmail(email)
{
if (document.contactusForm.email.value == "email@email.com")
{
alert("Please enter a valid email address or select contact by phone.")
document.contactusForm.email.focus()
document.contactusForm.email.select()
return false
}
return true
}
function selectRadio(radioId){
  document.getElementById(radioId).checked='checked';
}

function checkPass(box_one,box_two)
{
  if(document.getElementById(box_one).value != document.getElementById(box_two).value)
  {
  alert("Your passwords didn't match, please try again.");
  document.getElementById(box_one).value="";
  document.getElementById(box_two).value="";
  return false;
  }else{
  return true;
  }
}

function IsNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

function checkQty(qty)
{
  if (document.getElementById(qty).value.length == 0)
  {
  alert("Please enter a quantity.");
  document.getElementById(qty).focus();
  document.getElementById(qty).select();
  return false
  }
  else if (IsNumeric(document.getElementById(qty).value) == false)
  {
  alert("Please check - non numeric quantity!");
  document.getElementById(qty).focus();
  document.getElementById(qty).select();
  return false
  }
  else
  {
    return true
  }
}
