function str_replace(ch,nch,str){
    var chl = ch.length;
    var nchl = nch.length;
    var i = str.indexOf(ch);
    while(i>-1){
        str = str.substring(0,i)+nch+str.substring(i+chl);
        i = str.indexOf(ch,i+nchl);
    }
    return str;
}

function visbillede(id) {
	window.open('/billedvisning.php?id=' + id,'Billedviser','top=0,left=0,width=50,height=50');
}

function onhover(row,antal) {
	for(i=1;i<=antal;i++) {
		document.getElementById('row_' + row + '_' + i).style.backgroundColor = '#CCCCCC';
	}
}

function outhover(row,antal,color) {
	for(i=1;i<=antal;i++) {
		document.getElementById('row_' + row + '_' + i).style.backgroundColor = color;
	}
}

function blinkmodel() {
	document.getElementById('modeller').style['backgroundColor']		= '#CCCCCC';
	
	setTimeout("document.getElementById('modeller').style['backgroundColor'] = '#F1F1F1'",500);
	setTimeout("document.getElementById('modeller').style['backgroundColor'] = '#CCCCCC'",1000);
	setTimeout("document.getElementById('modeller').style['backgroundColor'] = '#F1F1F1'",1500);
	setTimeout("document.getElementById('modeller').style['backgroundColor'] = '#CCCCCC'",2000);
	setTimeout("document.getElementById('modeller').style['backgroundColor'] = '#F1F1F1'",2500);
	setTimeout("document.getElementById('modeller').style['backgroundColor'] = '#CCCCCC'",3000);
	setTimeout("document.getElementById('modeller').style['backgroundColor'] = '#F1F1F1'",3500);
	setTimeout("document.getElementById('modeller').style['backgroundColor'] = '#CCCCCC'",4000);
	setTimeout("document.getElementById('modeller').style['backgroundColor'] = '#F1F1F1'",4500);
	setTimeout("document.getElementById('modeller').style['backgroundColor'] = '#CCCCCC'",5000);
	setTimeout("document.getElementById('modeller').style['backgroundColor'] = '#F1F1F1'",5500);
}

function hent(variable) {
	var query	= window.location.href.split('?');
	
	if (query.length == 1) return false;
	
	query		= str_replace('+',' ',query[1]);
	query		= urldecode(query);
	
	var vars	= query.split("&");
	
	for(i=0;i<vars.length;i++) {
		var pair= vars[i].split("=");
		if (pair[0] == variable) return pair[1];
	}
	
	return false;
}
