var Input2 = { 
  initialize: function() { 
  
    if(document.getElementsByTagName("form")) { 
      var divs = document.getElementsByTagName("div"); 
      for(var i = 0; i < divs.length; i++) { 
        if(divs[i].className.match("star2")) { 
          myselector = divs[i].getElementsByTagName("input"); 
          for(var j= 0; j < myselector.length; j++){
            if (myselector[j].checked == true){
            
              if(myselector[j].value==1){
                divs[i].className = "star2 selected2";
              }else if(myselector[j].value==2){
                divs[i].className = "star2 selected2";
                divs[i-1].className = "star2 selected2";
              }else if(myselector[j].value==3){
                divs[i].className = "star2 selected2";
                divs[i-1].className = "star2 selected2";
                divs[i-2].className = "star2 selected2";
              }else if(myselector[j].value==4){
                divs[i].className = "star2 selected2";
                divs[i-1].className = "star2 selected2";
                divs[i-2].className = "star2 selected2";
                divs[i-3].className = "star2 selected2";
              }
                                   
            }          
          }        
        
          //divs[i].onmousedown = Input2.effect; 
          divs[i].onmouseup = Input2.handle; 
          window.onmouseup = Input2.clear; 
        } 
      } 
    } 
  }, 
  effect: function() { 
    this.style.backgroundPosition = "0px -3px";     
  }, 
  handle: function() { 
    selector = this.getElementsByTagName("input")[0]; 
    if(selector.disabled != true){
    if(this.className == "star2"){
      selector.checked = true; 
	  this.className = "star2 selected2"; 
	        inputs = document.getElementsByName(selector.getAttribute("name")); 
    
      for(i = 0; i < inputs.length; i++) { 
        if(inputs[i].getAttribute("name") == selector.getAttribute("name")) { 
          
          if(inputs[i] == selector) { 
                                   
            if(i==1){           
        			inputs[0].parentNode.style.backgroundPosition = "0px -20px";
        			inputs[1].parentNode.style.backgroundPosition = "0px -20px";
        			inputs[2].parentNode.style.backgroundPosition = "0px -2px";
        			inputs[3].parentNode.style.backgroundPosition = "0px -2px";
        			 }
        			  else if(i==2){
        			  inputs[0].parentNode.style.backgroundPosition = "0px -20px";
        			inputs[1].parentNode.style.backgroundPosition = "0px -20px";
        			inputs[2].parentNode.style.backgroundPosition = "0px -20px";
        			inputs[3].parentNode.style.backgroundPosition = "0px -2px";
        			 }
        			  else if(i==3){
        			  inputs[0].parentNode.style.backgroundPosition = "0px -20px";
        			inputs[1].parentNode.style.backgroundPosition = "0px -20px";
        			inputs[2].parentNode.style.backgroundPosition = "0px -20px";
        			inputs[3].parentNode.style.backgroundPosition = "0px -20px";
        			 }
        			  else {
        			inputs[0].parentNode.style.backgroundPosition = "0px -20px";
        			inputs[1].parentNode.style.backgroundPosition = "0px -2px";
        			inputs[2].parentNode.style.backgroundPosition = "0px -2px";
        			inputs[3].parentNode.style.backgroundPosition = "0px -2px";
        			 }
			 }
        } 
      } 
      for(i = 0; i < inputs.length; i++) { 
        if(inputs[i].getAttribute("name") == selector.getAttribute("name")) { 
          if(inputs[i] != selector) { 
            inputs[i].parentNode.className = "star2"; 
			
			 }
			  
        } 
      } 
    }else{
      selector.checked = false; 
	    this.className = "star2";
	    inputs = document.getElementsByName(selector.getAttribute("name")); 
      for(i = 0; i < inputs.length; i++) { 
        if(inputs[i].getAttribute("name") == selector.getAttribute("name")) { 
          inputs[0].parentNode.style.backgroundPosition = "0px 0px";
          inputs[1].parentNode.style.backgroundPosition = "0px 0px";
          inputs[2].parentNode.style.backgroundPosition = "0px 0px";
          inputs[3].parentNode.style.backgroundPosition = "0px 0px";
        }
      }
    }
   }  
	}, 
  clear: function() {} 
} 

