
function new_window(URL,windowName,width,height) {
	winwin=window.open(URL, windowName, "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,width="+width+",height="+height+",resizable=no" );
	winwin.focus();
}
function new_window_scroll(URL,windowName,width,height) {
	winwin=window.open(URL, windowName, "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width="+width+",height="+height+",resizable=yes" );
	winwin.focus();
}

function fDigits(elm) {
	//return (parseInt(elm.value)>=0);
	var ok=true,tmp_str=""
	var valid = '1234567890';
	var tmpValue = elm.value;
	for (var ii=0; ii < elm.value.length; ii++) {
		tmp = elm.value.substring(ii,ii+1);
		if (valid.indexOf(tmp) < 0) {
			ok=false;
		}
	}
	 return ok;
}	

// Funktioner som räknar ut summar i rader eller kolumner
function excel(result, cells, func)
{
	var result_element = document.forms[0].elements[result];
	var result_value = 0;
	for(i in cells)
	{
		result_value = func(result_value, cells[i]);
	}
	if(!parseFloat(result_value) && parseFloat(result_value)!=0) {
		result_value = '-';
	} else {
		result_value = Math.round(parseFloat(result_value)*100)/100;
	}
	result_element.value = result_value;
}

function excel_addAll(old_value, cell)
{
	var cell_element = document.forms[0].elements[cell];
	return old_value + parseFloat(cell_element.value);
}

function excel_add(old_value, cell)
{
	var cell_element = document.forms[0].elements[cell];
	if(!parseFloat(cell_element.value)){
		var tmp_value=0;
	}
	else{
		var tmp_value=cell_element.value;
	}
	return old_value + parseFloat(tmp_value);
}

function excel_multiply(old_value, cell)
{
	var cell_element = document.forms[0].elements[cell];
	
	if (old_value==0) {
		old_value=1
	}
		return old_value * parseFloat(cell_element.value);
}

function presentation()
{
	w = screen.width-100;
	h = screen.height-100;
	x = screen.width/2-w/2;
	y = screen.height/2-w/2;
	window.open('/img/pdf/industries_presentation.pdf','Borgestad_Industries_Presentation','width='+w+', height='+h+' screenX='+x+', left='+x+', screenY='+y+', top='+y+', resizable=1');
}



//Axel lägger till för menyn
////////////////////////////////////




function listMenu() {


	var menus = document.getElementById('menu1');
    
//	var menus = getLayerObj('menus', true);


	if (menu1.display == 'block') {

		menu1.display = 'none';
		alert('1');

	}
	else {
		alert('2');
		menu1.display = 'block';

	}
}
/*

function listMenu(which){

	m = document.getElementById(which);

	trig = m.style.display;
	if (trig=="block") {
		trig="none";
		alert('1');
	}else if (trig=="" || trig=="none"){
		trig="block";
		alert('2');
	}
	m.style.display=trig;
}
*/

