
function tips(menuID) {
	var input = $('juridisk').getValue();
	new Ajax.Updater('update','ajax_tips.asp',{
		method:'post',parameters: {'ID': input,'menuID': menuID}
	});
	
}


function juridisk() {
	var input = $('juridisk').getValue();
	new Ajax.Updater('update','ajax_juristen.asp',{
		method:'post',parameters: {'ID': input}
	});
	
}


function showmenu(arg)
	{
		alert(arg);
		$(arg).style.display = 'block';
		
	}
	
function show_pop(fil){
	if ($('box_overlay')){
		$('box_overlay').remove();
		$('box_wrapper').remove();
	}
	
	var overlay = Builder.node('div', { id: 'box_overlay',style: 'display:none' });
	var element = Builder.node('div', { id: 'box_wrapper'}, [
	  	
		Builder.node('div', { id: 'box_rep' }),
		
	  ]);
	  
	$('body').appendChild(overlay);
	$('body').appendChild(element);
	$('box_overlay').observe('click', (function() { $('box_overlay').remove();$('box_wrapper').remove() }));
	$('box_overlay').appear({ duration: 0.3, from: 0.0, to: 0.8 });
	
	new Ajax.Updater({ success: 'box_rep' }, fil, {});
}

/* Nytt popup script 31.08 */
var pop = {
 	init: function(file,type,width,title){
 		pop.destroy();
		pop.build_window(type,width,title);
		pop.update_content(file, type);
	},
	build_window: function(type,width,title){
		var overlay = Builder.node('div', { id: 'box_overlay', style: 'display:none' });
		
		/* Legg til nye type her hvis du vil bygge ut. */
		switch(type){
			case 1:
				var element = Builder.node('div', { id: 'box_wrapper', style: 'display:none;width:' + width + 'px;margin-left:-' + parseInt(width/2) + 'px;'}, [
				  	Builder.node('div', { id: 'box_top' }, title),
					Builder.node('div', { id: 'box_rep', className: 'box_rep_login' }),
					Builder.node('div', { id: 'box_close' })
				  ]);
				  break;
			case 2:
				var element = Builder.node('div', { id: 'box_wrapper', style: 'display:none;width:' + width + 'px;margin-left:-' + parseInt(width/2) + 'px;'}, [
				  	Builder.node('div', { id: 'box_top' }, title),
					Builder.node('div', { id: 'box_rep', className: 'box_rep_glemt' }),
					Builder.node('div', { id: 'box_close' })
				  ]);
				  break;
		    case 3:
				var element = Builder.node('div', { id: 'box_wrapper', style: 'display:none;width:' + width + 'px;margin-left:-' + parseInt(width/2) + 'px;'}, [
				  	Builder.node('div', { id: 'box_top' }, title),
					Builder.node('div', { id: 'box_rep', className: 'box_rep_video' }),
					Builder.node('div', { id: 'box_close' })
				  ]);
				  break;
			case 4:
				var element = Builder.node('div', { id: 'box_wrapper', style: 'display:none;width:' + width + 'px;margin-left:-' + parseInt(width/2) + 'px;'}, [
				  	Builder.node('div', { id: 'box_top' }, title),
					Builder.node('div', { id: 'box_rep', className: 'box_rep_tilbakemelding' }),
					Builder.node('div', { id: 'box_close' })
				  ]);
				  break;
			 case 5:
				var element = Builder.node('div', { id: 'box_wrapper', style: 'display:none;width:' + width + 'px;margin-left:-' + parseInt(width/2) + 'px;'}, [
				  	Builder.node('div', { id: 'box_top' }, title),
					Builder.node('div', { id: 'box_rep', className: 'box_rep_vilkar' }),
					Builder.node('div', { id: 'box_close' })
				  ]);
				  break;
			case 6:
				var element = Builder.node('div', { id: 'box_wrapper', style: 'display:none;width:' + width + 'px;margin-left:-' + parseInt(width/2) + 'px;'}, [
				  	Builder.node('div', { id: 'box_top' }, title),
					Builder.node('div', { id: 'box_rep', className: 'box_rep_passordsendt' }),
					Builder.node('div', { id: 'box_close' })
				  ]);
				  break;
			break;
		}
		  
		document.body.appendChild(overlay);
		document.body.appendChild(element);
		
		$('box_overlay').observe('click', (function() { pop.destroy(); }));
		$('box_close').observe('click', (function() { pop.destroy(); }));
		$('box_overlay').appear({ duration: 0.3, from: 0.0, to: 0.5, queue: 'end' });
		$('box_wrapper').appear({ duration: 0.3, from: 0.0, to: 1.0, queue: 'end' });
	},
	update_content: function(file){
		new Ajax.Updater({ success: 'box_rep' }, file, {});
	},
	destroy: function(){
 		if ($('box_overlay')){
			$('box_overlay').remove();
			$('box_wrapper').remove();
		}
	}
};

function galleri(){
		if(!$('flash')) return false;
		var i = 0;
		var arr = $('flash').childElements();
		
		new PeriodicalExecuter(function() {
			
			if ((i+1) == arr.size()){
				i = 0;
				Effect.Appear(arr[0], { duration: 1.0 });
				window.setTimeout(function() { arr.invoke('show'); } , 5000);
			}else{
				Effect.Fade(arr[i], { duration: 1.0 });
				i += 1;
			};
		},5);
	}
	
function logo(){
		if(!$('logo')) return false;
		var j = 0;
		var arr1 = $('logo').childElements();
		
		new PeriodicalExecuter(function() {
			
			if ((j+1) == arr1.size()){
				j = 0;
				Effect.Appear(arr1[0], { duration: 1.0 });
				window.setTimeout(function() { arr1.invoke('show'); } , 5000);
			}else{
				Effect.Fade(arr1[j], { duration: 1.0 });
				j += 1;
			};
		},5);
	}
	
	document.observe("dom:loaded",function(){
		galleri();
		logo();
	})




