﻿// JScript File

function getElement(aID){
  return (document.getElementById) ? document.getElementById(aID) : document.all[aID];
}

var alreadyRatio;

function OverRadio(liObj,AImg){
  var ulName=liObj.parentNode.id;
  var orderedNodes = getElement(ulName).getElementsByTagName("span");
  
  for (i=0; i<orderedNodes.length; i++)
  {
    orderedNodes[i].style.csstext="";
  }
  
  if (liObj.className == "") 
    liObj.style.background = "url(" + AImg + ") 0 2px no-repeat";
}

function SwitchRadio(liObj, AImg, AClass, radioObj, newValue, hfRatio)
{
    var ulName=liObj.parentNode.id;
    var orderedNodes = getElement(ulName).getElementsByTagName("span");
    
    for (i=0; i<orderedNodes.length; i++)
    {
      orderedNodes[i].className = "";
      orderedNodes[i].style.background = "url(images/radio-notsel.gif) 0 2px no-repeat";
    }
    
    liObj.className = AClass;
    liObj.style.background = "url(" + AImg + ") 0 2px no-repeat";
    
    if (alreadyRatio == false) 
    {
      SetRadioValue(document.forms[0].elements[radioObj], newValue, hfRatio);
    }
}

function SetRadioValue(radioObj, newValue, hfRatio) 
{
	if(!radioObj)
		return;
        
	getElement('submit_butt').style.display = '';
	//getElement('trNote').style.display = '';
	$get(hfRatio).value = newValue.toString();
	
	var radioLength = radioObj.length;
	
	if(radioLength == undefined)
	{
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	
	for(var i = 0; i < radioLength; i++) 
	{
		radioObj[i].checked = false;
		
		if(radioObj[i].value == newValue.toString())
		{
			radioObj[i].checked = true;
		}
	}
}
    
    
function SetRadioControlValue(control1, control2, control3, fillNumber, newValue, hfField)
{
    getElement('submit_butt').style.display = 'none';
    getElement('trNote').style.display = '';    
    getElement('trSubmit').style.display = 'none';

    if (control1) {
        getElement(control1).onclick = '';
        getElement(control1).onmouseout = '';
        getElement(control1).onmouseover = '';
    }
    
    if (control2) {    
        getElement(control2).onclick = '';
        getElement(control2).onmouseout = '';
        getElement(control2).onmouseover = '';
    }    

    if (control3) {
        getElement(control3).onclick = '';
        getElement(control3).onmouseout = '';
        getElement(control3).onmouseover = '';
    }

    var litObj;
    var AClass;
    var AImg;    

    if ((fillNumber == 1) && control1) {
        litObj = getElement(control1);
        AClass = 'radio-red';
        AImg = 'images/radio-red.gif';
    }
    
    if ((fillNumber == 2) && control2) {
        litObj = getElement(control2);        
        AClass = 'radio-silver';
        AImg = 'images/radio-silver.gif';
    }
    
    if ((fillNumber == 3) && control3) {
        litObj = getElement(control3);        
        AClass = 'radio-green';
        AImg = 'images/radio-green.gif';
    }
    
    if (litObj)
        SwitchRadio(litObj, AImg, AClass, newValue, hfField);
    
    if (control1) {    
        getElement(control1).attributes['onclick'].nodeValue = '';
        getElement(control1).attributes['onmouseout'].nodeValue = '';
        getElement(control1).attributes['onmouseover'].nodeValue = '';    
    }
    
    if (control2) {    
        getElement(control2).attributes['onclick'].nodeValue = '';
        getElement(control2).attributes['onmouseout'].nodeValue = '';
        getElement(control2).attributes['onmouseover'].nodeValue = '';
    }

    if (control3) {        
        getElement(control3).attributes['onclick'].nodeValue = '';
        getElement(control3).attributes['onmouseout'].nodeValue = '';
        getElement(control3).attributes['onmouseover'].nodeValue = '';
    }   

      
    alreadyRatio = true;            
}

var ids = new Array();
ids[0] = 0;
ids[1] = 0;
ids[2] = 0;
ids[3] = 0;


function ShowComment(index)
{  
//  ids[index] = 1; 
//  getElement('trNote').style.display = '';  
}

function HideComment(index)
{
//  ids[index] = 0;  
//  
//  for (i=0;i<ids.length;i++)
//  {
//    if (ids[i] == 1) return;
//  }     
//  
//  getElement('trNote').style.display = 'none';  
}

