
function OpenWindow(instr) {
	winwidth = 850;		// width of the new window 
	winheight = 550;	// height of the new window 
	winleft   = 200;	// just dummie values
	wintop    = 200;	// just dummie values
	  
	if(parseInt(navigator.appVersion)>=4) {
		winleft = (screen.width / 2) - (winwidth / 2); // center the window right to left 
		wintop = (screen.height / 2) - (winheight / 2); // center the window top to bottom 
	}
	window.open('/serverhall/?strPic=' + instr, 'Test', 'top=' + wintop + ',left=' + winleft + ',height=' + winheight + ',width=' + winwidth);  
}

function OpenWindow2(instr) {
    winwidth = 850; 	// width of the new window 
    winheight = 650; // height of the new window 
    winleft = 200; // just dummie values
    wintop = 200; // just dummie values

    if (parseInt(navigator.appVersion) >= 4) {
        winleft = (screen.width / 2) - (winwidth / 2); // center the window right to left 
        wintop = (screen.height / 2) - (winheight / 2); // center the window top to bottom 
    }
    window.open(instr, 'Test', 'top=' + wintop + ',left=' + winleft + ',height=' + winheight + ',width=' + winwidth);
}

var arrValidChars = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
var arrSpecialChars = new Array(8, 9, 35, 36, 37, 38, 39, 40, 46);
function VerifyCharacters(event, objInput) {
    var strText = objInput.value;
    var keyCode = event.keyCode || event.charCode;
    if (InArray(arrSpecialChars, keyCode) >= 0)
        return true;
    var strChar = String.fromCharCode(keyCode);

    return (InArray(arrValidChars, strChar) >= 0);
}

function InArray(arr, key) {
    for (var i = 0; i < arr.length; i++) {
        if (arr[i] == key)
            return i;
    }
    return -1;
}

function replaceChars(entry, ObjMy) {
    out = "."; // replace this
    add = ","; // with this
    temp = "" + entry; // temporary holder

    while (temp.indexOf(out) > -1) {
        pos = temp.indexOf(out);
        temp = "" + (temp.substring(0, pos) + add +
            temp.substring((pos + out.length), temp.length));
    }
    ObjMy.value = temp;
}


var arrValidChars2 = new Array("a", "b", "c", "d", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "x", "y", "z");
var arrSpecialChars2 = new Array(8, 9, 35, 36, 37, 38, 39, 40, 46);
function VerifyCharacters2(event, objInput) {
    var strText = objInput.value;
    var keyCode = event.keyCode || event.charCode;
    if (InArray(arrSpecialChars2, keyCode) >= 0)
        return true;
    var strChar = String.fromCharCode(keyCode);
    return (InArray(arrValidChars2, strChar) >= 0);
}

function replaceChars2(entry, ObjMy) {
    out = "."; // replace this
    add = ","; // with this
    temp = "" + entry; // temporary holder

    while (temp.indexOf(out) > -1) {
        pos = temp.indexOf(out);
        temp = "" + (temp.substring(0, pos) + add +
            temp.substring((pos + out.length), temp.length));
    }
    ObjMy.value = temp;
}

function kolla() {
    if (document.kontakt.namn.value == "") {
        alert("Du måste skriva ett namn!")
        document.kontakt.namn.focus();
        return false;
    }
    if (document.kontakt.epost.value == "") {
        alert("Du måste skriva en e-postadress!")
        document.kontakt.epost.focus();
        return false;
    }
    if (document.kontakt.epost.value.indexOf('@', 0) == -1 || document.kontakt.epost.value.indexOf('.', 0) == -1) {
        alert("Du måste ange en riktig e-postadress!");
        document.kontakt.epost.focus();
        return false;
    }
    if (document.kontakt.meddelande.value == "") {
        alert("Du måste skriva ett meddelande!");
        document.kontakt.meddelande.focus();
        return false;
    }
    if ((document.kontakt.meddelande.value.length <= 5)) {
        alert('Ditt meddelande bör vara mer än fem tecken!');
        document.kontakt.meddelande.focus();
        return false;
    }
}

function checkSearch() {
    if (document.FaqSearch.searchFaq.value == "") {
        alert("Du måste fylla i ett sökord.");
        document.FaqSearch.searchFaq.focus();
        return false;
    }
}








