function initializeTicker()
{
	TICKER_CONTENT = document.getElementById("TICKER").innerHTML;
	 
	TICKER_RIGHTTOLEFT = false;
	TICKER_SPEED = 2;
	TICKER_STYLE = "font-family:Arial; font-size:10pt; font-weight:bold; color:#666666";
	TICKER_PAUSED = false;
	
	//document.getElementById("TICKER").style.visibility = 'visible';
	//ticker_start();
}

function ticker_start() {
	var tickerSupported = false;
	TICKER_WIDTH = document.getElementById("TICKER").style.width;
	var img = "<img src=ticker_space.gif width="+TICKER_WIDTH+" height=0>";

	// Firefox
	if (navigator.userAgent.indexOf("Firefox")!=-1 || navigator.userAgent.indexOf("Safari")!=-1) {
		document.getElementById("TICKER").innerHTML = "<TABLE  cellspacing='0' cellpadding='0' width='100%'><TR><TD nowrap='nowrap'>"+img+"<SPAN style='"+TICKER_STYLE+"' ID='TICKER_BODY' width='100%'>&nbsp;</SPAN>"+img+"</TD></TR></TABLE>";
		tickerSupported = true;
	}
	// IE
	if (navigator.userAgent.indexOf("MSIE")!=-1 && navigator.userAgent.indexOf("Opera")==-1) {
		document.getElementById("TICKER").innerHTML = "<DIV nowrap='nowrap' style='width:100%;'>"+img+"<SPAN style='"+TICKER_STYLE+"' ID='TICKER_BODY' width='100%'></SPAN>"+img+"</DIV>";
		tickerSupported = true;
	}
	if(!tickerSupported) document.getElementById("TICKER").outerHTML = ""; else {
		document.getElementById("TICKER").scrollLeft = TICKER_RIGHTTOLEFT ? document.getElementById("TICKER").scrollWidth - document.getElementById("TICKER").offsetWidth : 0;
		document.getElementById("TICKER_BODY").innerHTML = TICKER_CONTENT;
		document.getElementById("TICKER").style.display="block";
		TICKER_tick();
	}
}

function TICKER_tick() {
	if(!TICKER_PAUSED) document.getElementById("TICKER").scrollLeft += TICKER_SPEED * (TICKER_RIGHTTOLEFT ? -1 : 1);
	if(TICKER_RIGHTTOLEFT && document.getElementById("TICKER").scrollLeft <= 0) document.getElementById("TICKER").scrollLeft = document.getElementById("TICKER").scrollWidth - document.getElementById("TICKER").offsetWidth;
	if(!TICKER_RIGHTTOLEFT && document.getElementById("TICKER").scrollLeft >= document.getElementById("TICKER").scrollWidth - document.getElementById("TICKER").offsetWidth) document.getElementById("TICKER").scrollLeft = 0;
	window.setTimeout("TICKER_tick()", 30);
}

function rollOut(imgName) 
{
    if (document.images) 
    {
        document[imgName].src = eval(imgName+"0.src");
    }
}

function rollIn(imgName)
{
    if (document.images)
    {
        document[imgName].src = eval(imgName+"1.src");
    }
}

// Hides form elements to prevent from showing through
function prepareForm(sVisibilityToggle) 
{
	for(var i=0; i < document.forms.length; i++)
	{
		for(var j=0; j < document.forms[i].elements.length; j++) 
		{
			if (document.forms[i].elements[j].type.indexOf("select") != -1)
			{
				document.forms[i].elements[j].style.visibility = sVisibilityToggle;
			}
		}
	}
}

// Displays the submenu 
function displaySubnav(sSubnav)
{
	var sNav;
	var sElement;
	
	rollIn(sSubnav);
	
	if(document.getElementById)
	{
		sElement = "document.getElementById('" + sSubnav + "Menu')";
	}
	else if(document.all)
	{
		sElement = "document.all['" + sSubnav + "Menu']";
	}
	
	sNav = eval(sElement);
	
	if (sNav)
	{
		sNav.style.visibility = 'visible';
	}
	
	prepareForm('hidden');
}

// Hides the submenu
function hideSubnav(sSubnav, bRemoveHighlight)
{
	var sNav;
	var sElement;
	
	if (bRemoveHighlight)
	{
		rollOut(sSubnav);
	}
	
	if(document.getElementById)
	{
		sElement = "document.getElementById('" + sSubnav + "Menu')";
	}
	else if(document.all)
	{
		sElement = "document.all['" + sSubnav + "Menu']";
	}
	
	sNav = eval(sElement);
	
	if (sNav)
	{
		sNav.style.visibility = 'hidden';
	}
	
	prepareForm('visible');
	
}

var arrSubnav = new Array();

arrSubnav[0] = new Array("xrays",
-242, // pixels from left
140,	// width of menu
"JB70",
"jb70.php",
"Preva",
"preva.php",
"Preva Plus",
"preva_plus.php",
"Preva 2.0",
"preva_2.php"
);

arrSubnav[1] = new Array("panoramic",
	-340, // pixels from left
	98,	// width of menu
	"Vantage",
	"vantage.php"
);

arrSubnav[2] = new Array("sensors",
		-105, // pixels from left
		98,	// width of menu
		"ClearVision",
		"sensors.php"
	);

function loadSubnav(sHexBGColor, sHexOverColor, sHexFontColor, sHexFontOverColor, sHexLineColor)
{
	if((document.all) || (document.getElementById))
	{
		var this_arrSubnav = new Array();
		this_arrSubnav = arrSubnav;
		var sSubnav = "";
		
		for (j = 0; j < this_arrSubnav.length; j++)
		{			
			var sCurrent = this_arrSubnav[j][0];
			
			sSubnav += "<div id=\"" + sCurrent + "Menu\" style=\"z-index:999;position: absolute; top:117; left:50%; margin-left: " + this_arrSubnav[j][1] + "; width: " + this_arrSubnav[j][2] + ";  visibility: hidden\" onmouseover=\"displaySubnav('" + sCurrent + "');\" onmouseout=\"hideSubnav('" + sCurrent + "', true);\">";
			
			sSubnav += "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"" + this_arrSubnav[j][2] + "\">";
			
			for (i=3; i < this_arrSubnav[j].length-1; i=i+2)
			{
				sSubnav += "<tr>";
				sSubnav += "<td width=\"1\" bgcolor=\"" + sHexLineColor + "\"><img src=\"images/imgSpacer.gif\" width=\"1\" height=\"22\"></td>";
				sSubnav += "<td bgcolor=\"" + sHexBGColor + "\" class=\"subNav\" onClick=\"document.location.href='" + this_arrSubnav[j][i+1] + "'\" onmouseover=\"this.bgColor='" + sHexOverColor + "';this.style.color='" + sHexFontOverColor+ "';\" onmouseout=\"this.bgColor='" + sHexBGColor + "';this.style.color='" + sHexFontColor + "'\" style=\"color: " + sHexFontColor + "\"><div style=\"padding-left:12px;\">" + this_arrSubnav[j][i] + "</a></div></td>";
				sSubnav += "<td width=\"1\" bgcolor=\"" + sHexLineColor + "\"><img src=\"images/imgSpacer.gif\" width=\"1\" height=\"22\"></td>";
				sSubnav += "</tr>";
				sSubnav += "<tr>";
				sSubnav += "<td colspan=\"3\" bgcolor=\"" + sHexLineColor + "\" height=\"1\"><img src=\"images/imgSpacer.gif\" width=\"1\" height=\"1\"></td>";
				sSubnav += "</tr>";
			}
			
			sSubnav += "</table>";
			sSubnav += "</div>";
		}
		
		document.write(sSubnav);
	}
}

function showContent(sContent)
{
	var objLocation;
	var sElement;
	
	if(document.getElementById)
	{
		sElement = "document.getElementById('" + sContent + "')";
	}
	else if(document.all)
	{
		sElement = "document.all['" + sContent + "']";
	}
	
	objLocation = eval(sElement);
	
	if (objLocation)
	{
		objLocation.style.visibility = 'visible';
	}
}

function hideContent(sContent)
{
	var objLocation;
	var sElement;
	
	if(document.getElementById)
	{
		sElement = "document.getElementById('" + sContent + "')";
	}
	else if(document.all)
	{
		sElement = "document.all['" + sContent + "']";
	}
	
	objLocation = eval(sElement);
	
	if (objLocation)
	{
		objLocation.style.visibility = 'hidden';
	}
}

function isEmail(string) 
{
	if (!string)
	{
		return false;
	}
	
	var iChars = "*|,\":<>[]{}`\';()&$#%";
	
	for (var i = 0; i < string.length; i++) 
	{
		if (iChars.indexOf(string.charAt(i)) != -1)
		{
			return false;
		}
	}
	return true;
}                      
                    
function isReady(sType) 
{
    if (document.frmContact.txtName.value == "")
    {
    		alert('Please enter your name');
    		document.frmContact.txtName.focus();
        	return false;
    }
    else if (isEmail(document.frmContact.txtEmail.value) == false) 
    {
        	alert("Please enter a valid email address.");
        	document.frmContact.txtEmail.focus();
        	return false;
    }
    else if (sType == "show"){
    	if (document.frmContact.txtShow.value == "")
	    {
	    		alert('Please enter a trade show.');
	    		document.frmContact.txtShow.focus();
	        	return false;
	    }
    	
    }
    else if (sType == "career"){
    	if (document.frmContact.txtPosition.value == "")
	    {
	    		alert('Please enter the position you are interested in.');
	    		document.frmContact.txtPosition.focus();
	        	return false;
	    }
    	
    }
    else if (document.frmContact.txtMessage.value == "")
    {
    		alert('Please enter a message');
    		document.frmContact.txtMessage.focus();
        	return false;
    }
    
    
    
    return true;
}

function isReadyIntl() 
{
    if (document.frmContact.txtName.value == "")
    {
    		alert('Please enter your name');
    		document.frmContact.txtName.focus();
        	return false;
    }
    else if (isEmail(document.frmContact.txtEmail.value) == false) 
    {
        	alert("Please enter a valid email address.");
        	document.frmContact.txtEmail.focus();
        	return false;
    }
    else if (document.frmContact.txtCountry.value == "")
    {
    		alert('Please enter your country');
    		document.frmContact.txtCountry.focus();
        	return false;
    }
    else if (document.frmContact.txtMessage.value == "")
    {
    		alert('Please enter a message');
    		document.frmContact.txtMessage.focus();
        	return false;
    }
    
    return true;
}

function downloadPDF(sForm, sField)
{
	var sThisForm = document.forms[sForm];
	var sThisField = sThisForm[sField];
	var sFilename = sThisField.options[sThisField.selectedIndex].value;
	sFilename = sFilename.replace("pdf/", "");
	sFilename = sFilename.replace(".pdf", "");
	_gaq.push(['_trackEvent','PDF','support', sFilename]);
	var sNewWindow = window.open(sThisField.options[sThisField.selectedIndex].value, 'PDFWindow');
}

function openSpec(sName){
	var specWindow = window.open(sName+'Spec.php','specWindow','scrollbars=yes,toolbar=yes,manubar=yes,status=no,width=790,height=526,top=0,left=0,screenX=0,screenY=0');
	specWindow.focus();
}

function openSpecSelect(sForm, sField){
	var sThisForm = document.forms[sForm];
	var sThisField = sThisForm[sField];
	var sName = sThisField.options[sThisField.selectedIndex].value;
	_gaq.push(['_trackPageview','/'+sName+'/specifications'])
	var specWindow = window.open(sName+'Spec.php','specWindow','scrollbars=yes,toolbar=yes,manubar=yes,status=no,width=790,height=526,top=0,left=0,screenX=0,screenY=0');
	specWindow.focus();
}

function openPhoto(photoname)
{
	var photoWindow = window.open('photoViewer.php?photo=' + photoname,'photoWindow','scrollbars=no,status=no,width=700,height=526,top=0,left=0,screenX=0,screenY=0');
  photoWindow.focus();
}

function checkSoftwareUpdates(sVer){
	
	var sMessage = "We could not read the current version at this time. If you would like an update disk, contact Progeny Technical Service.\n\n(877) 544-9672, Press 3."
	if (sVer != ""){
		sMessage = "The latest version of Progeny Imaging is "+sVer+".\n\nPlease contact your preferred dealer for an updated disc. For download instructions, contact Progeny Technical Support (877) 544-9672 option 3.";
	}
	
	alert(sMessage);
}


function PassCompanyName () {
var company_name_value = document.frmContact.txtName.value;
alert(company_name_value);
_gaq.push(['_setCustomVar', 1, 'Name', company_name_value, 1]);
_gaq.push(['_trackPageview']);
} 

