function moveOptions(oSource, oTarget) {
	var oSourceItem, oTargetItem
	var aRemove = Array() // Array of item-indexes to be removed
	var iCount = 0 // Item-count
	var iNewIndex
	for (i=0; i < oSource.length; i++) {
		if (oSource.item(i).selected) {
			iCount++
			aRemove[iCount] = i
			oSourceItem = oSource.item(i)
			oTargetItem = document.createElement("OPTION")
			oTargetItem.text = oSourceItem.text
			oTargetItem.value = oSourceItem.value
			iNewIndex = oTarget.length
			
			// Find correct target position (sort)
			for (j=0; j < oTarget.length; j++) {
				if (oSource.item(i).text < oTarget.item(j).text) {
					iNewIndex = j
					break
				}
			}
			oTarget.add(oTargetItem, iNewIndex)
		}
	}
	
	// Remove selected items
	for (i=1; i <= iCount; i++) {
		oSource.remove(aRemove[i]-(i-1))
	}
}

function selectAllOptions(oSelect) {
	for (i=0; i < oSelect.length; i++) {
		oSelect.item(i).selected = true
	}
}

function over(obj) {
	obj.style.background='#eeeeee';
}

function out(obj) {
	obj.style.background='#ffffff';
}

function sure() {
	return confirm('Er du sikker?');
}

// Open dialog and return value when closed
function openDialog(url, width, height) {
	return showModalDialog("/modaldialog.asp?"+url, "", "dialogWidth:"+width+"px;dialogHeight:"+height+"px;help:no;status:no;scroll:no;");
}

// Return value and close window
function setReturnValue(returnValue) {
	parent.window.returnValue=returnValue
}

// Return value and close window
function doReturn(returnValue) {
	parent.window.returnValue=returnValue
	parent.window.close()
}

// Cancel and close window
function doCancel() {
	parent.window.close()
}

function setHomePage() {
  var url="http://www.languagewire.com/";
  // Internet Explorer 5
  if (document.all && document.getElementById) {
    oHomePage.setHomePage(url);
  }
  // Netscape Navigator
  else if(document.layers&&navigator.javaEnabled()) {
    netscape.security.PrivilegeManager.enablePrivilege('UniversalPreferencesWrite');
    navigator.preference('browser.startup.homepage',url);
  }
}

function over(obj) {
	obj.style.background='#eeeeee';
}

function out(obj) {
	obj.style.background='#ffffff';
}

/********************************************************************************
Copyright (C) 1999 Thomas Brattli
This script is made by and copyrighted to Thomas Brattli at www.bratta.com
Visit for more great scripts. This may be used freely as long as this msg is intact!
I will also appriciate any links you could give me.
********************************************************************************/
//Default browsercheck, added to all scripts!
function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}
bw=new checkBrowser()
/********************************************************************************
Remeber to set the look of the divBottom layer in the stylesheet (if you wan't
another font or something)
********************************************************************************/

/*Set these values, gright for how much from the right you wan't the layer to go
and gbottom for how much from the bottom you want it*/
var gright=220
var gbottom=110


/********************************************************************************
Constructing the ChangeText object
********************************************************************************/
function makeObj(obj,nest){
	nest=(!nest) ? '':'document.'+nest+'.'										
   	this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;			
	this.moveIt=b_moveIt;
}
function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x; this.css.top=this.y}

/********************************************************************************
Initilizing the page, getting height and width to moveto and calls the 
object constructor
********************************************************************************/
function geoInit(){
	oGeo=new makeObj('divBottom')
	pageWidth=(bw.ie4 || bw.ie5)?document.body.offsetWidth-4:innerWidth;
	pageHeight=(bw.ie4 || bw.ie5)?document.body.offsetHeight-2:innerHeight;
	checkIt()
	//sets the resize handler.
	onresize=resized
	if(bw.ie4 || bw.ie5) window.onscroll=checkIt;
	//shows the div
	oGeo.css.visibility='visible'
}
/********************************************************************************
This function executes onscroll in ie and every 30 millisecond in ns
and checks if the user have scrolled, and if it has it moves the layer.
********************************************************************************/
function checkIt(){
	if(bw.ie4 || bw.ie5) oGeo.moveIt(document.body.scrollLeft +pageWidth-gright,document.body.scrollTop+pageHeight-gbottom)
	else if(bw.ns4){
		oGeo.moveIt(window.pageXOffset+pageWidth-gright, window.pageYOffset+pageHeight-gbottom)
		setTimeout('checkIt()',30)
	}
}
//Adds a onresize event handler to handle the resizing of the window.
function resized(){
	pageWidth=(bw.ie4 || bw.ie5)?document.body.offsetWidth-4:innerWidth;
	pageHeight=(bw.ie4 || bw.ie5)?document.body.offsetHeight-2:innerHeight;
	if(bw.ie4 || bw.ie5) checkIt()
}






function showdiv(divid){
	document.all[divid].style.visibility='visible';
	document.all[divid].style.overflow='visible';
}

function hidediv(divid){
	document.all[divid].style.visibility='hidden';
	document.all[divid].style.overflow='hidden';
}


function getstate(divid){
	if (GetCookie(divid) == 'visible'){
		SetCookie(divid, 'visible');
		document.all[divid].style.visibility='visible';
		document.all[divid].style.overflow='visible'}
	else{
		SetCookie(divid, 'hidden');
		document.all[divid].style.visibility='hidden';
		document.all[divid].style.overflow='hidden'}
}

function showhide(divid){
	//alert(document.all[divid].style.overflow);
	if (document.all[divid].style.visibility=='hidden'){
		SetCookie(divid, 'visible')
		document.all[divid].style.visibility='visible';
		document.all[divid].style.overflow='visible'}
	else{
		SetCookie(divid, 'hidden')
		document.all[divid].style.visibility='hidden';
		document.all[divid].style.overflow='hidden'}
}

var expDays = 30;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function getCookieVal (offset) {  
var endstr = document.cookie.indexOf (";", offset);  
if (endstr == -1)    
endstr = document.cookie.length;  
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {  
var arg = name + "=";  
var alen = arg.length;  
var clen = document.cookie.length;  
var i = 0;  
while (i < clen) {    
var j = i + alen;    
if (document.cookie.substring(i, j) == arg)      
return getCookieVal (j);    
i = document.cookie.indexOf(" ", i) + 1;    
if (i == 0) break;   
}  
return null;
}
function SetCookie (name, value) {  
var argv = SetCookie.arguments;  
var argc = SetCookie.arguments.length;  
var expires = (argc > 2) ? argv[2] : null;  
var path = (argc > 3) ? argv[3] : null;  
var domain = (argc > 4) ? argv[4] : null;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}
function DeleteCookie (name) {  
var exp = new Date();  
exp.setTime (exp.getTime() - 1);  
var cval = GetCookie (name);  
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function checknumber(input) {
	var str = input.value;
	if (str == '') return false;
	for (var i = 0; i < str.length; i++) {
		var ch = str.substring(i, i + 1)
		if ((ch < "0" || "9" < ch) && ch != '.') {
			return false;
		}
	}
	return true;
}

function help(keyword) {
	popup('/help.asp?mode='+keyword, 'help', 400, 300, 'yes');
}


function popup(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

