$(document).ready(function(){

	$('div.poll').each(function(i){
		pollId = $(this).attr('id').substr(5);
		$('div.pollItem a',$(this)).each(function(){
			$(this).click(function(){
			  answerId = $(this).attr('id').substr($(this).attr('id').lastIndexOf('-') + 1);
				$.get('/js/CMSPoll.js',
					{pollId: pollId, answerId: answerId},
					function(data){
					  $('#poll-'+pollId).html(data);
					}
				);
			});
		});
	});

	if (self.location.href.indexOf('/admin/') == -1)
	{
		CSBfleXcroll('left-scr');
		CSBfleXcroll('content-scr');
	}

});

function pic_popup(src,w,h){
	window.open('/graphics/news/?src='+src+'&w='+w+'&h='+h,'picture','width='+w+',height='+h+',resizable=no,scrollbars=no,toolbar=no,status=no,menubar=no')
}

function obj(o){
	return document.getElementById(o);
}

function ajax_handle_generic(){
	if(xmlhttp.readyState==4){
		if(xmlhttp.status==200){
			var response=xmlhttp.responseText;
			if(response.indexOf('|')!=-1){
				var update=new Array();
				update=response.split('|');
				if(obj(update[0]).innerHTML!=null){
					obj(update[0]).innerHTML=response.substr((update[0].length+1));
				}
			}
		}
	}
}

function ajax_poll(id,answerId,width){
	xmlhttp.open('get','/js/CMSPoll.js?id='+id+'&answerId='+answerId+'&width='+width);
	xmlhttp.onreadystatechange=ajax_handle_generic;
	xmlhttp.send(null);
}

