function GeneratePassword() {

    var length=6;
    var sPassword = "";

    for (i=0; i < length; i++) {
        numI = getRandomNum();
     	while (checkPunc(numI)) { numI = getRandomNum(); } 

        sPassword = sPassword + String.fromCharCode(numI);
    }

    document.forms['forening'].passField.value = sPassword

    return true;
}

function getRandomNum() {

    // between 0 - 1
    var rndNum = Math.random()

    // rndNum from 0 - 1000
    rndNum = parseInt(rndNum * 1000);

    // rndNum from 33 - 127
    rndNum = (rndNum % 94) + 33;

    return rndNum;
}

function checkPunc(num) {

    if ((num >=33) && (num <=47)) { return true; }
    if ((num >=58) && (num <=64)) { return true; }
    if ((num >=91) && (num <=96)) { return true; }
    if ((num >=123) && (num <=126)) { return true; }

    return false;
}

/*****************************************/
/*****************************************/
function getSelectedSchool( action ){
	document.forms['forening'].action = action
	document.forms['forening'].submit();
	/*var aInputs = document.getElementsByTagName ( "input" );
	for(i=0; i < document.forms['forening'].elements.length; i++) {
		if( aInputs.value != '' ){
			aInputs.value == aInputs.value
		}
	}*/
}

function showControl( showThis, hideThis ){
	document.getElementById( showThis ).style.display = 'block'
	if(document.getElementById( hideThis )){
		document.getElementById( hideThis ).style.display = 'none'
	}
}


function popUp( sUrl ){
	//sUrl = replace(sUrl, '/preview', '')
	window.open(sUrl,"my_new_window", "toolbar=no, location=yes, directories=yes, status=no, menubar=yes, scrollbars=no, resizable=yes, copyhistory=yes, width=700, height=450, top=200, left=300")
}