window.addEvent('domready', function(){

	/* generic code to open all links with rel=_blank in new window, to pass validation in xhtml strict. */
	$$('a').each(function(link,i){
		if(link.get('rel')=='_blank') link.setProperty('target','_blank');
	});	
	/* end link code */

	/* Standard function to give mCCWrapper the remaining window height if avoidElements is defined */
	//autosize_mCCWrapper();

	/* Standard function to mark all last listitems with class=last in the current document - default enabled */
	markLastLis();
	
	/* Standard function to mark left/right sibling on list - enable with .mark_siblings on list */
	markSiblings();

	/* Dhtml for stemming */	
	Array.each($$('ul#colors li a'),function(link,i){
		link.addEvent('click',function(e){
			e.stop();
			
			var _loader = new Request.HTML(
			{
				url:'/vote/info',
				update: $('dynC')	
			});
			
			_loader.post('idcolor='+link.get('rel'));
			
			Array.each($$('li.active'),function(el,j){
				el.removeClass('active');
			});
			link.getParent().addClass('active');
		});
	});
	
	/* Hook for deling pŒ facebook link */
	Array.each($$('.continue_link'),function(link,i){
		link.addEvent('click',function(e){
			var jsonRequest = new Request.JSON({
				url: '/ajax/update_shared', 
				onSuccess: function(response){
					window.location.href = link.get('rel');
				}
			}).get();
		});
	});
	
});

window.addEvent('resize', function(){
	
	/* Standard function to give mCCWrapper the remaining window height if avoidElements is defined */
	//autosize_mCCWrapper();
	
});

function checkIfChosen(frm)
{

	if(frm.selected_color != undefined)
	{
		return true;
	}
	else
	{
		alert('Du har ikke valgt farge.');
	}
	return false;	

}
