function surveyOther(value, other)
{
	if( value == 'other' || value == 'Other' )
	{	
		document.getElementById( other ).style.display = 'inline';
	}
}

function checkSurveyStatus()
{

	var q1 = document.getElementById( 'question1' );
	var q3 = document.getElementById( 'question3' );
	var q4 = document.getElementById( 'question4' );
	var q5 = document.getElementById( 'question5' );
	
	if( q1 )
	{
		if( q1.value == 'Other' )
		{
			document.getElementById( 'question1_other' ).style.display = 'inline';
		}
		else
		{
			document.getElementById( 'question1_other' ).style.display = 'none';
		}
		
		if( q3.value == 'Other' )
		{
			document.getElementById( 'question3_other' ).style.display = 'inline';
		}
		else
		{
			document.getElementById( 'question3_other' ).style.display = 'none';
		}
		
		if( q4.value == 'Other' )
		{
			document.getElementById( 'question4_other' ).style.display = 'inline';
		}
		else
		{
			document.getElementById( 'question4_other' ).style.display = 'none';
		}
		
		if( q5.value == 'Other' )
		{
			document.getElementById( 'question5_other' ).style.display = 'inline';
		}
		else
		{
			document.getElementById( 'question5_other' ).style.display = 'none';
		}
	}
}


function onLoad()
{
	checkSurveyStatus();
}

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
            i = i-1
         }
      }
   }    
}

var items=1;

function addItem() {
  div=document.getElementById("uploadForm");
  button=document.getElementById("add");
  items++;
  newitem="File " + items + ": ";
  newitem+="<input type=\"file\" name=\"file[" + items + "]\" />";
  newitem+="<br />";
  newnode=document.createElement("span");
  newnode.innerHTML=newitem;
  div.insertBefore(newnode,button);
}

/**
* Changes the display from none to inline and vice versa
*/
function toggleDisplay( id )
{
	var element = document.getElementById(id);
	var eDisplay = element.style.display;
	var nDisplay;
	
	nDisplay = ( eDisplay == 'none' ? 'inline' : 'none' );
	
	element.style.display = nDisplay;
}


/**
*Opens new window for Jeopardy game
*/
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


