$(document).ready(function(){
	
	$('a.show-opt').click(function(){
		
		var id = $(this).attr('rel');
		var showBox = '#' + id;

		$(showBox).toggle();
		
		if ( !isVisible($(showBox))){
			$(this).css({
				'background-image': 'url(public/images/icons/drop-right.gif)'
			});
		}else{
			$(this).css({
				'background-image': 'url(public/images/icons/drop-down.gif)'
			});
		}
		
		if (document.getElementById) { // DOM3 = IE5, NS6
			if (document.getElementById(id).style.display != "none"){
				//document.getElementById(id).style.display = 'block';
				document.CreatePoll_Form["is_" + id + "_expanded"].value = "yes";
			} else {
				//document.getElementById(id).style.display = 'none';	
				document.CreatePoll_Form["is_" + id + "_expanded"].value = "no";
			}	
		} else { 
			if (document.layers) {	
				if (document.id.display != "none"){
					//document.id.display = 'block';
					document.CreatePoll_Form["is_" + id + "_expanded"].value = "yes";
				} else {
					//document.id.display = 'none';
					document.CreatePoll_Form["is_" + id + "_expanded"].value = "no";
				}
			} else {
				if (document.all.id.style.visibility != "none"){
					//document.all.id.style.display = 'block';
					document.CreatePoll_Form["is_" + id + "_expanded"].value = "yes";
				} else {
					//document.all.id.style.display = 'none';
					document.CreatePoll_Form["is_" + id + "_expanded"].value = "no";
				}
			}
		}
		
	})
	
})

function isVisible(obj) { return (obj.css('display') == 'block'); } 