//Javascript by 3rdSUN

function checkbox(){
// Create variable is_input to see if there is a ? in the url
var locate = window.location
document.kontakt.tempval.value = locate;

var locate2 = document.kontakt.tempval.value
var is_input = locate2.indexOf('?');

//alert (locate2)
//alert (is_input)
// Check the position of the ? in the url
if (is_input != -1)
{ 
// Create variable from ? in the url to the end of the string
box = locate2.substring(is_input+1, locate2.length);
} else {
box=0;
}

//alert(box);
if (box=="box%5B1%5D=1") {document.kontakt.box1.checked=true; }
if (box=="box%5B2%5D=1") {document.kontakt.box2.checked=true; }
if (box=="box%5B3%5D=1") {document.kontakt.box3.checked=true; }
if (box=="box%5B4%5D=1") {document.kontakt.box4.checked=true; }
if (box=="box%5B5%5D=1") {document.kontakt.box5.checked=true; }
if (box=="box%5B6%5D=1") {document.kontakt.box6.checked=true; }
if (box=="box%5B7%5D=1") {document.kontakt.box7.checked=true; }
if (box=="box%5B8%5D=1") {document.kontakt.box8.checked=true; }
if (box=="box%5B9%5D=1") {document.kontakt.box9.checked=true; }
if (box=="box%5B10%5D=1") {document.kontakt.box10.checked=true; }
if (box=="box%5B11%5D=1") {document.kontakt.box11.checked=true; }
if (box=="box%5B12%5D=1") {document.kontakt.box12.checked=true; }
if (box=="box%5B13%5D=1") {document.kontakt.box13.checked=true; }
if (box=="box%5B14%5D=1") {document.kontakt.box14.checked=true; }
if (box=="box%5B15%5D=1") {document.kontakt.box15.checked=true; }
if (box=="box%5B16%5D=1") {document.kontakt.box16.checked=true; }
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function nextpage(){
cookietext=':';
if (document.kontakt.box1.checked) {cookietext=cookietext+'box1:'; }
if (document.kontakt.box2.checked) {cookietext=cookietext+'box2:'; }
if (document.kontakt.box3.checked) {cookietext=cookietext+'box3:'; }
if (document.kontakt.box4.checked) {cookietext=cookietext+'box4:'; }
if (document.kontakt.box5.checked) {cookietext=cookietext+'box5:'; }
if (document.kontakt.box6.checked) {cookietext=cookietext+'box6:'; }
if (document.kontakt.box7.checked) {cookietext=cookietext+'box7:'; }
if (document.kontakt.box8.checked) {cookietext=cookietext+'box8:'; }
if (document.kontakt.box9.checked) {cookietext=cookietext+'box9:'; }
if (document.kontakt.box10.checked) {cookietext=cookietext+'box10:'; }
if (document.kontakt.box11.checked) {cookietext=cookietext+'box11:'; }
if (document.kontakt.box12.checked) {cookietext=cookietext+'box12:'; }
if (document.kontakt.box13.checked) {cookietext=cookietext+'box13:'; }
if (document.kontakt.box14.checked) {cookietext=cookietext+'box14:'; }
if (document.kontakt.box15.checked) {cookietext=cookietext+'box15:'; }
if (document.kontakt.box16.checked) {cookietext=cookietext+'box16:'; }

if (document.kontakt.sex[0].checked){
setCookie('sex', 'Herr', '', '', '', '')
} else {
setCookie('sex', 'Frau', '', '', '', '')
}
setCookie('vorname', document.kontakt.vorname.value, '', '', '', '')
setCookie('name', document.kontakt.name.value, '', '', '', '')
setCookie('firma', document.kontakt.firma.value, '', '', '', '')
setCookie('email', document.kontakt.email.value, '', '', '', '')
setCookie('strabe', document.kontakt.strabe.value, '', '', '', '')
setCookie('abteilung', document.kontakt.abteilung.value, '', '', '', '')
setCookie('plz', document.kontakt.plz.value, '', '', '', '')
setCookie('land', document.kontakt.land.value, '', '', '', '')
setCookie('ort', document.kontakt.ort.value, '', '', '', '')
setCookie('telefon', document.kontakt.telefon.value, '', '', '', '')
setCookie('telefax', document.kontakt.telefax.value, '', '', '', '')
setCookie('bemerkungen', document.kontakt.bemerkungen.value, '', '', '', '')
setCookie('cookiebox', cookietext, '', '', '', '')
}

// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}

function cookiewipe(){
setCookie('cookiebox', '', '', '', '', '');
setCookie('sex', '', '', '', '', '');
setCookie('vorname', '', '', '', '', '')
setCookie('name', '', '', '', '', '')
setCookie('firma', '', '', '', '', '')
setCookie('email', '', '', '', '', '')
setCookie('strabe', '', '', '', '', '')
setCookie('abteilung', '', '', '', '', '')
setCookie('plz', '', '', '', '', '')
setCookie('land', '', '', '', '', '')
setCookie('ort', '', '', '', '', '')
setCookie('telefon', '', '', '', '', '')
setCookie('telefax', '', '', '', '', '')
setCookie('bemerkungen', '', '', '', '', '')
}
