function pws_valuecheck(field, regexp, log) { var obj = document.getElementById(field); var check = unescape(regexp); var errmsg = document.getElementsByName(log); check = new RegExp(check, 'gi'); if (obj.value.match(check) || !(obj.value)) { for (var i = 0; i < errmsg.length; i++) { errmsg[i].parentNode.className = ''; } return true; } else { for (var i = 0; i < errmsg.length; i++) { errmsg[i].parentNode.className = 'err show'; } obj.parentNode.parentNode.className = 'err'; return false; } } function pws_requiredcheck(field, log) { var obj = document.getElementById(field); var errmsg = document.getElementsByName(log); if (obj.value) { for (var i = 0; i < errmsg.length; i++) { errmsg[i].parentNode.className = ''; } return true; } else { for (var i = 0; i < errmsg.length; i++) { errmsg[i].parentNode.className = 'err show'; } obj.parentNode.parentNode.className = 'err'; return false; } } function swapimage(id, state) { // AUTHOR: Georg M. Freund // (c) Copyright 2007 PuzzWorks OHG. All rights reserved. // Free for comercial and private use. Keep this Comment. /* Swaps image from 'name.state.filetype' to 'name.filetype' and back Required: swapimage('id_of_image') Default settings: Image state (state): over */ // Config var state = (state) ? state: "over"; // Swap image var obj = document.getElementById(id).src; var img = obj.split("."); var filetype = img[img.length - 1]; var newimg; if (img[img.length - 2] == state) { img.splice(img.length - 2, 2, filetype); } else { img.splice(img.length - 1, 1, state, filetype); newimg = img.join("."); } newimg = img.join("."); // Write image document.getElementById(id).src = newimg; } function goto(link, target, width, height, args) { // AUTHOR: Georg M. Freund // (c) Copyright 2007 PuzzWorks OHG. All rights reserved. // Free for comercial and private use. Keep this Comment. /* Pop-Up: goto(link_to_page, window_name); Default settings: Width: 400px / Height: 300px / Arguments: location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no Redirect: goto(link); */ // POP-UP if (target) { // Default Config var width = (width) ? width: 400; var height = (height) ? height: 300; var args = (args) ? args: 'location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=no'; // Open Window args = 'width=' + width + ', height=' + height + ',' + args; window.open(link, target, args); } // Redirect else { document.location = link; } } function changesize(id, action, basesize, type, step, maxsize, minsize) { // AUTHOR: Georg M. Freund // (c) Copyright 2007 PuzzWorks OHG. All rights reserved. // Free for comercial and private use. Keep this Comment. /* Changes font-size of elemnt with "id" Required: changesize('id', 'action{up;down;reset;reloade}') Default settings: Normal font-size of of element (basesize): 12 / Font-size Type (type): pt / Size of up and down steps (step): 1 / Maximal font-size (maxsize): 18 / Minimal font-size (minsize): 8 */ // Default Config var basesize = (basesize) ? basesize: 12; var type = (type) ? type: 'pt'; var step = (step) ? step: 1; var maxsize = (maxsize) ? maxsize: 18; var minsize = (minsize) ? minsize: 8; // Get Data var fontsize = document.getElementById(id).style.fontSize.match(/\d+/) * 1; var newsize = basesize; var cookie = cookiecontrol(id); // Resize if (!fontsize) newsize = basesize; if (action == 'up') newsize = fontsize + step; if (action == 'down') newsize = fontsize - step; if (action == 'reset') newsize = basesize; if (action == 'reloade' && cookie) newsize = cookie; if (newsize < minsize) newsize = minsize; if (newsize > maxsize) newsize = maxsize; // Wirte Document & Cookie cookiecontrol(id, newsize); document.getElementById('size').style.width = (newsize - 8) * 10 + '%'; document.getElementById(id).style.fontSize = newsize + type; } function cookiecontrol(name, value) { // AUTHOR: Georg M. Freund // (c) Copyright 2007 PuzzWorks OHG. All rights reserved. // Free for comercial and private use. Keep this Comment. /* Write cookie: cookiecontrol('name','value'); Read cookie: cookiecontrol('name'); */ if (value) { document.cookie = name + "=" + value + ";path=/;"; } else { var cookie = document.cookie.split("; "); for (var i = 0; i < cookie.length; i++) { var row = cookie[i].split("="); if (row[0] == name) { return row[1]; } } } }