// // Create and return httprequest channel to database // function createHttpRequest() { //request = new XMLHttpRequest(); var xmlHttp = false; //Use IE's ActiveX items to load the file. if(typeof ActiveXObject != 'undefined') { try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlHttp = false; } } } else if (XMLHttpRequest) { try { xmlHttp = new XMLHttpRequest(); } catch (e) { xmlHttp = false; } } return xmlHttp; } // // Function receives, polls, or waits for information from server // after the httpRequest that was sent. // function handleHttpPostResponse() { //alert("handle response, ready state = "+request.readyState); if (myHttpRequest.readyState == 4) { // ReadyState of 4 means finished if (myHttpRequest.status == 200) { // HTTP status of 200 means ALL OK // Get the response as plain text //ajaxResultXML = request.responseXML; var httpResultStr = myHttpRequest.responseText; //alert("handleHttpPostResponse: \n" + httpResultStr); // Call displayResults. This method must be implemented // for each page to do the page specific logic. var currTypeTmp = httpResultStr.split("<>"); var currType = currTypeTmp[1].replace(/[\r\n]+/g, ""); // // Vilt // if(currType == "adderaVilt") { document.getElementById("containerDiv").innerHTML = currTypeTmp[0]; // // Make sure we know what page we're working with // currentPage = "newgame"; } else if(currType == "redigeraVilt") { //document.getElementById("containerDiv").innerHTML = currTypeTmp[0]; // // Render user selecte game info to be edited // redigeraVilt(currTypeTmp[0]); } else if(currType == "raderaVilt") { // // User seems to be logged in, start. So lets render currently registered game // sendHttpPostRequest('PhpFunctions/renderaVilt.php', 'limitStart=0'); } else if(currType == "renderaVilt") { //alert("renderaVilt: \n\r" + currTypeTmp[0]); // // Add content to content_div // document.getElementById("content_div").innerHTML = currTypeTmp[0]; // // Show vilt under menu // var lm = document.getElementById("lower_menu"); lm.style.visibility = "visible"; // // Add items to menu // var currItems = ""; currItems += '
 
'; currItems += '
Addera Vilt
'; lm.innerHTML = currItems; } else if(currType == "renderThisGame") { //document.getElementById("containerDiv").innerHTML = currTypeTmp[0]; // // Render user selecte game info // renderThisGame(currTypeTmp[0]); } // // User pages, what to render in content div // else if(currType == "renderUserPagesNLI") { document.getElementById("content_div").innerHTML = currTypeTmp[0]; } else if(currType == "renderUserPagesLI") { //document.getElementById("content_div").innerHTML = currTypeTmp[0]; // // Create plats and ammo profiler // var tmp = currTypeTmp[0].split("<>"); currPlatsProfiler = tmp[0].split("<>"); var tmp = tmp[1].split("<>"); currAmmoProfiler = tmp[0].split("<>"); // // Check if user has any groups // if(tmp[1] != "") { currUserGroups = tmp[1].split("<>"); } else { } // // Change menu "Skapa Konto" to "Mitt Konto" and links action/onclick // var accountMenu = document.getElementById("account_menu"); accountMenu.innerHTML = "Mitt Konto"; accountMenu.title = "Hantera Ditt Konto"; accountMenu.onclick = function() { sendHttpPostRequest('PhpFunctions/handleUsersAccount.php'); }; // // User seems to be logged in, start. So lets render currently registered game // sendHttpPostRequest('PhpFunctions/renderaVilt.php', 'limitStart=0'); } /******************************************************************** * DIARY ENTRIES * ********************************************************************/ // // User diary entries, render them // else if(currType == "renderUserDiary") { document.getElementById("content_div").innerHTML = currTypeTmp[0]; // // Show diary entries under menu // var lm = document.getElementById("lower_menu"); lm.style.visibility = "visible"; // // Add items to menu // var currItems = ""; currItems += '
 
'; currItems += '
Addera Dagboksinlägg
'; lm.innerHTML = currItems; } // // New diary entry saved, show all users diary entries // else if(currType == "saveNewDiaryEntry") { sendHttpPostRequest('PhpFunctions/renderUserDiary.php'); } // // Render user specified diary entry // else if(currType == "renderThisDiaryEntry") { renderThisDiaryEntry(currTypeTmp[0]); } // // Render user specified diary entry // else if(currType == "editDiaryEntry") { editDiaryEntry(currTypeTmp[0]); } // // Diary entry updated, show all users diary entries // else if(currType == "updateDiaryEntry") { sendHttpPostRequest('PhpFunctions/renderUserDiary.php'); } // // Diary entry removed/deleted, show all users diary entries // else if(currType == "raderaDiaryEntry") { sendHttpPostRequest('PhpFunctions/renderUserDiary.php'); } /******************************************************************** * USER GROUPS * ********************************************************************/ // // User groups, render them // else if(currType == "renderUserGroups") { // // Show user profiles under menu // var lm = document.getElementById("lower_menu"); lm.style.visibility = "visible"; // // Add items to menu // var currItems = ""; currItems += '
 
'; currItems += '
Skapa Grupp
'; lm.innerHTML = currItems; document.getElementById("content_div").innerHTML = currTypeTmp[0]; } // // New user group has been saved // else if(currType == "saveNewGroup") { sendHttpPostRequest('PhpFunctions/renderUserGroups.php'); } // // User wants to see specific groups info // else if(currType == "renderThisGroup") { // // Get current group id from currTypeTmp // var tmp = currTypeTmp[0].split("<>"); var currID = tmp[0]; currTypeTmp[0] = tmp[1]; // // Show user profiles under menu // var lm = document.getElementById("lower_menu"); lm.style.visibility = "visible"; // // Add items to menu // var currItems = ""; currItems += '
 
'; currItems += '
Nytt Meddelande
'; currItems += '
Jakt/Möte
'; currItems += '
Redigera Grupp
'; currItems += '
Medlemmar
'; currItems += '
Radera Grupp
'; currItems += ''; lm.innerHTML = currItems; document.getElementById("content_div").innerHTML = currTypeTmp[0]; } // // User wants to see specific groups info // else if(currType == "handleGroupMembers") { // // Get current group id from currTypeTmp // var tmp = currTypeTmp[0].split("<>"); var currID = tmp[0]; currTypeTmp[0] = tmp[1]; // // Make back menu option visible // document.getElementById("backToThisGroupDiv").style.visibility = "visible"; document.getElementById("content_div").innerHTML = currTypeTmp[0]; } // // New member been invited // else if(currType == "inviteNewMember") { /* // // Get current group id from currTypeTmp // var tmp = currTypeTmp[0].split("<>"); var currID = tmp[0]; currTypeTmp[0] = tmp[1]; */ sendHttpPostRequest('./PhpFunctions/handleGroupMembers.php', 'currID=' + currTypeTmp[0]); } // // New member created account and accepted invitation // else if(currType == "createNewAccountAccept") { document.getElementById("content_div").innerHTML = currTypeTmp[0]; } // // New member created account and accepted invitation // else if(currType == "saveNewAccountAccept") { location.href = "http://www.jaktstatistik.se"; } /******************************************************************** * GROUP MESSAGES * ********************************************************************/ // // New message created created and saved // else if(currType == "saveNewGroupMessage") { sendHttpPostRequest('./PhpFunctions/renderThisGroup.php', 'currID=' + currTypeTmp[0]); } // // User wants to see specific message // else if(currType == "renderThisMessage") { // // Get current group id from currTypeTmp // var tmp = currTypeTmp[0].split("<>"); var currID = tmp[0]; currTypeTmp[0] = tmp[1]; // // Make back menu option visible // document.getElementById("backToThisGroupDiv").style.visibility = "visible"; document.getElementById("content_div").innerHTML = currTypeTmp[0]; } /******************************************************************** * GROUP EVENTS * ********************************************************************/ // // New event created created and saved // else if(currType == "saveNewGroupEvent") { sendHttpPostRequest('./PhpFunctions/renderThisGroup.php', 'currID=' + currTypeTmp[0]); } // // New event created created and saved // else if(currType == "saveGroupEventResponse") { sendHttpPostRequest('./PhpFunctions/renderThisGroup.php', 'currID=' + currTypeTmp[0]); } /******************************************************************** * USER PROFILES * ********************************************************************/ // // User profiles, render them // else if(currType == "renderUserProfiles") { // // Create plats and ammo profiler // var tmp = currTypeTmp[0].split("<>"); currTypeTmp[0] = tmp[0]; tmp = tmp[1].split("<>"); currPlatsProfiler = tmp[0].split("<>"); currAmmoProfiler = tmp[1].split("<>"); // // Show user profiles under menu // var lm = document.getElementById("lower_menu"); lm.style.visibility = "visible"; // // Add items to menu // var currItems = ""; currItems += '
 
'; currItems += '
Addera Platsprofil
'; currItems += '
Addera Ammunitionsprofil
'; lm.innerHTML = currItems; // // Render users profiles // document.getElementById("content_div").innerHTML = currTypeTmp[0]; } // // New place profile saved // else if(currType == "saveNewPlaceInfo") { // // Call for user profiles start page // sendHttpPostRequest('./PhpFunctions/renderUserProfiles.php'); } // // Place profile updated // else if(currType == "updatePlaceInfo") { // // Call for user profiles start page // sendHttpPostRequest('./PhpFunctions/renderUserProfiles.php'); } // // Place profile removed // else if(currType == "raderaPlaceProfile") { // // Call for user profiles start page // sendHttpPostRequest('./PhpFunctions/renderUserProfiles.php'); } // // New ammo profile saved // else if(currType == "saveNewAmmoInfo") { // // Call for user profiles start page // sendHttpPostRequest('./PhpFunctions/renderUserProfiles.php'); } // // Ammo profile updated // else if(currType == "updateAmmoInfo") { // // Call for user profiles start page // sendHttpPostRequest('./PhpFunctions/renderUserProfiles.php'); } /******************************************************************** * USER ACCOUNTS * ********************************************************************/ // // Create new user // else if(currType == "createNewAccount") { // // Add content to content_div // document.getElementById("content_div").innerHTML = currTypeTmp[0]; } // // New user has been saved // else if(currType == "saveNewAccount") { sendHttpPostRequest('PhpFunctions/renderUserPages.php'); } // // Create new user // else if(currType == "handleUsersAccount") { // // Render users info and give them oportunity to change it // handleUsersAccount(currTypeTmp[0]); } // // Update user info // else if(currType == "updateUsersAccount") { // // Update done. Just let user carry on. Close popup // document.body.removeChild(document.getElementById("editUserInfoDiv")); } // // General to handle failed db questions // else if(currType == "dbquestionfailed") { alert(currTypeTmp[0]); } else { alert("**** ERROR ****\nCurrent HttpRequestResponse has no string identifying it\n\n" + httpResultStr); } } else { alert("An error occurred: " + myHttpRequest.status + ": " + myHttpRequest.statusText); } } }// // Function called to request information regarding section user // wants to edit. // function sendHttpPostRequest(theURL, postData) { //alert("Sending POST to "+ theURL); // Add a random number to end of URL to keep it unique and prevent IE caching theURL = theURL + "?" + Math.random; myHttpRequest.open('POST', theURL, true); myHttpRequest.setRequestHeader("SOAPAction", "theURL") //myHttpRequest.setRequestHeader("Content-Type", "text/xml") //myHttpRequest.setRequestHeader("Content-Type", "text/plain") myHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); myHttpRequest.onreadystatechange=handleHttpPostResponse; myHttpRequest.send(postData); }function md5 ( str ) { // http://kevin.vanzonneveld.net // + original by: Webtoolkit.info (http://www.webtoolkit.info/) // + namespaced by: Michael White (http://getsprink.com) // + tweaked by: Jack // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // - depends on: utf8_encode // * example 1: md5('Kevin van Zonneveld'); // * returns 1: '6e658d4bfcb59cc13f96c14450ac40b9' var RotateLeft = function(lValue, iShiftBits) { return (lValue<>>(32-iShiftBits)); }; var AddUnsigned = function(lX,lY) { var lX4,lY4,lX8,lY8,lResult; lX8 = (lX & 0x80000000); lY8 = (lY & 0x80000000); lX4 = (lX & 0x40000000); lY4 = (lY & 0x40000000); lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF); if (lX4 & lY4) { return (lResult ^ 0x80000000 ^ lX8 ^ lY8); } if (lX4 | lY4) { if (lResult & 0x40000000) { return (lResult ^ 0xC0000000 ^ lX8 ^ lY8); } else { return (lResult ^ 0x40000000 ^ lX8 ^ lY8); } } else { return (lResult ^ lX8 ^ lY8); } }; var F = function(x,y,z) { return (x & y) | ((~x) & z); }; var G = function(x,y,z) { return (x & z) | (y & (~z)); }; var H = function(x,y,z) { return (x ^ y ^ z); }; var I = function(x,y,z) { return (y ^ (x | (~z))); }; var FF = function(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; var GG = function(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; var HH = function(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; var II = function(a,b,c,d,x,s,ac) { a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; var ConvertToWordArray = function(str) { var lWordCount; var lMessageLength = str.length; var lNumberOfWords_temp1=lMessageLength + 8; var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64; var lNumberOfWords = (lNumberOfWords_temp2+1)*16; var lWordArray=Array(lNumberOfWords-1); var lBytePosition = 0; var lByteCount = 0; while ( lByteCount < lMessageLength ) { lWordCount = (lByteCount-(lByteCount % 4))/4; lBytePosition = (lByteCount % 4)*8; lWordArray[lWordCount] = (lWordArray[lWordCount] | (str.charCodeAt(lByteCount)<>>29; return lWordArray; }; var WordToHex = function(lValue) { var WordToHexValue="",WordToHexValue_temp="",lByte,lCount; for (lCount = 0;lCount<=3;lCount++) { lByte = (lValue>>>(lCount*8)) & 255; WordToHexValue_temp = "0" + lByte.toString(16); WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2); } return WordToHexValue; }; var x=Array(); var k,AA,BB,CC,DD,a,b,c,d; var S11=7, S12=12, S13=17, S14=22; var S21=5, S22=9 , S23=14, S24=20; var S31=4, S32=11, S33=16, S34=23; var S41=6, S42=10, S43=15, S44=21; str = utf8_encode(str); x = ConvertToWordArray(str); a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476; xl = x.length; for (k=0;k 127) && (c1 < 2048)) { enc = String.fromCharCode((c1 >> 6) | 192) + String.fromCharCode((c1 & 63) | 128); } else { enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128); } if (enc != null) { if (end > start) { utftext += string.substring(start, end); } utftext += enc; start = end = n+1; } } if (end > start) { utftext += string.substring(start, string.length); } return utftext; }function isNumber(n) { return !isNaN(parseFloat(n)) && isFinite(n); } function emptyMe(param) { // // Check if we're dealing with password fields. If so, set type to 'password' // if(param.id == "create_account_pwd1" || param.id == "create_account_pwd2" || param.id == "login_pwd") { document.getElementById(param.id + "_div").removeChild(document.getElementById(param.id)); var tmp = document.createElement("input"); tmp.id = param.id; tmp.setAttribute("type", "password"); tmp.setAttribute("size", "15"); tmp.setAttribute("class", "rounded_input"); tmp.style.position = "absolute"; tmp.style.top = "30"; tmp.style.left = "27"; tmp.style.width = "362px"; tmp.style.fontSize = "20"; tmp.style.color = "#A9AAA9"; tmp.style.border = "none"; tmp.style.outline = "0"; tmp.style.backgroundColor = "#F9F8FA"; document.getElementById(param.id + "_div").appendChild(tmp); tmp.focus(); } // // Check if we're dealing with password fields. If so, set type to 'password' // if(param.id == "user_password_1" || param.id == "user_password_2") { document.getElementById("editUserInfoDiv").removeChild(document.getElementById(param.id)); var tmp = document.createElement("input"); tmp.id = param.id; tmp.setAttribute("type", "password"); tmp.setAttribute("size", "15"); tmp.setAttribute("class", "rounded_input"); tmp.style.position = "absolute"; tmp.style.top = param.style.top; tmp.style.left = param.style.left; tmp.style.width = "362px"; tmp.style.fontSize = "20"; tmp.style.color = "#A9AAA9"; tmp.style.border = "none"; tmp.style.outline = "0"; tmp.style.backgroundColor = "#F9F8FA"; document.getElementById("editUserInfoDiv").appendChild(tmp); tmp.focus(); } param.value = ""; param.onkeydown = ""; }// // Render contact form // function userContactRequest() { var currContent = ""; currContent += '
'; // // Information to user // currContent += '
'; currContent += 'Skicka ett meddelande eller ställ en fråga. Se bara till att fylla i fälten så vi kan svara dig! '; currContent += '
'; // // User email // currContent += ''; currContent += ''; // // User phone // currContent += ''; currContent += ''; // // User subject // currContent += ''; currContent += ''; // // Comment // currContent += ''; currContent += ''; // // Send button // currContent += '
'; currContent += 'Skicka'; currContent += '
'; // // Exit/Cancel button // currContent += '
'; currContent += 'Avbryt'; currContent += '
'; currContent += "
"; document.getElementById("content_div").innerHTML = currContent; }// // Add new game that user caught // function adderaNyttVilt() { // // Get content div // var cd = document.getElementById("content_div"); var currContent = ""; currContent += '
'; currContent += '
'; currContent += 'Fält kan lämnas tomma. Vill ni ändra eller lägga till går det bra att göra det vid ett senare tillfälle via "Redigera Vilt". '; currContent += 'Ange bara numeriska värden, inte enheter som Kg eller m.'; currContent += '
'; // // Present species // currContent += ''; currContent += ''; // // Present genders // var curr_gender = Array(Array("M", "Hane"), Array("F", "Hona")); currContent += ''; currContent += ''; // // Present ages // var curr_ages = Array("Ungt djur 0-12 månader", "Ungt djur 1-2 år", "Vuxet djur +2,5 år"); currContent += ''; currContent += ''; // // Weight // currContent += ''; currContent += ''; // // Escape distance // currContent += ''; currContent += ''; // // Escape distance // currContent += ''; currContent += ''; // // Present huntingform // var curr_huntingform = Array("Jaktform", "Drevjakt med hund", "Löshundsjakt", "Vak eller lockjakt", "Smygjakt", "Grytjakt"); currContent += ''; currContent += ''; // // Present hitarea // var curr_hitarea = Array(Array("1", "Träffområdet"), Array("2","Nervsystemet"), Array("3", "Buk"), Array("4", "Övrigt")); currContent += ''; currContent += ''; // // Hitarea comment // currContent += ''; currContent += ''; currContent += '
'; currContent += '-- Plats / Marken -- '; currContent += '
'; // // Areas, huntinggrounds // var curr_huntareas = Array(); for(var ppcnt = 0; ppcnt < currPlatsProfiler.length; ppcnt++) { curr_huntareas[ppcnt] = currPlatsProfiler[ppcnt].split("<>"); } currContent += ''; currContent += ''; // // Huntingarea name // currContent += ''; currContent += ''; // // Huntingarea lan // currContent += ''; currContent += ''; // // Huntingarea kommun // currContent += ''; currContent += ''; // // Huntingarea pass // currContent += ''; currContent += ''; // // Huntingarea datum // var currDate = new Date(); var currY = currDate.getFullYear(); var currM = Number(currDate.getMonth()) + Number(1); var currD = currDate.getDate(); var currHour = currDate.getHours(); var currMinute = currDate.getMinutes(); currContent += ''; currContent += ''; // // Huntingarea time // currContent += ''; currContent += ''; currContent += '
'; currContent += '-- Ammunitionen -- '; currContent += '
'; // // Weapon / Ammo // var curr_ammo = Array(); for(var ppcnt = 0; ppcnt < currAmmoProfiler.length; ppcnt++) { curr_ammo[ppcnt] = currAmmoProfiler[ppcnt].split("<>"); } currContent += ''; currContent += ''; // // Ammo name // currContent += ''; currContent += ''; // // Ammo weapon type // currContent += ''; currContent += ''; // // Ammo kaliber // currContent += ''; currContent += ''; // // Ammo kula // currContent += ''; currContent += ''; // // Ammo kulvikt // currContent += ''; currContent += ''; // // Ammo antal skjutna skott // currContent += ''; currContent += ''; // // Ammo skjutavstånd // currContent += ''; currContent += ''; // // Ammo genomslag // var curr_genomslag = Array(Array("0", "Genomslag"), Array("1", "JA"), Array("2", "NEJ")); currContent += ''; currContent += ''; // // Ammo splitrats // var curr_splitras = Array(Array("0", "Splitrats"), Array("1", "JA"), Array("2", "NEJ")); currContent += ''; currContent += ''; var currTop = 520; var currLeft = 10; currContent += '
'; currContent += '-- Grupper som kan se viltet -- '; currContent += '
'; // // Groups // if(currUserGroups.length <= 0) { currContent += '
Du har inte definierat några grupper / marker! Gå in på "Grupper" i menyn för skapa nya grupper
'; } var curr_group = Array(); for(var ppcnt = 0; ppcnt < currUserGroups.length; ppcnt++) { curr_group[ppcnt] = currUserGroups[ppcnt].split("<>"); } for(var scnt = 0; scnt < curr_group.length; scnt++) { currContent += '
' + curr_group[scnt][1] + '
'; currLeft += Number(180); if(currLeft > 750) { currLeft = 10; currTop += Number(30); } } // // Comment, image, save // currTop += Number(100); currLeft = 10; currContent += '
'; currContent += '-- Bild / Kommentar / Spara -- '; currContent += '
'; // // Comment // currContent += ''; currContent += ''; // // Image // currContent += '
'; currContent += ''; currContent += ''; currContent += '
'; // // Save button // currContent += '
'; currContent += 'Spara Informationen'; currContent += '
'; currTop += Number(100); currContent += '
 
'; currContent += ''; currContent += ''; currContent += ''; currContent += ''; currContent += ''; currContent += ''; // // Add to content div // cd.innerHTML = currContent; } function moveCursorToStart(param) { //alert("moveCursorToStart: id: " + param.id); if(curr_browser == "IE" || curr_browser == "CHROME") { var tmp = param.value; param.value = ""; param.focus; param.value = tmp; } else { param.setSelectionRange(0, 0); } } // // Populate hunting area fields when user selects profile // function setHuntingAreaInfo(param) { var tmp = param.item(param.selectedIndex); var mark = tmp.getAttribute("mark"); var lan = tmp.getAttribute("lan"); var kommun = tmp.getAttribute("kommun"); //alert("setHuntingAreaInfo: \n\rmark: " + mark + "\n\rlan: " + lan + "\n\rkommun: " + kommun); document.getElementById("gameHuntMark").value = mark; document.getElementById("gameHuntLan").value = lan; document.getElementById("gameHuntKommun").value = kommun; } // // Populate ammo info fields when user selects profile // function setAmmoInfo(param) { var tmp = param.item(param.selectedIndex); var namn = tmp.getAttribute("namn"); var vapen_typ = tmp.getAttribute("vapen_typ"); var kaliber = tmp.getAttribute("kaliber"); var kula = tmp.getAttribute("kula"); var kulvikt = tmp.getAttribute("kulvikt"); document.getElementById("gameAmmoNamn").value = namn; document.getElementById("gameAmmoTyp").value = vapen_typ; document.getElementById("gameAmmoKaliber").value = kaliber; document.getElementById("gameAmmoKula").value = kula; document.getElementById("gameAmmoKulvikt").value = kulvikt; } // // Send save reqguest // function sendSaveGame() { var gameType = document.getElementById("gameType"); var gameGender = document.getElementById("gameGender"); var gameAge = document.getElementById("gameAge"); var gameWeight = document.getElementById("gameWeight"); var gameEscapeDistance = document.getElementById("gameEscapeDistance"); var gameSurviveTime = document.getElementById("gameSurviveTime"); var gameHuntType = document.getElementById("gameHuntType"); var gameHitArea = document.getElementById("gameHitArea"); var gameHAComment = document.getElementById("gameHAComment"); var gameHuntArea = document.getElementById("gameHuntArea"); var gameHuntMark = document.getElementById("gameHuntMark"); var gameHuntLan = document.getElementById("gameHuntLan"); var gameHuntKommun = document.getElementById("gameHuntKommun"); var gameHuntPass = document.getElementById("gameHuntPass"); var gameHuntDate = document.getElementById("gameHuntDate"); var gameHuntTime = document.getElementById("gameHuntTime"); var gameAmmo = document.getElementById("gameAmmo"); var gameAmmoNamn = document.getElementById("gameAmmoNamn"); var gameAmmoTyp = document.getElementById("gameAmmoTyp"); var gameAmmoKaliber = document.getElementById("gameAmmoKaliber"); var gameAmmoKula = document.getElementById("gameAmmoKula"); var gameAmmoKulvikt = document.getElementById("gameAmmoKulvikt"); var gameAmmoAntal = document.getElementById("gameAmmoAntal"); var gameAmmoAvstand = document.getElementById("gameAmmoAvstand"); var gameAmmoGenomslag = document.getElementById("gameAmmoGenomslag"); var gameAmmoSplitrats = document.getElementById("gameAmmoSplitrats"); var user_groups = document.getElementById("user_groups"); var gameComment = document.getElementById("gameComment"); // // Check weigth to be numeric // gameWeight.value = gameWeight.value.replace(/,/, "."); if(gameWeight.value == "Vikt (Kg)") { gameWeight.value = 0; } else if(!isNumber(gameWeight.value)) { alert("Vikten är inte numerisk, bara siffror!"); return 0; } // // Check escape distance to be numeric // gameEscapeDistance.value = gameEscapeDistance.value.replace(/,/, "."); if(gameEscapeDistance.value == "Flyktsträcka (m)") { gameEscapeDistance.value = 0; } else if(!isNumber(gameEscapeDistance.value)) { alert("Flyktsträckan är inte numerisk, bara siffror!"); return 0; } // // Check survive time to be numeric // gameSurviveTime.value = gameSurviveTime.value.replace(/,/, "."); if(gameSurviveTime.value == "Levde (min)") { gameSurviveTime.value = 0; } else if(!isNumber(gameSurviveTime.value)) { alert("Överlevnadstiden är inte numerisk, bara siffror!"); return 0; } // // Check date // var birthdate = gameHuntDate.value; if(birthdate == "" || birthdate == "ÅÅÅÅ-MM-DD") { birthdate = "0000-00-00"; } else { var tmp = birthdate.split("-"); if(tmp.length != 3) { alert("Kontrollera datumformatet, det ska vara ÅÅÅÅ-MM-DD / 2010-01-01"); return 0; } for(var i = 0; i < tmp.length; i++) { if(!isNumber(tmp[i])) { if(i == 0) { alert("Det förefaller som om ÅRET du anget inte är ett nummer"); return 0; } else if(i == 1) { alert("Det förefaller som om MÅNADEN du anget inte är ett nummer"); return 0; } else if(i == 2) { alert("Det förefaller som om DAGEN du anget inte är ett nummer"); return 0; } } } } gameHuntDate.value = birthdate; // // Check time // var birthdate = gameHuntTime.value; if(birthdate == "" || birthdate == "TT:MM") { birthdate = "00:00"; } else { var tmp = birthdate.split(":"); if(tmp.length != 2) { alert("Kontrollera tidsformatet, det ska vara TT:MM / 09:30"); return 0; } for(var i = 0; i < tmp.length; i++) { if(!isNumber(tmp[i])) { if(i == 0) { alert("Det förefaller som om TIMMEN du anget inte är ett nummer"); return 0; } else if(i == 1) { alert("Det förefaller som om MINUTERNA du anget inte är ett nummer"); return 0; } } } } gameHuntTime.value = birthdate; // // Check bullet weight to be numeric // gameAmmoKulvikt.value = gameAmmoKulvikt.value.replace(/,/, "."); if(gameAmmoKulvikt.value == "Kulvikt") { gameAmmoKulvikt.value = 0; } else if(!isNumber(gameAmmoKulvikt.value)) { alert("Kulvikten är inte numerisk, bara siffror!"); return 0; } // // Check number shoot to be numeric // gameAmmoAntal.value = gameAmmoAntal.value.replace(/,/, "."); if(gameAmmoAntal.value == "Antal skott") { gameAmmoAntal.value = 0; } else if(!isNumber(gameAmmoAntal.value)) { alert("Antalet skjutna skott är inte numerisk, bara siffror!"); return 0; } // // Check shoting distance to be numeric // gameAmmoAvstand.value = gameAmmoAvstand.value.replace(/,/, "."); if(gameAmmoAvstand.value == "Avstånd (m)") { gameAmmoAvstand.value = 0; } else if(!isNumber(gameAmmoAvstand.value)) { alert("Skjutavståndet är inte numerisk, bara siffror!"); return 0; } document.addNewGameForm.submit(); }// // Edit users game // function redigeraVilt(param) { // // Split game info into array // var tmp = param.split("<>"); var currGameInfo = tmp[0].split("<>"); var currGameGrps = tmp[1].split("<>"); // // Get content div // var cd = document.getElementById("content_div"); var currContent = ""; currContent += '
'; // // Hidden field with ID // currContent += ''; currContent += '
'; currContent += 'Precis som tidigare kan fält lämnas tomma. '; currContent += 'Ange bara numeriska värden, inte enheter som Kg eller m.'; currContent += '
'; // // Present species // currContent += ''; currContent += ''; // // Present genders // var curr_gender = Array(Array("M", "Hane"), Array("F", "Hona")); currContent += ''; currContent += ''; // // Present ages // var curr_ages = Array("Ungt djur 0-12 månader", "Ungt djur 1-2 år", "Vuxet djur +2,5 år"); currContent += ''; currContent += ''; // // Weight // var selectedStr = currGameInfo[6]; if(currGameInfo[6] == 0) { selectedStr = 'Vikt (Kg)'; } currContent += ''; currContent += ''; // // Escape distance // var selectedStr = currGameInfo[17]; if(currGameInfo[17] == "") { selectedStr = 'Flyktsträcka (m)'; } currContent += ''; currContent += ''; // // Survival Time // var selectedStr = currGameInfo[18]; if(currGameInfo[18] == "") { selectedStr = 'Levde (min)'; } currContent += ''; currContent += ''; // // Present huntingform // var curr_huntingform = Array("Jaktform", "Drevjakt med hund", "Löshundsjakt", "Vak eller lockjakt", "Smygjakt", "Grytjakt"); currContent += ''; currContent += ''; // // Present hitarea // var curr_hitarea = Array(Array("1", "Träffområdet"), Array("2","Nervsystemet"), Array("3", "Buk"), Array("4", "Övrigt")); currContent += ''; currContent += ''; // // Hitarea comment // var selectedStr = currGameInfo[20]; if(currGameInfo[20] == "") { selectedStr = 'Kommentar till träff'; } currContent += ''; currContent += ''; currContent += '
'; currContent += '-- Plats / Marken -- '; currContent += '
'; // // Areas, huntinggrounds // var curr_huntareas = Array(); for(var ppcnt = 0; ppcnt < currPlatsProfiler.length; ppcnt++) { curr_huntareas[ppcnt] = currPlatsProfiler[ppcnt].split("<>"); } currContent += ''; currContent += ''; // // Huntingarea name // currContent += ''; currContent += ''; // // Huntingarea lan // currContent += ''; currContent += ''; // // Huntingarea kommun // currContent += ''; currContent += ''; // // Huntingarea pass // currContent += ''; currContent += ''; // // Huntingarea datum // var currDate = new Date(); var currY = currDate.getFullYear(); var currM = Number(currDate.getMonth()) + Number(1); var currD = currDate.getDate(); var currHour = currDate.getHours(); var currMinute = currDate.getMinutes(); currContent += ''; currContent += ''; // // Huntingarea time // currContent += ''; currContent += ''; currContent += '
'; currContent += '-- Ammunitionen -- '; currContent += '
'; // // Weapon / Ammo // var curr_ammo = Array(); for(var ppcnt = 0; ppcnt < currAmmoProfiler.length; ppcnt++) { curr_ammo[ppcnt] = currAmmoProfiler[ppcnt].split("<>"); } currContent += ''; currContent += ''; // // Ammo name // currContent += ''; currContent += ''; // // Ammo weapon type // currContent += ''; currContent += ''; // // Ammo kaliber // currContent += ''; currContent += ''; // // Ammo kula // currContent += ''; currContent += ''; // // Ammo kulvikt // var selectedStr = currGameInfo[13]; if(currGameInfo[13] == 0) { selectedStr = 'Kulvikt'; } currContent += ''; currContent += ''; // // Ammo antal skjutna skott // var selectedStr = currGameInfo[14]; if(currGameInfo[14] == 0) { selectedStr = 'Antal skott'; } currContent += ''; currContent += ''; // // Ammo skjutavstånd // var selectedStr = currGameInfo[15]; if(currGameInfo[15] == 0) { selectedStr = 'Avstånd (m)'; } currContent += ''; currContent += ''; // // Ammo genomslag // var curr_genomslag = Array(Array("0", "Genomslag"), Array("1", "JA"), Array("2", "NEJ")); currContent += ''; currContent += ''; // // Ammo splitrats // var curr_splitras = Array(Array("0", "Splitrats"), Array("1", "JA"), Array("2", "NEJ")); currContent += ''; currContent += ''; var currTop = 520; var currLeft = 10; currContent += '
'; currContent += '-- Grupper som kan se viltet -- '; currContent += '
'; // // Groups // if(currUserGroups.length <= 0) { currContent += '
Du har inte definierat några grupper / marker! Gå in på "Grupper" i menyn för skapa nya grupper
'; } var curr_group = Array(); for(var ppcnt = 0; ppcnt < currUserGroups.length; ppcnt++) { curr_group[ppcnt] = currUserGroups[ppcnt].split("<>"); } for(var scnt = 0; scnt < curr_group.length; scnt++) { var checkedStr = ''; for(var cgcnt = 0; cgcnt < currGameGrps.length; cgcnt++) { if(currGameGrps[cgcnt] == curr_group[scnt][0]) { checkedStr = 'checked'; } } currContent += '
' + curr_group[scnt][1] + '
'; currLeft += Number(180); if(currLeft > 750) { currLeft = 10; currTop += Number(30); } } // // Comment, image, save // currTop += Number(100); currLeft = 10; currContent += '
'; currContent += '-- Bild / Kommentar / Spara -- '; currContent += '
'; // // Comment // currContent += ''; currContent += ''; // // Image // currContent += '
'; currContent += ''; currContent += ''; currContent += '
'; // // Save button // currContent += '
'; currContent += 'Uppdatera Informationen'; currContent += '
'; currTop += Number(100); currContent += '
 
'; currContent += ''; currContent += ''; currContent += ''; currContent += ''; currContent += ''; currContent += ''; // // Add to content div // cd.innerHTML = currContent; } function moveCursorToStart(param) { //alert("moveCursorToStart: id: " + param.id); if(curr_browser == "IE" || curr_browser == "CHROME") { var tmp = param.value; param.value = ""; param.focus; param.value = tmp; } else { param.setSelectionRange(0, 0); } } // // Populate hunting area fields when user selects profile // function setHuntingAreaInfo(param) { var tmp = param.item(param.selectedIndex); var mark = tmp.getAttribute("mark"); var lan = tmp.getAttribute("lan"); var kommun = tmp.getAttribute("kommun"); //alert("setHuntingAreaInfo: \n\rmark: " + mark + "\n\rlan: " + lan + "\n\rkommun: " + kommun); document.getElementById("gameHuntMark").value = mark; document.getElementById("gameHuntLan").value = lan; document.getElementById("gameHuntKommun").value = kommun; } // // Populate ammo info fields when user selects profile // function setAmmoInfo(param) { var tmp = param.item(param.selectedIndex); var namn = tmp.getAttribute("namn"); var vapen_typ = tmp.getAttribute("vapen_typ"); var kaliber = tmp.getAttribute("kaliber"); var kula = tmp.getAttribute("kula"); var kulvikt = tmp.getAttribute("kulvikt"); document.getElementById("gameAmmoNamn").value = namn; document.getElementById("gameAmmoTyp").value = vapen_typ; document.getElementById("gameAmmoKaliber").value = kaliber; document.getElementById("gameAmmoKula").value = kula; document.getElementById("gameAmmoKulvikt").value = kulvikt; } // // Send save reqguest // function sendUpdateGame() { var gameType = document.getElementById("gameType"); var gameGender = document.getElementById("gameGender"); var gameAge = document.getElementById("gameAge"); var gameWeight = document.getElementById("gameWeight"); var gameEscapeDistance = document.getElementById("gameEscapeDistance"); var gameSurviveTime = document.getElementById("gameSurviveTime"); var gameHuntType = document.getElementById("gameHuntType"); var gameHitArea = document.getElementById("gameHitArea"); var gameHAComment = document.getElementById("gameHAComment"); var gameHuntArea = document.getElementById("gameHuntArea"); var gameHuntMark = document.getElementById("gameHuntMark"); var gameHuntLan = document.getElementById("gameHuntLan"); var gameHuntKommun = document.getElementById("gameHuntKommun"); var gameHuntPass = document.getElementById("gameHuntPass"); var gameHuntDate = document.getElementById("gameHuntDate"); var gameHuntTime = document.getElementById("gameHuntTime"); var gameAmmo = document.getElementById("gameAmmo"); var gameAmmoNamn = document.getElementById("gameAmmoNamn"); var gameAmmoTyp = document.getElementById("gameAmmoTyp"); var gameAmmoKaliber = document.getElementById("gameAmmoKaliber"); var gameAmmoKula = document.getElementById("gameAmmoKula"); var gameAmmoKulvikt = document.getElementById("gameAmmoKulvikt"); var gameAmmoAntal = document.getElementById("gameAmmoAntal"); var gameAmmoAvstand = document.getElementById("gameAmmoAvstand"); var gameAmmoGenomslag = document.getElementById("gameAmmoGenomslag"); var gameAmmoSplitrats = document.getElementById("gameAmmoSplitrats"); var user_groups = document.getElementById("user_groups"); var gameComment = document.getElementById("gameComment"); // // Check weigth to be numeric // gameWeight.value = gameWeight.value.replace(/,/, "."); if(gameWeight.value == "Vikt (Kg)") { gameWeight.value = 0; } else if(!isNumber(gameWeight.value)) { alert("Vikten är inte numerisk, bara siffror!"); return 0; } // // Check escape distance to be numeric // gameEscapeDistance.value = gameEscapeDistance.value.replace(/,/, "."); if(gameEscapeDistance.value == "Flyktsträcka (m)") { gameEscapeDistance.value = 0; } else if(!isNumber(gameEscapeDistance.value)) { alert("Flyktsträckan är inte numerisk, bara siffror!"); return 0; } // // Check survive time to be numeric // gameSurviveTime.value = gameSurviveTime.value.replace(/,/, "."); if(gameSurviveTime.value == "Levde (min)") { gameSurviveTime.value = 0; } else if(!isNumber(gameSurviveTime.value)) { alert("Överlevnadstiden är inte numerisk, bara siffror!"); return 0; } // // Check date // var birthdate = gameHuntDate.value; if(birthdate == "" || birthdate == "ÅÅÅÅ-MM-DD") { birthdate = "0000-00-00"; } else { var tmp = birthdate.split("-"); if(tmp.length != 3) { alert("Kontrollera datumformatet, det ska vara ÅÅÅÅ-MM-DD / 2010-01-01"); return 0; } for(var i = 0; i < tmp.length; i++) { if(!isNumber(tmp[i])) { if(i == 0) { alert("Det förefaller som om ÅRET du anget inte är ett nummer"); return 0; } else if(i == 1) { alert("Det förefaller som om MÅNADEN du anget inte är ett nummer"); return 0; } else if(i == 2) { alert("Det förefaller som om DAGEN du anget inte är ett nummer"); return 0; } } } } gameHuntDate.value = birthdate; // // Check time // var birthdate = gameHuntTime.value; if(birthdate == "" || birthdate == "TT:MM") { birthdate = "00:00"; } else { var tmp = birthdate.split(":"); if(tmp.length != 2) { alert("Kontrollera tidsformatet, det ska vara TT:MM / 09:30"); return 0; } for(var i = 0; i < tmp.length; i++) { if(!isNumber(tmp[i])) { if(i == 0) { alert("Det förefaller som om TIMMEN du anget inte är ett nummer"); return 0; } else if(i == 1) { alert("Det förefaller som om MINUTERNA du anget inte är ett nummer"); return 0; } } } } gameHuntTime.value = birthdate; // // Check bullet weight to be numeric // gameAmmoKulvikt.value = gameAmmoKulvikt.value.replace(/,/, "."); if(gameAmmoKulvikt.value == "Kulvikt") { gameAmmoKulvikt.value = 0; } else if(!isNumber(gameAmmoKulvikt.value)) { alert("Kulvikten är inte numerisk, bara siffror!"); return 0; } // // Check number shoot to be numeric // gameAmmoAntal.value = gameAmmoAntal.value.replace(/,/, "."); if(gameAmmoAntal.value == "Antal skott") { gameAmmoAntal.value = 0; } else if(!isNumber(gameAmmoAntal.value)) { alert("Antalet skjutna skott är inte numerisk, bara siffror!"); return 0; } // // Check shoting distance to be numeric // gameAmmoAvstand.value = gameAmmoAvstand.value.replace(/,/, "."); if(gameAmmoAvstand.value == "Avstånd (m)") { gameAmmoAvstand.value = 0; } else if(!isNumber(gameAmmoAvstand.value)) { alert("Skjutavståndet är inte numerisk, bara siffror!"); return 0; } document.updateGameForm.submit(); }// // Function to render all info on selected game // function renderThisGame(param) { // // Get game info into array, split param // var tmp = param.split("<>"); var currGameInfo = tmp[0].split("<>"); // // White background image // var currItem = document.createElement("div"); currItem.id = "renderGameInfoDiv"; currItem.style.position = "absolute"; currItem.style.top = "30px"; currItem.style.left = "20px"; currItem.style.width = "800px"; currItem.style.height = "600px"; currItem.style.zIndex = "200"; if(curr_browser == "IE") { currItem.style.filter = 'alpha(opacity = 95)'; } else { currItem.style.opacity = 0.95; } currItem.innerHTML = ''; document.body.appendChild(currItem); // // Game info // // // Game type // var currItem_1 = document.createElement("div"); currItem_1.id = "gameTypeDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "20px"; currItem_1.style.left = "20px"; currItem_1.style.width = "100px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.innerHTML = currGameInfo[3]; currItem.appendChild(currItem_1); // // Game Gender // var currItem_1 = document.createElement("div"); currItem_1.id = "gameGenderDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "40px"; currItem_1.style.left = "20px"; currItem_1.style.width = "100px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; var currStr = "Hane"; if(currGameInfo[4] == "F") { currStr = "Hona"; } currItem_1.innerHTML = currStr; currItem.appendChild(currItem_1); // // Game Age // var currItem_1 = document.createElement("div"); currItem_1.id = "gameGenderDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "60px"; currItem_1.style.left = "20px"; currItem_1.style.width = "200px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; var currStr = "Ungt djur 0-12 månader"; if(currGameInfo[5] == "1") { currStr = "Ungt djur 1-2 år"; } else if(currGameInfo[5] >= "2") { currStr = "Vuxet djur +2,5 år"; } currItem_1.innerHTML = currStr; currItem.appendChild(currItem_1); // // Game weight // var currItem_1 = document.createElement("div"); currItem_1.id = "gameTypeDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "80px"; currItem_1.style.left = "20px"; currItem_1.style.width = "100px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.innerHTML = currGameInfo[6] + "Kg"; currItem.appendChild(currItem_1); // // Place info // // // Location name // var currItem_1 = document.createElement("div"); currItem_1.id = "locationNameDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "20px"; currItem_1.style.left = "300px"; currItem_1.style.width = "100px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.innerHTML = currGameInfo[7]; currItem.appendChild(currItem_1); // // Location pass // var currItem_1 = document.createElement("div"); currItem_1.id = "locationPassDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "40px"; currItem_1.style.left = "300px"; currItem_1.style.width = "100px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.innerHTML = currGameInfo[8]; currItem.appendChild(currItem_1); // // Location date // var currItem_1 = document.createElement("div"); currItem_1.id = "locationDateDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "60px"; currItem_1.style.left = "300px"; currItem_1.style.width = "200px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.innerHTML = currGameInfo[1]; currItem.appendChild(currItem_1); // // Location time // var currItem_1 = document.createElement("div"); currItem_1.id = "locationTimeDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "80px"; currItem_1.style.left = "300px"; currItem_1.style.width = "100px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.innerHTML = currGameInfo[9]; currItem.appendChild(currItem_1); // // Weapon info // // // Ammo name // var currItem_1 = document.createElement("div"); currItem_1.id = "ammoNameDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "20px"; currItem_1.style.left = "500px"; currItem_1.style.width = "200px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.innerHTML = currGameInfo[11]; currItem.appendChild(currItem_1); // // Ammo caliber // var currItem_1 = document.createElement("div"); currItem_1.id = "ammoCaliberDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "40px"; currItem_1.style.left = "500px"; currItem_1.style.width = "200px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.innerHTML = currGameInfo[10]; currItem.appendChild(currItem_1); // // Distance // var currItem_1 = document.createElement("div"); currItem_1.id = "distanceDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "60px"; currItem_1.style.left = "500px"; currItem_1.style.width = "200px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.innerHTML = currGameInfo[15] + " m (Skjutavs)"; currItem.appendChild(currItem_1); // // Number shots // var currItem_1 = document.createElement("div"); currItem_1.id = "numberShotsDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "80px"; currItem_1.style.left = "500px"; currItem_1.style.width = "200px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.innerHTML = currGameInfo[17] + " m (Flyktstr)"; currItem.appendChild(currItem_1); // // Comment // // // User comment // var currItem_1 = document.createElement("div"); currItem_1.id = "numberShotsDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "115px"; currItem_1.style.left = "20px"; currItem_1.style.width = "750px"; currItem_1.style.height = "80px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "normal"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.style.border = "0px solid orange"; currItem_1.innerHTML = currGameInfo[24]; currItem.appendChild(currItem_1); // // Image // if(currGameInfo[23] != "") { var currImg = document.createElement("img"); currImg.id = "gameImageDiv"; currImg.style.position = "absolute"; currImg.style.top = "230px"; currImg.style.left = "20px"; currImg.style.cursor = "pointer"; currImg.onclick = function() { window.open('http://www.jaktstatistik.se/Images/userImages/' + currGameInfo[23], "_blank"); }; currImg.src = 'http://www.jaktstatistik.se/Images/userImages/' + currGameInfo[23]; currItem.appendChild(currImg); // // Fix image proportions // var currImage = document.getElementById("gameImageDiv"); var currImageRatio = currImage.width / currImage.height; if(currImageRatio <= 1) { var currH = 300; var currW = ((currImage.width * currImageRatio) * (300 / currImage.height)); } else { var currW = 760; var currH = ((currImage.height / currImageRatio) * (760 / currImage.width)); } currImg.width = currW; currImg.height = currH; } else { var currImg = document.createElement("div"); currImg.id = "gameImageDiv"; currImg.style.position = "absolute"; currImg.style.top = "300px"; currImg.style.left = "200px"; currImg.style.width = "400px"; currImg.style.height = "20px"; currImg.style.zIndex = "2"; currImg.style.fontFamily = "Century Gothic"; currImg.style.fontSize = "22"; currImg.style.fontWeight = "bold"; currImg.style.color = "#698E2B"; currImg.style.textAlign = "left"; currImg.innerHTML = "Ingen bild sparad för detta vilt"; currItem.appendChild(currImg); } // // Exit/Abort button text // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; if(curr_browser == "IE") { currItem_1.style.top = "568px"; } else { currItem_1.style.top = "563px"; } currItem_1.style.left = "50"; currItem_1.style.width = "700"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "center"; currItem_1.onclick = function() { document.body.removeChild(currItem); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Stäng'; currItem.appendChild(currItem_1); }// // Render popup asking user what they wish to do with current game // function requestActionGame(param) { var curr_cd = document.getElementById("content_div"); //curr_cd.innerHTML = ""; // // White background image // var currTop = param.style.top.substring(0, param.style.top.indexOf("px")); var currItem = document.createElement("div"); currItem.id = "editWishDiv"; currItem.style.position = "absolute"; //currItem.style.top = "80"; currItem.style.top = (Number(currTop) - Number(40)) + "px"; currItem.style.left = "20px"; currItem.style.width = "800px"; currItem.style.height = "90px"; currItem.style.zIndex = "200"; if(curr_browser == "IE") { currItem.style.filter = 'alpha(opacity = 90)'; } else { currItem.style.opacity = 0.90; } currItem.innerHTML = ''; curr_cd.appendChild(currItem); // // Show all info button // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; currItem_1.style.top = "30"; currItem_1.style.left = "50"; currItem_1.style.width = "100"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "left"; currItem_1.onclick = function() { sendHttpPostRequest('./PhpFunctions/renderThisGame.php', "currID=" + param.getAttribute("currID")); curr_cd.removeChild(currItem); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Visa Allt'; currItem.appendChild(currItem_1); // // Edit info button // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; currItem_1.style.top = "30"; currItem_1.style.left = "250"; currItem_1.style.width = "100"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "left"; currItem_1.onclick = function() { sendHttpPostRequest('./PhpFunctions/editGame.php', "currID=" + param.getAttribute("currID")); curr_cd.removeChild(currItem); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Redigera'; currItem.appendChild(currItem_1); // // Remove info button // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; currItem_1.style.top = "30"; currItem_1.style.left = "450"; currItem_1.style.width = "100"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "left"; currItem_1.onclick = function() { sendHttpPostRequest('./PhpFunctions/raderaVilt.php', "currID=" + param.getAttribute("currID")); curr_cd.removeChild(currItem);}; currItem_1.innerHTML = 'Radera'; currItem.appendChild(currItem_1); // // Exit/Abort button text // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; currItem_1.style.top = "30"; currItem_1.style.left = "650"; currItem_1.style.width = "100"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "left"; currItem_1.onclick = function() { curr_cd.removeChild(currItem); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Avbryt'; currItem.appendChild(currItem_1); }// // Gather user info and send to saveNewAccount.php // function saveNewAccountSubmit() { var currEmail = document.getElementById("user_email"); var pwd1 = document.getElementById("user_pwd_1"); var pwd2 = document.getElementById("user_pwd_2"); if(currEmail.value == "" || currEmail.value == " ") { alert("Kontrollera email adressen!"); return 0; } if(pwd1.value == "" || pwd1.value == " " || pwd1.value != pwd2.value) { alert("Kontrollera Lösenorden!"); return 0; } sendHttpPostRequest('PhpFunctions/saveNewAccount.php', 'user_email=' + currEmail.value + '&user_pwd_1=' + md5(pwd1.value)); } function setUpPWD_1(param) { param.parentNode.removeChild(param); var tmp = document.getElementById("user_pwd_1"); tmp.focus(); } function setUpPWD_2(param) { param.parentNode.removeChild(param); var tmp = document.getElementById("user_pwd_2"); tmp.focus(); }// // User wants to change their info // function handleUsersAccount(param) { // // Split param into user info // var currUser = param.split("<>"); // // White background image // var currItem = document.createElement("div"); currItem.id = "editUserInfoDiv"; currItem.style.position = "absolute"; currItem.style.top = "30px"; currItem.style.left = "100px"; currItem.style.width = "500px"; currItem.style.height = "450px"; currItem.style.zIndex = "200"; if(curr_browser == "IE") { currItem.style.filter = 'alpha(opacity = 95)'; } else { currItem.style.opacity = 0.95; } currItem.innerHTML = ''; document.body.appendChild(currItem); // // Username Image // var currItem_1 = document.createElement("img"); currItem_1.id = "userNameImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "20px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Username // var currStr = currUser[1]; if(currStr == "") { currStr = "Användarnamn"; } var currItem_1 = document.createElement("input"); currItem_1.id = "userName"; currItem_1.name = "userName"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "40px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = currStr; currItem_1.onkeydown = function() { emptyMe(this); }; currItem.appendChild(currItem_1); // // Inform user about changing password // var currItem_1 = document.createElement("div"); currItem_1.id = "editPasswordInfoDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "90px"; currItem_1.style.left = "40px"; currItem_1.style.width = "400px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "15px"; currItem_1.style.color = "#698E2B"; currItem_1.innerHTML = 'Fyll i lösenord för att ändra, annars lämna tomt!'; currItem.appendChild(currItem_1); // // User password 1 Image // var currItem_1 = document.createElement("img"); currItem_1.id = "userPwd1Img"; currItem_1.style.position = "absolute"; currItem_1.style.top = "100px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // User password 1 // var currItem_1 = document.createElement("input"); currItem_1.id = "user_password_1"; currItem_1.name = "user_password_1"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "120px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = 'Lösenord'; currItem_1.onkeydown = function() { emptyMe(this); }; currItem.appendChild(currItem_1); // // User password 2 Image // var currItem_1 = document.createElement("img"); currItem_1.id = "userPwd2Img"; currItem_1.style.position = "absolute"; currItem_1.style.top = "140px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // User password 2 // var currItem_1 = document.createElement("input"); currItem_1.id = "user_password_2"; currItem_1.name = "user_password_2"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "160px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = 'Upprepa Lösenord'; currItem_1.onkeydown = function() { emptyMe(this); }; currItem.appendChild(currItem_1); // // Email Image // var currItem_1 = document.createElement("img"); currItem_1.id = "userEmailImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "200px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Email // var currStr = currUser[13]; if(currStr == "") { currStr = "Email"; } var currItem_1 = document.createElement("input"); currItem_1.id = "userEmail"; currItem_1.name = "userEmail"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "220px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = currStr; currItem_1.onkeydown = function() { emptyMe(this); }; currItem.appendChild(currItem_1); // // Firstname Image // var currItem_1 = document.createElement("img"); currItem_1.id = "userFirstNameImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "240px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Firstname // var currStr = currUser[3]; if(currStr == "") { currStr = "Förnamn"; } var currItem_1 = document.createElement("input"); currItem_1.id = "userFirstName"; currItem_1.name = "userFirstName"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "260px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = currStr; currItem_1.onkeydown = function() { emptyMe(this); }; currItem.appendChild(currItem_1); // // Lastname Image // var currItem_1 = document.createElement("img"); currItem_1.id = "userlastNameImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "280px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Lastname // var currStr = currUser[4]; if(currStr == "") { currStr = "Efternamn"; } var currItem_1 = document.createElement("input"); currItem_1.id = "userLastName"; currItem_1.name = "userLastName"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "300px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = currStr; currItem_1.onkeydown = function() { emptyMe(this); }; currItem.appendChild(currItem_1); // // Birthdate Image // var currItem_1 = document.createElement("img"); currItem_1.id = "userBirthdateImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "320px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Birthdate // var currStr = currUser[5]; if(currStr == "") { currStr = "Födelsedatum (ÅÅÅÅ-MM-DD)"; } var currItem_1 = document.createElement("input"); currItem_1.id = "userBirthdate"; currItem_1.name = "userBirthdate"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "340px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = currStr; currItem_1.onkeydown = function() { emptyMe(this); }; currItem.appendChild(currItem_1); // // Save button text // var currItem_1 = document.createElement("div"); currItem_1.id = "saveButtonText"; currItem_1.style.position = "absolute"; if(curr_browser == "IE") { currItem_1.style.top = "408px"; } else { currItem_1.style.top = "403px"; } currItem_1.style.left = "50"; currItem_1.style.width = "200"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "center"; currItem_1.onclick = function() { sendSaveUpdatedAccountInfo(); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Spara'; currItem.appendChild(currItem_1); // // Exit/Abort button text // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; if(curr_browser == "IE") { currItem_1.style.top = "408px"; } else { currItem_1.style.top = "403px"; } currItem_1.style.left = "200"; currItem_1.style.width = "200"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "center"; currItem_1.onclick = function() { document.body.removeChild(currItem); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Avbryt'; currItem.appendChild(currItem_1); } // // Gather, check and send update info // function sendSaveUpdatedAccountInfo() { var currUsername = document.getElementById("userName"); var currPwd1 = document.getElementById("user_password_1"); var currPwd2 = document.getElementById("user_password_2"); var email = document.getElementById("userEmail"); var fname = document.getElementById("userFirstName"); var ename = document.getElementById("userLastName"); var bdate = document.getElementById("userBirthdate"); if(currPwd1.value != currPwd2.value && currPwd1.value != "Lösenord") { alert("Kontrollera lösenorden!"); return 0; } if(currPwd1.value == "" || currPwd1.value == " ") { alert("Kontrollera lösenorden!"); return 0; } if(currPwd1.value == currPwd2.value) { currPwd1.value = md5(currPwd1.value); } var birthdate = bdate.value; if(birthdate == "" || birthdate == "ÅÅÅÅ-MM-DD") { birthdate = "0000-00-00"; } else { var tmp = birthdate.split("-"); if(tmp.length != 3) { alert("Kontrollera datumformatet, det ska vara ÅÅÅÅ-MM-DD / 2010-01-01"); return 0; } for(var i = 0; i < tmp.length; i++) { if(!isNumber(tmp[i])) { if(i == 0) { alert("Det förefaller som om ÅRET du anget inte är ett nummer"); return 0; } else if(i == 1) { alert("Det förefaller som om MÅNADEN du anget inte är ett nummer"); return 0; } else if(i == 2) { alert("Det förefaller som om DAGEN du anget inte är ett nummer"); return 0; } } } } sendHttpPostRequest('PhpFunctions/updateUsersAccount.php', 'currUsername=' + currUsername.value + '&currUserpwd=' + currPwd1.value + '&currEmail=' + email.value + '&currFirstname=' + fname.value + '&currLastname=' + ename.value + '&currBirthdate=' + birthdate); } // // Render users diary entry // function renderThisDiaryEntry(param) { var currDiaryEntry = param.split("<>"); // // White background image // var currItem = document.createElement("div"); currItem.id = "renderDiaryInfoDiv"; currItem.style.position = "absolute"; currItem.style.top = "30px"; currItem.style.left = "20px"; currItem.style.width = "800px"; currItem.style.height = "300px"; currItem.style.zIndex = "200"; if(curr_browser == "IE") { currItem.style.filter = 'alpha(opacity = 95)'; } else { currItem.style.opacity = 0.95; } currItem.innerHTML = ''; document.body.appendChild(currItem); // // Diary Entry PLACE // var currItem_1 = document.createElement("div"); currItem_1.id = "diaryEntryPlaceDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "20px"; currItem_1.style.left = "20px"; currItem_1.style.width = "150px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.innerHTML = currDiaryEntry[4]; currItem.appendChild(currItem_1); // // Diary Entry DATE // var currItem_1 = document.createElement("div"); currItem_1.id = "diaryEntryDateDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "40px"; currItem_1.style.left = "20px"; currItem_1.style.width = "100px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.innerHTML = currDiaryEntry[2]; currItem.appendChild(currItem_1); // // Diary Entry TEMPERATURE // var currItem_1 = document.createElement("div"); currItem_1.id = "diaryEntryTemperatureDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "60px"; currItem_1.style.left = "20px"; currItem_1.style.width = "200px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.innerHTML = currDiaryEntry[10] + " (C)"; currItem.appendChild(currItem_1); // // Diary Entry SUN_MOON // var currItem_1 = document.createElement("div"); currItem_1.id = "diaryEntrySunMoonDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "20px"; currItem_1.style.left = "200px"; currItem_1.style.width = "400px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.innerHTML = currDiaryEntry[6]; currItem.appendChild(currItem_1); // // Diary Entry PERCIPITATION // var currItem_1 = document.createElement("div"); currItem_1.id = "diaryEntryPercipitationDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "40px"; currItem_1.style.left = "200px"; currItem_1.style.width = "200px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.innerHTML = currDiaryEntry[8]; currItem.appendChild(currItem_1); // // Diary Entry PRECIPITATION AMOUNT // var currItem_1 = document.createElement("div"); currItem_1.id = "diaryEntryTemperatureDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "60px"; currItem_1.style.left = "200px"; currItem_1.style.width = "200px"; currItem_1.style.height = "20px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.innerHTML = currDiaryEntry[9] + " (mm)"; currItem.appendChild(currItem_1); // // Diary Entry COMMENT // var currItem_1 = document.createElement("div"); currItem_1.id = "diaryEntryTemperatureDiv"; currItem_1.style.position = "absolute"; currItem_1.style.top = "100px"; currItem_1.style.left = "20px"; currItem_1.style.width = "700px"; currItem_1.style.height = "50px"; currItem_1.style.zIndex = "2"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "16"; currItem_1.style.fontWeight = "normal"; currItem_1.style.color = "#698E2B"; currItem_1.style.textAlign = "left"; currItem_1.innerHTML = currDiaryEntry[3]; currItem.appendChild(currItem_1); // // Exit/Abort button text // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; if(curr_browser == "IE") { currItem_1.style.top = "268px"; } else { currItem_1.style.top = "263px"; } currItem_1.style.left = "50"; currItem_1.style.width = "700"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "center"; currItem_1.onclick = function() { document.body.removeChild(currItem); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Stäng'; currItem.appendChild(currItem_1); }// // User wants to add diary entry // function addNewDiaryEntry() { var currContent = ""; // // Information to user // currContent += '
'; currContent += 'Fält kan lämnas tomma. Vill ni ändra eller lägga till går det bra att göra det vid ett senare tillfälle, klicka på posten och välja redigera. '; currContent += 'Ange bara numeriska värden, inte enheter som Kg eller m.'; currContent += '
'; // // Areas, huntinggrounds // var curr_huntareas = Array(); for(var ppcnt = 0; ppcnt < currPlatsProfiler.length; ppcnt++) { curr_huntareas[ppcnt] = currPlatsProfiler[ppcnt].split("<>"); } currContent += ''; currContent += ''; // // Place name // currContent += ''; currContent += ''; // // Huntingarea datum // var currDate = new Date(); var currY = currDate.getFullYear(); var currM = Number(currDate.getMonth()) + Number(1); var currD = currDate.getDate(); var currHour = currDate.getHours(); var currMinute = currDate.getMinutes(); currContent += ''; currContent += ''; // // Temperature // currContent += ''; currContent += ''; // // Present sunny options // var curr_sun = Array("Soligt utan moln", "Övervägande soligt höga tunna moln", "Tidvis soligt låga tunga moln", "Molnigt", "Måne utan moln", "Måne med moln"); currContent += ''; currContent += ''; // // Present precipitation options // var curr_precipitation = Array("Uppehåll", "Tidvis/Lättare regn", "Ihållande/Tyngre regn", "Tidvis/Lättare snö", "Ihållande/Tyngre snö"); currContent += ''; currContent += ''; // // Percipitation amount // currContent += ''; currContent += ''; // // Comment // currContent += ''; currContent += ''; // // Save button // currContent += '
'; currContent += 'Spara'; currContent += '
'; // // Exit/Cancel button // currContent += '
'; currContent += 'Avbryt'; currContent += '
'; document.getElementById("content_div").innerHTML = currContent; } // // Populate hunting area fields when user selects profile // function setHuntingAreaInfo(param) { var tmp = param.item(param.selectedIndex); var mark = tmp.getAttribute("mark"); var lan = tmp.getAttribute("lan"); var kommun = tmp.getAttribute("kommun"); //alert("setHuntingAreaInfo: \n\rmark: " + mark + "\n\rlan: " + lan + "\n\rkommun: " + kommun); document.getElementById("gameHuntMark").value = mark; document.getElementById("gameHuntLan").value = lan; document.getElementById("gameHuntKommun").value = kommun; } // // Collect diary data and send to php function // function sendSaveDiaryEntry() { var plats = document.getElementById("gameHuntMark"); var date = document.getElementById("gameHuntDate"); var sun = document.getElementById("diaryEntrySun"); var nederbord = document.getElementById("diaryEntryPercipitation"); var nederbordmangd = document.getElementById("diaryEntryPercipitationAmount"); var temperature = document.getElementById("diaryEntryTemperature"); var comment = document.getElementById("diaryEntryComment"); // // Send request to saveNewDiaryEntry.php // sendHttpPostRequest('./PhpFunctions/saveNewDiaryEntry.php', 'currPlace=' + plats.value + '&currDate=' + date.value + '&currSun=' + sun.value + '&currRain=' + nederbord.value + '&currRainAmount=' + nederbordmangd.value + '&currTemperature=' + temperature.value + '&currComment=' + comment.value) }// // Render popup asking user what they wish to do with current game // function requestActionDiaryEntry(param) { var curr_cd = document.getElementById("content_div"); //curr_cd.innerHTML = ""; // // White background image // var currTop = param.style.top.substring(0, param.style.top.indexOf("px")); var currItem = document.createElement("div"); currItem.id = "editWishDiv"; currItem.style.position = "absolute"; //currItem.style.top = "80"; currItem.style.top = (Number(currTop) - Number(40)) + "px"; currItem.style.left = "20px"; currItem.style.width = "800px"; currItem.style.height = "90px"; currItem.style.zIndex = "200"; if(curr_browser == "IE") { currItem.style.filter = 'alpha(opacity = 90)'; } else { currItem.style.opacity = 0.90; } currItem.innerHTML = ''; curr_cd.appendChild(currItem); // // Show all info button // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; currItem_1.style.top = "30"; currItem_1.style.left = "50"; currItem_1.style.width = "100"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "left"; currItem_1.onclick = function() { sendHttpPostRequest('./PhpFunctions/renderThisDiaryEntry.php', "currID=" + param.id); curr_cd.removeChild(currItem); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Visa Allt'; currItem.appendChild(currItem_1); // // Edit info button // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; currItem_1.style.top = "30"; currItem_1.style.left = "250"; currItem_1.style.width = "100"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "left"; currItem_1.onclick = function() { sendHttpPostRequest('./PhpFunctions/editDiaryEntry.php', "currID=" + param.id); curr_cd.removeChild(currItem); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Redigera'; currItem.appendChild(currItem_1); // // Remove info button // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; currItem_1.style.top = "30"; currItem_1.style.left = "450"; currItem_1.style.width = "100"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "left"; currItem_1.onclick = function() { sendHttpPostRequest('./PhpFunctions/raderaDiaryEntry.php', "currID=" + param.id); curr_cd.removeChild(currItem);}; currItem_1.innerHTML = 'Radera'; currItem.appendChild(currItem_1); // // Exit/Abort button text // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; currItem_1.style.top = "30"; currItem_1.style.left = "650"; currItem_1.style.width = "100"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "left"; currItem_1.onclick = function() { curr_cd.removeChild(currItem); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Avbryt'; currItem.appendChild(currItem_1); }// // User wants to add diary entry // function editDiaryEntry(param) { // // Split param into diary entry details // var currDiaryEntry = param.split("<>"); var currContent = ""; // // Information to user // currContent += '
'; currContent += 'Fält kan lämnas tomma. Vill ni ändra eller lägga till går det bra att göra det vid ett senare tillfälle, klicka på posten och välja redigera. '; currContent += 'Ange bara numeriska värden, inte enheter som Kg eller m.'; currContent += '
'; // // Areas, huntinggrounds // var curr_huntareas = Array(); for(var ppcnt = 0; ppcnt < currPlatsProfiler.length; ppcnt++) { curr_huntareas[ppcnt] = currPlatsProfiler[ppcnt].split("<>"); } currContent += ''; currContent += ''; // // Place name // currContent += ''; currContent += ''; // // Huntingarea datum // var currDate = new Date(); var currY = currDate.getFullYear(); var currM = Number(currDate.getMonth()) + Number(1); var currD = currDate.getDate(); var currHour = currDate.getHours(); var currMinute = currDate.getMinutes(); currContent += ''; currContent += ''; // // Temperature // currContent += ''; currContent += ''; // // Present sunny options // var curr_sun = Array("Soligt utan moln", "Övervägande soligt höga tunna moln", "Tidvis soligt låga tunga moln", "Molnigt", "Måne utan moln", "Måne med moln"); currContent += ''; currContent += ''; // // Present precipitation options // var curr_precipitation = Array("Uppehåll", "Tidvis/Lättare regn", "Ihållande/Tyngre regn", "Tidvis/Lättare snö", "Ihållande/Tyngre snö"); currContent += ''; currContent += ''; // // Temperature // currContent += ''; currContent += ''; // // Comment // currContent += ''; currContent += ''; // // Save button // currContent += '
'; currContent += 'Uppdatera'; currContent += '
'; // // Exit/Cancel button // currContent += '
'; currContent += 'Avbryt'; currContent += '
'; document.getElementById("content_div").innerHTML = currContent; } // // Populate hunting area fields when user selects profile // function setHuntingAreaInfo(param) { var tmp = param.item(param.selectedIndex); var mark = tmp.getAttribute("mark"); var lan = tmp.getAttribute("lan"); var kommun = tmp.getAttribute("kommun"); //alert("setHuntingAreaInfo: \n\rmark: " + mark + "\n\rlan: " + lan + "\n\rkommun: " + kommun); document.getElementById("gameHuntMark").value = mark; document.getElementById("gameHuntLan").value = lan; document.getElementById("gameHuntKommun").value = kommun; } // // Collect diary data and send to php function // function sendUpdateDiaryEntry(param) { var plats = document.getElementById("gameHuntMark"); var date = document.getElementById("gameHuntDate"); var sun = document.getElementById("diaryEntrySun"); var nederbord = document.getElementById("diaryEntryPrecipitation"); var nederbordmangd = document.getElementById("diaryEntryPrecipitationAmount"); var temperature = document.getElementById("diaryEntryTemperature"); var comment = document.getElementById("diaryEntryComment"); // // Send request to saveNewDiaryEntry.php // sendHttpPostRequest('./PhpFunctions/updateDiaryEntry.php', 'currID=' + param + '&currPlace=' + plats.value + '&currDate=' + date.value + '&currSun=' + sun.value + '&currRain=' + nederbord.value + '&currRainAmount=' + nederbordmangd.value + '&currTemperature=' + temperature.value + '&currComment=' + comment.value) }// // Render popup asking user what they wish to do with current game // function requestActionPlaceProfile(param) { var curr_cd = document.getElementById("content_div"); //curr_cd.innerHTML = ""; // // White background image // var currTop = param.style.top.substring(0, param.style.top.indexOf("px")); var currItem = document.createElement("div"); currItem.id = "editWishDiv"; currItem.style.position = "absolute"; //currItem.style.top = "80"; currItem.style.top = (Number(currTop) - Number(40)) + "px"; currItem.style.left = "20px"; currItem.style.width = "550px"; currItem.style.height = "90px"; currItem.style.zIndex = "200"; if(curr_browser == "IE") { currItem.style.filter = 'alpha(opacity = 95)'; } else { currItem.style.opacity = 0.95; } currItem.innerHTML = ''; curr_cd.appendChild(currItem); // // Edit info button // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; currItem_1.style.top = "30"; currItem_1.style.left = "50"; currItem_1.style.width = "100"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "left"; currItem_1.onclick = function() { editPlaceProfile(param); curr_cd.removeChild(currItem); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Redigera'; currItem.appendChild(currItem_1); // // Remove info button // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; currItem_1.style.top = "30"; currItem_1.style.left = "250"; currItem_1.style.width = "100"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "left"; currItem_1.onclick = function() { sendHttpPostRequest('./PhpFunctions/raderaPlaceProfile.php', "currID=" + param.id); curr_cd.removeChild(currItem);}; currItem_1.innerHTML = 'Radera'; currItem.appendChild(currItem_1); // // Exit/Abort button text // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; currItem_1.style.top = "30"; currItem_1.style.left = "450"; currItem_1.style.width = "100"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "left"; currItem_1.onclick = function() { curr_cd.removeChild(currItem); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Avbryt'; currItem.appendChild(currItem_1); }// // User wants to change their info // function editPlaceProfile(param) { // // White background image // var currItem = document.createElement("div"); currItem.id = "editPlaceProfileDiv"; currItem.style.position = "absolute"; currItem.style.top = "30px"; currItem.style.left = "100px"; currItem.style.width = "500px"; currItem.style.height = "200px"; currItem.style.zIndex = "200"; if(curr_browser == "IE") { currItem.style.filter = 'alpha(opacity = 95)'; } else { currItem.style.opacity = 0.95; } currItem.innerHTML = ''; document.body.appendChild(currItem); // // Placename Image // var currItem_1 = document.createElement("img"); currItem_1.id = "placeNameImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "20px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Placename // var currStr = param.getAttribute("mark"); if(currStr == "") { currStr = "Mark"; } var currItem_1 = document.createElement("input"); currItem_1.id = "placeName"; currItem_1.name = "placeName"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "40px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = currStr; currItem_1.onkeydown = function() { emptyMe(this); }; currItem.appendChild(currItem_1); // // Lan Image // var currItem_1 = document.createElement("img"); currItem_1.id = "lanNameImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "60px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Lan // var currItem_s1 = document.createElement("select"); currItem_s1.id = "lanName"; currItem_s1.name = "lanName"; currItem_s1.className = "rounded_input"; currItem_s1.style.position = "absolute"; currItem_s1.style.top = "80px"; currItem_s1.style.left = "70px"; currItem_s1.style.width = "350px"; currItem_s1.style.height = "30px"; currItem_s1.style.fontFamily = "century gothic"; currItem_s1.style.fontSize = "18px"; currItem_s1.style.color = "#999999"; currItem.appendChild(currItem_s1); // // Loop all LAN and render them as options // for(var lcnt = 0; lcnt < curr_lans.length; lcnt++) { var currItem_o1 = document.createElement("option"); currItem_o1.id = "lan_" + curr_lans[lcnt]; currItem_o1.name = "lan_" + curr_lans[lcnt]; currItem_o1.className = "rounded_input"; currItem_o1.text = curr_lans[lcnt]; currItem_o1.value = curr_lans[lcnt]; // // Selected or not // if(curr_lans[lcnt] == param.getAttribute("lan")) { currItem_o1.selected = "true"; } currItem_s1.add(currItem_o1); } // // Kommun Image // var currItem_1 = document.createElement("img"); currItem_1.id = "kommunNameImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "100px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Kommun // var currItem_s1 = document.createElement("select"); currItem_s1.id = "kommunName"; currItem_s1.name = "kommunName"; currItem_s1.className = "rounded_input"; currItem_s1.style.position = "absolute"; currItem_s1.style.top = "120px"; currItem_s1.style.left = "70px"; currItem_s1.style.width = "350px"; currItem_s1.style.height = "30px"; currItem_s1.style.fontFamily = "century gothic"; currItem_s1.style.fontSize = "18px"; currItem_s1.style.color = "#999999"; currItem.appendChild(currItem_s1); // // Loop all Kommun and render them as options // for(var lcnt = 0; lcnt < curr_kommuner.length; lcnt++) { var currItem_o1 = document.createElement("option"); currItem_o1.id = "lan_" + curr_kommuner[lcnt]; currItem_o1.name = "lan_" + curr_kommuner[lcnt]; currItem_o1.className = "rounded_input"; currItem_o1.text = curr_kommuner[lcnt]; currItem_o1.value = curr_kommuner[lcnt]; // // Selected or not // if(curr_kommuner[lcnt] == param.getAttribute("kommun")) { currItem_o1.selected = "true"; } currItem_s1.add(currItem_o1); } // // Save button text // var currItem_1 = document.createElement("div"); currItem_1.id = "saveButtonText"; currItem_1.style.position = "absolute"; if(curr_browser == "IE") { currItem_1.style.top = "168px"; } else { currItem_1.style.top = "163px"; } currItem_1.style.left = "50"; currItem_1.style.width = "200"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "center"; currItem_1.onclick = function() { sendSaveUpdatedPlaceInfo(param); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Uppdatera'; currItem.appendChild(currItem_1); // // Exit/Abort button text // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; if(curr_browser == "IE") { currItem_1.style.top = "168px"; } else { currItem_1.style.top = "163px"; } currItem_1.style.left = "200"; currItem_1.style.width = "200"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "center"; currItem_1.onclick = function() { document.body.removeChild(currItem); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Avbryt'; currItem.appendChild(currItem_1); } // // Gather, check and send update info // function sendSaveUpdatedPlaceInfo(param) { var currMark = document.getElementById("placeName"); var currLan = document.getElementById("lanName"); var currKommun = document.getElementById("kommunName"); // // Remove popup window // document.body.removeChild(document.getElementById("editPlaceProfileDiv")); sendHttpPostRequest('PhpFunctions/updatePlaceInfo.php', 'currID=' + param.id + '&currMark=' + currMark.value + '&currLan=' + currLan.value + '&currKommun=' + currKommun.value); } // // User wants to change their info // function addNewPlaceProfile() { // // White background image // var currItem = document.createElement("div"); currItem.id = "newPlaceProfileDiv"; currItem.style.position = "absolute"; currItem.style.top = "30px"; currItem.style.left = "100px"; currItem.style.width = "500px"; currItem.style.height = "200px"; currItem.style.zIndex = "200"; if(curr_browser == "IE") { currItem.style.filter = 'alpha(opacity = 95)'; } else { currItem.style.opacity = 0.95; } currItem.innerHTML = ''; document.body.appendChild(currItem); // // Placename Image // var currItem_1 = document.createElement("img"); currItem_1.id = "placeNameImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "20px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Placename // var currItem_1 = document.createElement("input"); currItem_1.id = "placeName"; currItem_1.name = "placeName"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "40px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = "Mark"; currItem_1.onkeydown = function() { emptyMe(this); }; currItem.appendChild(currItem_1); // // Lan Image // var currItem_1 = document.createElement("img"); currItem_1.id = "lanNameImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "60px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Lan // var currItem_s1 = document.createElement("select"); currItem_s1.id = "lanName"; currItem_s1.name = "lanName"; currItem_s1.className = "rounded_input"; currItem_s1.style.position = "absolute"; currItem_s1.style.top = "80px"; currItem_s1.style.left = "70px"; currItem_s1.style.width = "350px"; currItem_s1.style.height = "30px"; currItem_s1.style.fontFamily = "century gothic"; currItem_s1.style.fontSize = "18px"; currItem_s1.style.color = "#999999"; currItem.appendChild(currItem_s1); // // Loop all LAN and render them as options // for(var lcnt = 0; lcnt < curr_lans.length; lcnt++) { var currItem_o1 = document.createElement("option"); currItem_o1.id = "lan_" + curr_lans[lcnt]; currItem_o1.name = "lan_" + curr_lans[lcnt]; currItem_o1.className = "rounded_input"; currItem_o1.text = curr_lans[lcnt]; currItem_o1.value = curr_lans[lcnt]; currItem_s1.add(currItem_o1); } // // Kommun Image // var currItem_1 = document.createElement("img"); currItem_1.id = "kommunNameImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "100px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Kommun // var currItem_s1 = document.createElement("select"); currItem_s1.id = "kommunName"; currItem_s1.name = "kommunName"; currItem_s1.className = "rounded_input"; currItem_s1.style.position = "absolute"; currItem_s1.style.top = "120px"; currItem_s1.style.left = "70px"; currItem_s1.style.width = "350px"; currItem_s1.style.height = "30px"; currItem_s1.style.fontFamily = "century gothic"; currItem_s1.style.fontSize = "18px"; currItem_s1.style.color = "#999999"; currItem.appendChild(currItem_s1); // // Loop all Kommun and render them as options // for(var lcnt = 0; lcnt < curr_kommuner.length; lcnt++) { var currItem_o1 = document.createElement("option"); currItem_o1.id = "lan_" + curr_kommuner[lcnt]; currItem_o1.name = "lan_" + curr_kommuner[lcnt]; currItem_o1.className = "rounded_input"; currItem_o1.text = curr_kommuner[lcnt]; currItem_o1.value = curr_kommuner[lcnt]; currItem_s1.add(currItem_o1); } // // Save button text // var currItem_1 = document.createElement("div"); currItem_1.id = "saveButtonText"; currItem_1.style.position = "absolute"; if(curr_browser == "IE") { currItem_1.style.top = "168px"; } else { currItem_1.style.top = "163px"; } currItem_1.style.left = "50"; currItem_1.style.width = "200"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "center"; currItem_1.onclick = function() { sendSaveNewPlaceProfileInfo(); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Spara'; currItem.appendChild(currItem_1); // // Exit/Abort button text // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; if(curr_browser == "IE") { currItem_1.style.top = "168px"; } else { currItem_1.style.top = "163px"; } currItem_1.style.left = "200"; currItem_1.style.width = "200"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "center"; currItem_1.onclick = function() { document.body.removeChild(currItem); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Avbryt'; currItem.appendChild(currItem_1); } // // Gather, check and send update info // function sendSaveNewPlaceProfileInfo() { var currMark = document.getElementById("placeName"); var currLan = document.getElementById("lanName"); var currKommun = document.getElementById("kommunName"); // // Remove popup window // document.body.removeChild(document.getElementById("newPlaceProfileDiv")); sendHttpPostRequest('PhpFunctions/saveNewPlaceInfo.php', 'currMark=' + currMark.value + '&currLan=' + currLan.value + '&currKommun=' + currKommun.value); } // // Render popup asking user what they wish to do with current game // function requestActionAmmoProfile(param) { var curr_cd = document.getElementById("content_div"); //curr_cd.innerHTML = ""; // // White background image // var currTop = param.style.top.substring(0, param.style.top.indexOf("px")); var currItem = document.createElement("div"); currItem.id = "editWishDiv"; currItem.style.position = "absolute"; //currItem.style.top = "80"; currItem.style.top = (Number(currTop) - Number(40)) + "px"; currItem.style.left = "20px"; currItem.style.width = "550px"; currItem.style.height = "90px"; currItem.style.zIndex = "200"; if(curr_browser == "IE") { currItem.style.filter = 'alpha(opacity = 95)'; } else { currItem.style.opacity = 0.95; } currItem.innerHTML = ''; curr_cd.appendChild(currItem); // // Edit info button // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; currItem_1.style.top = "30"; currItem_1.style.left = "50"; currItem_1.style.width = "100"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "left"; currItem_1.onclick = function() { editAmmoProfile(param); curr_cd.removeChild(currItem); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Redigera'; currItem.appendChild(currItem_1); // // Remove info button // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; currItem_1.style.top = "30"; currItem_1.style.left = "250"; currItem_1.style.width = "100"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "left"; currItem_1.onclick = function() { sendHttpPostRequest('./PhpFunctions/raderaAmmoProfile.php', "currID=" + param.id); curr_cd.removeChild(currItem);}; currItem_1.innerHTML = 'Radera'; currItem.appendChild(currItem_1); // // Exit/Abort button text // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; currItem_1.style.top = "30"; currItem_1.style.left = "450"; currItem_1.style.width = "100"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "left"; currItem_1.onclick = function() { curr_cd.removeChild(currItem); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Avbryt'; currItem.appendChild(currItem_1); }// // User wants to change their info // function editAmmoProfile(param) { // // White background image // var currItem = document.createElement("div"); currItem.id = "editAmmoProfileDiv"; currItem.style.position = "absolute"; currItem.style.top = "30px"; currItem.style.left = "100px"; currItem.style.width = "500px"; currItem.style.height = "300px"; currItem.style.zIndex = "200"; if(curr_browser == "IE") { currItem.style.filter = 'alpha(opacity = 95)'; } else { currItem.style.opacity = 0.95; } currItem.innerHTML = ''; document.body.appendChild(currItem); // // Profilename Image // var currItem_1 = document.createElement("img"); currItem_1.id = "profileNameImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "20px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Profilename // var currStr = param.getAttribute("profilnamn"); if(currStr == "") { currStr = "Profilnamn"; } var currItem_1 = document.createElement("input"); currItem_1.id = "profileName"; currItem_1.name = "profileName"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "40px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = currStr; currItem.appendChild(currItem_1); // // Weapontype Image // var currItem_1 = document.createElement("img"); currItem_1.id = "weaponTypeImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "60px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // WeaponType // var currStr = param.getAttribute("vapen_typ"); if(currStr == "") { currStr = "Vapentyp"; } var currItem_1 = document.createElement("input"); currItem_1.id = "weaponType"; currItem_1.name = "weaponType"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "80px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = currStr; currItem.appendChild(currItem_1); // // Caliber Image // var currItem_1 = document.createElement("img"); currItem_1.id = "caliberImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "100px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Caliber // var currStr = param.getAttribute("kaliber"); if(currStr == "") { currStr = "Kaliber"; } var currItem_1 = document.createElement("input"); currItem_1.id = "caliber"; currItem_1.name = "caliber"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "120px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = currStr; currItem.appendChild(currItem_1); // // Bullet Image // var currItem_1 = document.createElement("img"); currItem_1.id = "bulletImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "140px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Bullet // var currStr = param.getAttribute("kula"); if(currStr == "") { currStr = "Kula"; } var currItem_1 = document.createElement("input"); currItem_1.id = "bullet"; currItem_1.name = "bullet"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "160px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = currStr; currItem.appendChild(currItem_1); // // Bulletweight Image // var currItem_1 = document.createElement("img"); currItem_1.id = "bulletWeightImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "180px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Bulletweight // var currStr = param.getAttribute("kulvikt"); if(currStr == "") { currStr = "Kulvikt"; } var currItem_1 = document.createElement("input"); currItem_1.id = "bulletWeight"; currItem_1.name = "bulletWeight"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "200px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = currStr; currItem.appendChild(currItem_1); // // Update button text // var currItem_1 = document.createElement("div"); currItem_1.id = "saveButtonText"; currItem_1.style.position = "absolute"; if(curr_browser == "IE") { currItem_1.style.top = "268px"; } else { currItem_1.style.top = "263px"; } currItem_1.style.left = "50"; currItem_1.style.width = "200"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "center"; currItem_1.onclick = function() { sendSaveUpdatedAmmoInfo(param); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Uppdatera'; currItem.appendChild(currItem_1); // // Exit/Abort button text // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; if(curr_browser == "IE") { currItem_1.style.top = "268px"; } else { currItem_1.style.top = "263px"; } currItem_1.style.left = "200"; currItem_1.style.width = "200"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "center"; currItem_1.onclick = function() { document.body.removeChild(currItem); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Avbryt'; currItem.appendChild(currItem_1); } // // Gather, check and send update info // function sendSaveUpdatedAmmoInfo(param) { var profileName = document.getElementById("profileName"); var weaponType = document.getElementById("weaponType"); var caliber = document.getElementById("caliber"); var bullet = document.getElementById("bullet"); var bulletWeight = document.getElementById("bulletWeight"); // // Remove popup window // document.body.removeChild(document.getElementById("editAmmoProfileDiv")); sendHttpPostRequest('PhpFunctions/updateAmmoInfo.php', 'currID=' + param.id + '&currProfileName=' + profileName.value + '&currWeaponType=' + weaponType.value + '&currCaliber=' + caliber.value + '&currBullet=' + bullet.value + '&currBulletWeight=' + bulletWeight.value); } // // User wants to change their info // function addNewAmmoProfile() { // // White background image // var currItem = document.createElement("div"); currItem.id = "newAmmoProfileDiv"; currItem.style.position = "absolute"; currItem.style.top = "30px"; currItem.style.left = "100px"; currItem.style.width = "500px"; currItem.style.height = "300px"; currItem.style.zIndex = "200"; if(curr_browser == "IE") { currItem.style.filter = 'alpha(opacity = 95)'; } else { currItem.style.opacity = 0.95; } currItem.innerHTML = ''; document.body.appendChild(currItem); // // Profilename Image // var currItem_1 = document.createElement("img"); currItem_1.id = "profileNameImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "20px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Profilename // var currItem_1 = document.createElement("input"); currItem_1.id = "profileName"; currItem_1.name = "profileName"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "40px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = "Profilnamn"; currItem_1.onkeydown = function() { emptyMe(this); }; currItem.appendChild(currItem_1); // // Weapontype Image // var currItem_1 = document.createElement("img"); currItem_1.id = "weaponTypeImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "60px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // WeaponType // var currItem_1 = document.createElement("input"); currItem_1.id = "weaponType"; currItem_1.name = "weaponType"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "80px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = "Vapentyp"; currItem_1.onkeydown = function() { emptyMe(this); }; currItem.appendChild(currItem_1); // // Caliber Image // var currItem_1 = document.createElement("img"); currItem_1.id = "caliberImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "100px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Caliber // var currItem_1 = document.createElement("input"); currItem_1.id = "caliber"; currItem_1.name = "caliber"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "120px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = "Kaliber"; currItem_1.onkeydown = function() { emptyMe(this); }; currItem.appendChild(currItem_1); // // Bullet Image // var currItem_1 = document.createElement("img"); currItem_1.id = "bulletImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "140px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Bullet // var currItem_1 = document.createElement("input"); currItem_1.id = "bullet"; currItem_1.name = "bullet"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "160px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = "Kula"; currItem_1.onkeydown = function() { emptyMe(this); }; currItem.appendChild(currItem_1); // // Bulletweight Image // var currItem_1 = document.createElement("img"); currItem_1.id = "bulletWeightImg"; currItem_1.style.position = "absolute"; currItem_1.style.top = "180px"; currItem_1.style.left = "50px"; currItem_1.src = "./Images/input_field.png"; currItem.appendChild(currItem_1); // // Bulletweight // var currItem_1 = document.createElement("input"); currItem_1.id = "bulletWeight"; currItem_1.name = "bulletWeight"; currItem_1.type = "text"; currItem_1.className = "rounded_input"; currItem_1.style.position = "absolute"; currItem_1.style.top = "200px"; currItem_1.style.left = "70px"; currItem_1.style.width = "350px"; currItem_1.style.height = "30px"; currItem_1.style.fontFamily = "century gothic"; currItem_1.style.fontSize = "18px"; currItem_1.style.color = "#999999"; currItem_1.value = "Kulvikt"; currItem_1.onkeydown = function() { emptyMe(this); }; currItem.appendChild(currItem_1); // // Save button text // var currItem_1 = document.createElement("div"); currItem_1.id = "saveButtonText"; currItem_1.style.position = "absolute"; if(curr_browser == "IE") { currItem_1.style.top = "268px"; } else { currItem_1.style.top = "263px"; } currItem_1.style.left = "50"; currItem_1.style.width = "200"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "center"; currItem_1.onclick = function() { sendSaveNewAmmoProfileInfo(); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Spara'; currItem.appendChild(currItem_1); // // Exit/Abort button text // var currItem_1 = document.createElement("div"); currItem_1.id = "createButtonText"; currItem_1.style.position = "absolute"; if(curr_browser == "IE") { currItem_1.style.top = "268px"; } else { currItem_1.style.top = "263px"; } currItem_1.style.left = "200"; currItem_1.style.width = "200"; currItem_1.style.height = "30"; currItem_1.style.zIndex = "200"; currItem_1.style.fontFamily = "Century Gothic"; currItem_1.style.fontSize = "20"; currItem_1.style.fontWeight = "bold"; currItem_1.style.color = "#698E2B"; currItem_1.style.cursor = "pointer"; currItem_1.style.textAlign = "center"; currItem_1.onclick = function() { document.body.removeChild(currItem); window.scrollTo(0, 0); }; currItem_1.innerHTML = 'Avbryt'; currItem.appendChild(currItem_1); } // // Gather, check and send update info // function sendSaveNewAmmoProfileInfo() { var profileName = document.getElementById("profileName"); var weaponType = document.getElementById("weaponType"); var caliber = document.getElementById("caliber"); var bullet = document.getElementById("bullet"); var bulletWeight = document.getElementById("bulletWeight"); // // Remove popup window // document.body.removeChild(document.getElementById("newAmmoProfileDiv")); sendHttpPostRequest('PhpFunctions/saveNewAmmoInfo.php', 'currProfileName=' + profileName.value + '&currWeaponType=' + weaponType.value + '&currCaliber=' + caliber.value + '&currBullet=' + bullet.value + '&currBulletWeight=' + bulletWeight.value); } // // User wants to add diary entry // function addNewGroup() { var currContent = ""; // // Group name // currContent += ''; currContent += ''; // // Information to user // currContent += '
'; currContent += 'Välj vilken eller vilka platsprofiler som du vill koppla till gruppen'; currContent += '
'; // // Groups // var currTop = 130; var currLeft = 100; if(currUserGroups.length <= 0) { currContent += '
Du har inte definierat några grupper / marker! Gå in på "Grupper" i menyn för skapa nya grupper
'; } var curr_plats = Array(); for(var ppcnt = 0; ppcnt < currPlatsProfiler.length; ppcnt++) { curr_plats[ppcnt] = currPlatsProfiler[ppcnt].split("<>"); } for(var scnt = 0; scnt < curr_plats.length; scnt++) { currContent += '
' + curr_plats[scnt][2] + '
'; currLeft += Number(180); if(currLeft > 750) { currLeft = 100; currTop += Number(30); } } // // Save button // currTop += Number(80); currContent += '
'; currContent += 'Spara'; currContent += '
'; // // Exit/Cancel button // currContent += '
'; currContent += 'Avbryt'; currContent += '
'; document.getElementById("content_div").innerHTML = currContent; } // // Gather new group info and save it // function saveNewGroup() { var currGroupName = document.getElementById("groupName"); var places = document.getElementsByName("user_plats"); var selectedPlaces = ""; for(var cnt = 0; cnt < places.length; cnt++) { if(places[cnt].checked) { if(selectedPlaces != "") { selectedPlaces += ";"; } selectedPlaces += places[cnt].value; } } sendHttpPostRequest('PhpFunctions/saveNewGroup.php', 'currGroupName=' + currGroupName.value + '&currPlaces=' + selectedPlaces); } // // Get new members email and send php file // function inviteNewMember(currID, currGroupName) { var currEmail = document.getElementById("newMemberEmail"); if(currEmail.value == "" || currEmail.value == " " || currEmail.value == "Email") { alert("Vänligen kontrollera emailadressen!"); return 0; } var currMessage = "Hej, \n\nDu har blivit inbjuden till en jaktgrupp (" + currGroupName + ") \n\nFölj länken nedan för att acceptera\n\n"; currMessage += "http://www.jaktstatistik.se/acceptInvitation.php?currID=" + currID; sendHttpPostRequest('../PhpFunctions/inviteNewMember.php', 'currID=' + currID + '&currEmail=' + currEmail.value + '&currGroupName=' + currGroupName + '&currMessage=' + currMessage) }// // Gather user info and send to saveNewAccount.php // function saveNewAccountAcceptSubmit() { var currEmail = document.getElementById("user_email"); var pwd1 = document.getElementById("user_pwd_1"); var pwd2 = document.getElementById("user_pwd_2"); var currID = document.getElementById("currID"); if(currEmail.value == "" || currEmail.value == " ") { alert("Kontrollera email adressen!"); return 0; } if(pwd1.value == "" || pwd1.value == " " || pwd1.value != pwd2.value) { alert("Kontrollera Lösenorden!"); return 0; } sendHttpPostRequest('PhpFunctions/saveNewAccountAccept.php', 'user_email=' + currEmail.value + '&user_pwd_1=' + md5(pwd1.value) + '&currID=' + currID.value); } function setUpPWDCreateAccept_1(param) { param.parentNode.removeChild(param); var tmp = document.getElementById("user_pwd_1"); tmp.focus() } function setUpPWDCreateAccept_2(param) { param.parentNode.removeChild(param); var tmp = document.getElementById("user_pwd_2"); tmp.focus(); }// // Create new message or response to previous message // function addNewGroupMessage(currID) { var currContent = ""; // // Information to user // currContent += '
'; currContent += 'Skriv ett meddelande till dina jaktkamrater. Kryssa för om meddelandet även ska mailas ut.
'; currContent += '
'; // // Message Subject // currContent += ''; currContent += ''; // // Message Content // currContent += ''; if(curr_browser == "IE") { currContent += ''; } else { currContent += ''; } // // Mail Message? // currContent += ''; currContent += '
Maila
'; // // Post button // currContent += '
'; currContent += 'Posta'; currContent += '
'; // // Exit/Cancel button // currContent += '
'; currContent += 'Avbryt'; currContent += '
'; currContent += ''; document.getElementById("content_div").innerHTML = currContent; } // // Gather message info and send to be saved // function postGroupMessage(currID) { var msgSubject = document.getElementById("msgSubject"); var msgContent = document.getElementById("msgContent"); sendHttpPostRequest('PhpFunctions/saveNewGroupMessage.php', 'currID=' + currID + '&msgSubject=' + msgSubject.value + '&msgContent=' + msgContent.value); }// // Create new message or response to previous message // function addNewGroupMessageComment(currGrpID, currMsgID, currMsgMainID) { var currContent = ""; // // Information to user // currContent += '
'; currContent += 'Skriv en kommentar till din jaktkamrats inlägg.
'; currContent += '
'; // // Message Subject // currContent += ''; currContent += ''; // // Message Content // currContent += ''; if(curr_browser == "IE") { currContent += ''; } else { currContent += ''; } // // Mail Message? // currContent += ''; currContent += '
Maila
'; // // Post button // currContent += '
'; currContent += 'Posta'; currContent += '
'; // // Exit/Cancel button // currContent += '
'; currContent += 'Avbryt'; currContent += '
'; currContent += ''; document.getElementById("content_div").innerHTML = currContent; } // // Gather message info and send to be saved // function postGroupMessageComment(currGrpID, currMsgID, currMsgMainID) { var msgSubject = document.getElementById("msgSubject"); var msgContent = document.getElementById("msgContent"); sendHttpPostRequest('PhpFunctions/saveNewGroupMessageComment.php', 'currID=' + currGrpID + '&currMsgID=' + currMsgID + '&currMsgMainID=' + currMsgMainID + '&msgSubject=' + msgSubject.value + '&msgContent=' + msgContent.value); }// // Create new message or response to previous message // function addNewGroupEvent(currID) { var currContent = ""; // // Information to user // currContent += '
'; currContent += 'Posta en ny jakt eller ett möte. Kryssa för om meddelandet även ska mailas ut.
'; currContent += '
'; // // Event Subject // currContent += ''; currContent += ''; // // Event date // var currDate = new Date(); var currY = currDate.getFullYear(); var currM = Number(currDate.getMonth()) + Number(1); var currD = currDate.getDate(); var currHour = currDate.getHours(); var currMinute = currDate.getMinutes(); currContent += ''; currContent += ''; // // Event gathering place // currContent += ''; currContent += ''; // // Event time // currContent += ''; currContent += ''; // // Message Content // currContent += ''; if(curr_browser == "IE") { currContent += ''; } else { currContent += ''; } // // Mail Message? // currContent += ''; currContent += '
Maila
'; // // Post button // currContent += '
'; currContent += 'Posta'; currContent += '
'; // // Exit/Cancel button // currContent += '
'; currContent += 'Avbryt'; currContent += '
'; currContent += ''; document.getElementById("content_div").innerHTML = currContent; } // // Gather message info and send to be saved // function prePostGroupEvent(currID) { var msgSubject = document.getElementById("msgSubject"); var msgPlace = document.getElementById("msgPlace"); var msgDate = document.getElementById("msgDate"); var msgTime = document.getElementById("msgTime"); var msgContent = document.getElementById("msgContent"); // // Check date // var birthdate = msgDate.value; if(birthdate == "" || birthdate == "ÅÅÅÅ-MM-DD") { birthdate = "0000-00-00"; } else { var tmp = birthdate.split("-"); if(tmp.length != 3) { alert("Kontrollera datumformatet, det ska vara ÅÅÅÅ-MM-DD / 2010-01-01"); return 0; } for(var i = 0; i < tmp.length; i++) { if(!isNumber(tmp[i])) { if(i == 0) { alert("Det förefaller som om ÅRET du anget inte är ett nummer"); return 0; } else if(i == 1) { alert("Det förefaller som om MÅNADEN du anget inte är ett nummer"); return 0; } else if(i == 2) { alert("Det förefaller som om DAGEN du anget inte är ett nummer"); return 0; } } } } msgDate.value = birthdate; // // Check time // var birthdate = msgTime.value; if(birthdate == "" || birthdate == "TT:MM") { birthdate = "00:00"; } else { var tmp = birthdate.split(":"); if(tmp.length != 2) { alert("Kontrollera tidsformatet, det ska vara TT:MM / 09:30"); return 0; } for(var i = 0; i < tmp.length; i++) { if(!isNumber(tmp[i])) { if(i == 0) { alert("Det förefaller som om TIMMEN du anget inte är ett nummer"); return 0; } else if(i == 1) { alert("Det förefaller som om MINUTERNA du anget inte är ett nummer"); return 0; } } } } msgTime.value = birthdate; sendHttpPostRequest('PhpFunctions/saveNewGroupEvent.php', 'currID=' + currID + '&msgSubject=' + msgSubject.value + '&msgPlace=' + msgPlace.value + '&msgDate=' + msgDate.value + '&msgTime=' + msgTime.value + '&msgContent=' + msgContent.value); }// // Create new message or response to previous message // function groupEventResponse(param) { /* alert(param.getAttribute("curr_event")); return; */ var tmp = param.getAttribute("curr_event").split("<>"); /* 0 = id 1 = group_id 2 = date 3 = gathering_time 4 = gathering_place 5 = subject 6 = message 7 = accepted 8 = declined 9 = guests 10 = dogs */ var currContent = ""; currContent += '
'; // // Subject // currContent += '
'; currContent += '' + tmp[5] + ''; currContent += '
'; // // Accpted // currContent += '
'; currContent += '(Tackat JA: ' + tmp[7] + '   /   Tackat NEJ: ' + tmp[8] + '   /   Antal Gäster: ' + tmp[9] + '   /   Antal Hundar: ' + tmp[10] + ')'; currContent += '
'; // // Gathering place // currContent += '
'; currContent += "Samlingsplats: " + tmp[4]; currContent += '
'; // // Gathering date and time // currContent += '
'; currContent += "Datum: " + tmp[2]; currContent += '
'; // // Gathering place // currContent += '
'; currContent += "Tid: " + tmp[3]; currContent += '
'; // // Message // currContent += '
'; currContent += tmp[6]; currContent += '
'; // // Participate // var currSelect = ""; currContent += '
'; currContent += ''; currContent += '
'; // // Guests // currContent += '
'; currContent += ''; currContent += '
'; // // Dogs // currContent += '
'; currContent += ''; currContent += '
'; // // Message // var currStr = tmp[15]; currContent += '
'; currContent += ''; currContent += '
'; // // Answer button // currContent += '
'; currContent += 'Svara'; currContent += '
'; // // Exit/Cancel button // currContent += '
'; currContent += 'Avbryt'; currContent += '
'; currContent += '
'; document.getElementById("content_div").innerHTML = currContent; } // // Gather message info and send to be saved // function answerGroupEvent(currID, currGrpID, currStatus) { var event_accept_decline = document.getElementById("event_accept_decline"); var event_guests = document.getElementById("event_guests"); var event_dogs = document.getElementById("event_dogs"); var event_user_message = document.getElementById("event_user_message"); /* alert(event_accept_decline.value + "\n\r" + event_guests.value + "\n\r" + event_dogs.value + "\n\r" + event_user_message.value); return; */ sendHttpPostRequest('PhpFunctions/saveGroupEventResponse.php', 'currID=' + currID + '&currGrpID=' + currGrpID + '&event_accept_decline=' + event_accept_decline.value + '&event_guests=' + event_guests.value + '&event_dogs=' + event_dogs.value + '&event_user_message=' + event_user_message.value + '&currStatus=' + currStatus); }