﻿$(document).ready(function () {
//Time boxes
$('#qStart, #qEnd, #advDate').datepick({
dateFormat: 'dd-mm-yyyy', yearRange: 'any', showTrigger: '#calImg'
});
//Corners
$('#first').cornerz({ radius: 10, corners: "tr bl br", fixIE: true })
$('#second').cornerz({ radius: 10, corners: "tr bl br", fixIE: true })
$('li .first').cornerz({ radius: 5, corners: "tr tl", fixIE: true })
$('li .second').cornerz({ radius: 5, corners: "tr tl", fixIE: true })
//Tab Selection
var tabSel = "";
tabSel = jQuery.url.param("qtabSel");
var tabContainers = $('div.tabs > div');
if (tabSel == 'adv') {
tabContainers.hide().filter('#second').show();
$("li .second").attr("class", "second selected");
}
if (tabSel == 'smp') {
tabContainers.hide().filter('#first').show();
$("li .first").attr("class", "first selected");
}
if (tabSel == undefined || tabSel == '') {
tabContainers.hide().filter('#first').show();
$("li .first").attr("class", "first selected");
}
$('div.tabs ul.tabNavigation a').click(function () {
tabContainers.hide();
tabContainers.filter(this.hash).show();
$('div.tabs ul.tabNavigation a').removeClass('selected');
$(this).addClass('selected');
return false;
});

//Returning data to simple search (Esbjergs forhandlingsprotokoller)
if (jQuery.url.param("q") != null) { $("#q").attr("value", decodeURI(jQuery.url.param("q").replace(/\+/g, " "))); }
if (jQuery.url.param("qStart") != null) { $("#qStart").attr("value", decodeURI(jQuery.url.param("qStart").replace(/\+/g, " "))); }
if (jQuery.url.param("qEnd") != null) { $("#qEnd").attr("value", decodeURI(jQuery.url.param("qEnd").replace(/\+/g, " "))); }

//Returning data to Advanced search
if (jQuery.url.param("qkilde") != null) { $("#qkilde").attr("value", decodeURI(jQuery.url.param("qkilde").replace(/\+/g, " "))); }
if (jQuery.url.param("qdato") != null) { $("#advDate").attr("value", decodeURI(jQuery.url.param("qdato").replace(/\+/g, " "))); }
if (jQuery.url.param("qtype") != null) { $("#qtype").attr("value", decodeURI(jQuery.url.param("qtype").replace(/\+/g, " "))); }
if (jQuery.url.param("qfravar") != null) { $("#qfravar").attr("value", decodeURI(jQuery.url.param("qfravar").replace(/\+/g, " "))); }
if (jQuery.url.param("qsag") != null) { $("#qsag").attr("value", decodeURI(jQuery.url.param("qsag").replace(/\+/g, " "))); }
if (jQuery.url.param("qjournal") != null) { $("#qjournal").attr("value", decodeURI(jQuery.url.param("qjournal").replace(/\+/g, " "))); }
if (jQuery.url.param("qemne") != null) { $("#qemne").attr("value", decodeURI(jQuery.url.param("qemne").replace(/\+/g, " "))); }
if (jQuery.url.param("qstikord") != null) { $("#qstikord").attr("value", decodeURI(jQuery.url.param("qstikord").replace(/\+/g, " "))); }
if (jQuery.url.param("qbeskrivelse") != null) { $("#qbeskrivelse").attr("value", decodeURI(jQuery.url.param("qbeskrivelse").replace(/\+/g, " "))); }
if (jQuery.url.param("qindstilling") != null) { $("#qindstilling").attr("value", decodeURI(jQuery.url.param("qindstilling").replace(/\+/g, " "))); }
if (jQuery.url.param("qbeslut") != null) { $("#qbeslut").attr("value", decodeURI(jQuery.url.param("qbeslut").replace(/\+/g, " "))); }

// (Beværterfortegnelse)
if (jQuery.url.param("qBevillingsart") != null) { $("#qBevillingsart").attr("value", decodeURI(jQuery.url.param("qBevillingsart").replace(/\+/g, " "))); }
if (jQuery.url.param("qBevillingstype") != null) { $("#qBevillingsart").attr("value", decodeURI(jQuery.url.param("qBevillingstype").replace(/\+/g, " "))); }
if (jQuery.url.param("qGadenummer") != null) { $("#qGadenummer").attr("value", decodeURI(jQuery.url.param("qGadenummer").replace(/\+/g, " "))); }
if (jQuery.url.param("qOptagelsesdato") != null) { $("#qOptagelsesdato").attr("value", decodeURI(jQuery.url.param("qOptagelsesdato").replace(/\+/g, " "))); }
if (jQuery.url.param("qRestauration") != null) { $("#qRestauration").attr("value", decodeURI(jQuery.url.param("qRestauration").replace(/\+/g, " "))); }

// (Borgerdatabasen)
if (jQuery.url.param("qFornavne") != null) { $("#qFornavne").attr("value", decodeURI(jQuery.url.param("qFornavne").replace(/\+/g, " "))); }
// if (jQuery.url.param("qEfternavn") != null) { $("#qEfternavn").attr("value", decodeURI(jQuery.url.param("qEfternavn").replace(/\+/g, " "))); }
if (jQuery.url.param("qfodselsdato") != null) { $("#qfodselsdato").attr("value", decodeURI(jQuery.url.param("qfodselsdato").replace(/\+/g, " "))); }
if (jQuery.url.param("qFodested") != null) { $("#qFodested").attr("value", decodeURI(jQuery.url.param("qFodested").replace(/\+/g, " "))); }
if (jQuery.url.param("qgadevej") != null) { $("#qgadevej").attr("value", decodeURI(jQuery.url.param("qgadevej").replace(/\+/g, " "))); }
if (jQuery.url.param("qGadevejnummer") != null) { $("#qGadevejnummer").attr("value", decodeURI(jQuery.url.param("qGadevejnummer").replace(/\+/g, " "))); }
if (jQuery.url.param("qMatrikelnummer") != null) { $("#qMatrikelnummer").attr("value", decodeURI(jQuery.url.param("qMatrikelnummer").replace(/\+/g, " "))); }
if (jQuery.url.param("qHusstandsnummer") != null) { $("#qHusstandsnummer").attr("value", decodeURI(jQuery.url.param("qHusstandsnummer").replace(/\+/g, " "))); }
if (jQuery.url.param("qEjerafejendombopael") != null) { $("#qEjerafejendombopael").attr("value", decodeURI(jQuery.url.param("qEjerafejendombopael").replace(/\+/g, " "))); }
// if (jQuery.url.param("qStilling") != null) { $("#qStilling").attr("value", decodeURI(jQuery.url.param("qStilling").replace(/\+/g, " "))); }
if (jQuery.url.param("qArbejdsgiverensnavnogbopael") != null) { $("#qArbejdsgiversnavnogbopael").attr("value", decodeURI(jQuery.url.param("qArbejdsgiversnavnogbopael").replace(/\+/g, " "))); }
if (jQuery.url.param("qStatusihusstand") != null) { $("#qStatusihusstand").attr("value", decodeURI(jQuery.url.param("qStatusihusstand").replace(/\+/g, " "))); }
if (jQuery.url.param("qDatoforbosaettelseiEsbjerg") != null) { $("#qDatoforbosaettelseiEsbjerg").attr("value", decodeURI(jQuery.url.param("qDatoforbosaettelseiEsbjerg").replace(/\+/g, " "))); }
if (jQuery.url.param("qTidligerebosaettelse") != null) { $("#qTidligerebosaettelse").attr("value", decodeURI(jQuery.url.param("qTidligerebosaettelse").replace(/\+/g, " "))); }
// if (jQuery.url.param("qBemaerkninger") != null) { $("#qBemaerkninger").attr("value", decodeURI(jQuery.url.param("qbemaerkninger").replace(/\+/g, " "))); }
if (jQuery.url.param("qHvornaareroplysningerneoptaget") != null) { $("#qHvornaareroplysningerneoptaget").attr("value", decodeURI(jQuery.url.param("qHvornaareroplysningerneoptaget").replace(/\+/g, " "))); }
if (jQuery.url.param("qHvemharoptagetoplysningerne") != null) { $("#qHvemharoptagetoplysningerne").attr("value", decodeURI(jQuery.url.param("qHvemharoptagetoplysningerne").replace(/\+/g, " "))); }
if (jQuery.url.param("qDoed") != null) { $("#qDoed").attr("value", decodeURI(jQuery.url.param("qDoed").replace(/\+/g, " "))); }
if (jQuery.url.param("qFraflyttet") != null) { $("#qFraflyttet").attr("value", decodeURI(jQuery.url.param("qFraflyttet").replace(/\+/g, " "))); }
if (jQuery.url.param("qFlyttettil") != null) { $("#qFlyttettil").attr("value", decodeURI(jQuery.url.param("qFlyttettil").replace(/\+/g, " "))); }
if (jQuery.url.param("qKoen") != null) { $("#qKoen").attr("value", decodeURI(jQuery.url.param("qKoen").replace(/\+/g, " "))); }
if (jQuery.url.param("qGadevej2") != null) { $("#qGadevej2").attr("value", decodeURI(jQuery.url.param("qGadevej2").replace(/\+/g, " "))); }
if (jQuery.url.param("qGadevejnummer2") != null) { $("#qGadevejnummer2").attr("value", decodeURI(jQuery.url.param("qGadevejnummer2").replace(/\+/g, " "))); }
if (jQuery.url.param("qAarlig husleje") != null) { $("#qAarlig husleje").attr("value", decodeURI(jQuery.url.param("qAarlig husleje").replace(/\+/g, " "))); }

// (Bryndum Vr. Nebel)
if (jQuery.url.param("qmoededato") != null) { $("#qmoededato").attr("value", decodeURI(jQuery.url.param("qmoededato").replace(/\+/g, " "))); }
if (jQuery.url.param("qmoedetype") != null) { $("#qmoedetype").attr("value", decodeURI(jQuery.url.param("qmoedetype").replace(/\+/g, " "))); }
if (jQuery.url.param("qfravaerende") != null) { $("#qfravaerende").attr("value", decodeURI(jQuery.url.param("qfravaerende").replace(/\+/g, " "))); }
if (jQuery.url.param("qsagsnr") != null) { $("#qsagsnr").attr("value", decodeURI(jQuery.url.param("qsagsnr").replace(/\+/g, " "))); }
if (jQuery.url.param("qemnet") != null) { $("#qemnet").attr("value", decodeURI(jQuery.url.param("qemnet").replace(/\+/g, " "))); }
if (jQuery.url.param("qsupplerendestikord") != null) { $("#qsupplerendestikord").attr("value", decodeURI(jQuery.url.param("qsupplerendestikord").replace(/\+/g, " "))); }
if (jQuery.url.param("qbeskrivelseafsagen") != null) { $("#qbeskrivelseafsagen").attr("value", decodeURI(jQuery.url.param("qbeskrivelseafsagen").replace(/\+/g, " "))); }
if (jQuery.url.param("qbeslutningen") != null) { $("#qbeslutningen").attr("value", decodeURI(jQuery.url.param("qbeslutningen").replace(/\+/g, " "))); }
if (jQuery.url.param("qbemaerkninger") != null) { $("#qbemaerkninger").attr("value", decodeURI(jQuery.url.param("qbemaerkninger").replace(/\+/g, " "))); }

// (Børneværnssager)
if (jQuery.url.param("qSagsnr") != null) { $("#qSagsnr").attr("value", decodeURI(jQuery.url.param("qSagsnr").replace(/\+/g, " "))); }
if (jQuery.url.param("qBarnetsfornavn") != null) { $("#qBarnetsfornavn").attr("value", decodeURI(jQuery.url.param("qBarnetsfornavn").replace(/\+/g, " "))); }
if (jQuery.url.param("qBarnetsefternavn") != null) { $("#qBarnetsefternavn").attr("value", decodeURI(jQuery.url.param("qBarnetsefternavn").replace(/\+/g, " "))); }
if (jQuery.url.param("qBarnetsfodselsdato") != null) { $("#qBarnetsfodselsdato").attr("value", decodeURI(jQuery.url.param("qBarnetsfodselsdato").replace(/\+/g, " "))); }
if (jQuery.url.param("qFaderensnavn") != null) { $("#qFaderensnavn").attr("value", decodeURI(jQuery.url.param("qFaderensnavn").replace(/\+/g, " "))); }
if (jQuery.url.param("qModerensnavn") != null) { $("#qModerensnavn").attr("value", decodeURI(jQuery.url.param("qModerensnavn").replace(/\+/g, " "))); }

// (Esbjerg Leksikon)
if (jQuery.url.param("qoversigt") != null) { $("#qoversigt").attr("value", decodeURI(jQuery.url.param("qoversigt").replace(/\+/g, " "))); }
if (jQuery.url.param("qkortbeskriv") != null) { $("#qkortbeskriv").attr("value", decodeURI(jQuery.url.param("qkortbeskriv").replace(/\+/g, " "))); }
if (jQuery.url.param("qindhold") != null) { $("#qindhold").attr("value", decodeURI(jQuery.url.param("qindhold").replace(/\+/g, " "))); }
if (jQuery.url.param("qforfatter") != null) { $("#qforfatter").attr("value", decodeURI(jQuery.url.param("qforfatter").replace(/\+/g, " "))); }
if (jQuery.url.param("qDato") != null) { $("#qDato").attr("value", decodeURI(jQuery.url.param("qDato").replace(/\+/g, " "))); }

// (Fraflyttede)
if (jQuery.url.param("qskattenr") != null) { $("#qskattenr").attr("value", decodeURI(jQuery.url.param("qskattenr").replace(/\+/g, " "))); }

// (Guldager Forhandlingsprotokoller)
if (jQuery.url.param("qunderskrifttilstedefravaerende") != null) { $("#qunderskrifttilstedefravaerende").attr("value", decodeURI(jQuery.url.param("qunderskrifttilstedefravaerende").replace(/\+/g, " "))); }
if (jQuery.url.param("qjournalnr") != null) { $("#qjournalnr").attr("value", decodeURI(jQuery.url.param("qjournalnr").replace(/\+/g, " "))); }

// (Lærere i Ribe Amt 1870-1970)
if (jQuery.url.param("qsognkommune") != null) { $("#qsognkommune").attr("value", decodeURI(jQuery.url.param("qsognkommune").replace(/\+/g, " "))); }
if (jQuery.url.param("qfoedselsdato") != null) { $("#qfoedselsdato").attr("value", decodeURI(jQuery.url.param("qfoedselsdato").replace(/\+/g, " "))); }
if (jQuery.url.param("qskole") != null) { $("#qskole").attr("value", decodeURI(jQuery.url.param("qskole").replace(/\+/g, " "))); }

// (Jerne Mandtalslister - tilgår her, vær opmærksom på evt. effekt af felter med ens navne)
if (jQuery.url.param("qfornavne") != null) { $("#qfornavne").attr("value", decodeURI(jQuery.url.param("qfornavne").replace(/\+/g, " "))); }
if (jQuery.url.param("qfodselsdag") != null) { $("#qfodselsdag").attr("value", decodeURI(jQuery.url.param("qfodselsdag").replace(/\+/g, " "))); }
if (jQuery.url.param("qgade") != null) { $("#qgade").attr("value", decodeURI(jQuery.url.param("qgade").replace(/\+/g, " "))); }
if (jQuery.url.param("qfoedested") != null) { $("#qfoedested").attr("value", decodeURI(jQuery.url.param("qfoedested").replace(/\+/g, " "))); }
if (jQuery.url.param("qtilflyttetfra") != null) { $("#qtilflyttetfra").attr("value", decodeURI(jQuery.url.param("qtilflyttetfra").replace(/\+/g, " "))); }
if (jQuery.url.param("qhusstandsnummer") != null) { $("#qhusstandsnummer").attr("value", decodeURI(jQuery.url.param("qhusstandsnummer").replace(/\+/g, " "))); }

// (Peter Nissens negativ database)
if (jQuery.url.param("qbestillerensefternavn") != null) { $("#qbestillerensefternavn").attr("value", decodeURI(jQuery.url.param("qbestillerensefternavn").replace(/\+/g, " "))); }
if (jQuery.url.param("qbestillerensfornavn") != null) { $("#qbestillerensfornavn").attr("value", decodeURI(jQuery.url.param("qbestillerensfornavn").replace(/\+/g, " "))); }
if (jQuery.url.param("qgadevej") != null) { $("#qgadevej").attr("value", decodeURI(jQuery.url.param("qgadevej").replace(/\+/g, " "))); }
if (jQuery.url.param("qby") != null) { $("#qby").attr("value", decodeURI(jQuery.url.param("qby").replace(/\+/g, " "))); }
if (jQuery.url.param("qmotivbilledtype") != null) { $("#qmotivbilledtype").attr("value", decodeURI(jQuery.url.param("qmotivbilledtype").replace(/\+/g, " "))); }
if (jQuery.url.param("qnegativtype") != null) { $("#qnegativtype").attr("value", decodeURI(jQuery.url.param("qnegativtype").replace(/\+/g, " "))); }
if (jQuery.url.param("qdato") != null) { $("#qdato").attr("value", decodeURI(jQuery.url.param("qdato").replace(/\+/g, " "))); }

// (Skattebøger)
if (jQuery.url.param("qaarstal") != null) { $("#qaarstal").attr("value", decodeURI(jQuery.url.param("qaarstal").replace(/\+/g, " "))); }
if (jQuery.url.param("qfornavn") != null) { $("#qfornavn").attr("value", decodeURI(jQuery.url.param("qfornavn").replace(/\+/g, " "))); }
if (jQuery.url.param("qefternavn") != null) { $("#qefternavn").attr("value", decodeURI(jQuery.url.param("qefternavn").replace(/\+/g, " "))); }
if (jQuery.url.param("qgadenavn") != null) { $("#qgadenavn").attr("value", decodeURI(jQuery.url.param("qgadenavn").replace(/\+/g, " "))); }
if (jQuery.url.param("qhusnr") != null) { $("#qhusnr").attr("value", decodeURI(jQuery.url.param("qhusnr").replace(/\+/g, " "))); }
if (jQuery.url.param("qbydel") != null) { $("#qbydel").attr("value", decodeURI(jQuery.url.param("qbydel").replace(/\+/g, " "))); }
if (jQuery.url.param("qstilling") != null) { $("#qstilling").attr("value", decodeURI(jQuery.url.param("qstilling").replace(/\+/g, " "))); }
if (jQuery.url.param("qindtaegten") != null) { $("#qindtaegten").attr("value", decodeURI(jQuery.url.param("qindtaegten").replace(/\+/g, " "))); }
if (jQuery.url.param("qskattebeloeb") != null) { $("#qskattebeloeb").attr("value", decodeURI(jQuery.url.param("qskattebeloeb").replace(/\+/g, " "))); }
if (jQuery.url.param("qsupplerendeadresseoplysninger") != null) { $("#qsupplerendeadresseoplysninger").attr("value", decodeURI(jQuery.url.param("qsupplerendeadresseoplysninger").replace(/\+/g, " "))); }
if (jQuery.url.param("qbemaerkninger") != null) { $("#qbemaerkninger").attr("value", decodeURI(jQuery.url.param("qbemaerkninger").replace(/\+/g, " "))); }

// (Strandinger)
if (jQuery.url.param("qTidspunktDato") != null) { $("#qTidspunktDato").attr("value", decodeURI(jQuery.url.param("qTidspunktDato").replace(/\+/g, " "))); }
if (jQuery.url.param("qAarsag") != null) { $("#qAarsag").attr("value", decodeURI(jQuery.url.param("qAarsag").replace(/\+/g, " "))); }
if (jQuery.url.param("qRedningsstation") != null) { $("#qRedningsstation").attr("value", decodeURI(jQuery.url.param("qRedningsstation").replace(/\+/g, " "))); }

// (Sydvestjyske Fiskekuttere)
if (jQuery.url.param("qRegnr") != null) { $("#qRegnr").attr("value", decodeURI(jQuery.url.param("qRegnr").replace(/\+/g, " "))); }
if (jQuery.url.param("qNavn") != null) { $("#qNavn").attr("value", decodeURI(jQuery.url.param("qNavn").replace(/\+/g, " "))); }
if (jQuery.url.param("qNettotonage") != null) { $("#qNettotonage").attr("value", decodeURI(jQuery.url.param("qNettotonage").replace(/\+/g, " "))); }
if (jQuery.url.param("qBruttotonnage") != null) { $("#qBruttotonnage").attr("value", decodeURI(jQuery.url.param("qBruttotonnage").replace(/\+/g, " "))); }
if (jQuery.url.param("qEjerensNavn") != null) { $("#qEjerensnavn").attr("value", decodeURI(jQuery.url.param("qEjerensnavn").replace(/\+/g, " "))); }
if (jQuery.url.param("qEjerensbopaal") != null) { $("#qEjerensbopaal").attr("value", decodeURI(jQuery.url.param("qEjerensbopaal").replace(/\+/g, " "))); }

// (Søulykker)
if (jQuery.url.param("qsoeforhoer") != null) { $("#qsoeforhoer").attr("value", decodeURI(jQuery.url.param("qsoeforhoer").replace(/\+/g, " "))); }
if (jQuery.url.param("qsoeforklaring") != null) { $("#qsoeforklaring").attr("value", decodeURI(jQuery.url.param("qsoeforklaring").replace(/\+/g, " "))); }
if (jQuery.url.param("qskibsnavn") != null) { $("#qskibsnavn").attr("value", decodeURI(jQuery.url.param("qskibsnavn").replace(/\+/g, " "))); }
if (jQuery.url.param("qskibstype") != null) { $("#qskibstype").attr("value", decodeURI(jQuery.url.param("qskibstype").replace(/\+/g, " "))); }
if (jQuery.url.param("qhjemsted") != null) { $("#qhjemsted").attr("value", decodeURI(jQuery.url.param("qhjemsted").replace(/\+/g, " "))); }
if (jQuery.url.param("qskibsaar") != null) { $("#qskibsaar").attr("value", decodeURI(jQuery.url.param("qskibsaar").replace(/\+/g, " "))); }
if (jQuery.url.param("qmateriale") != null) { $("#qmateriale").attr("value", decodeURI(jQuery.url.param("qmateriale").replace(/\+/g, " "))); }
if (jQuery.url.param("qbrutto") != null) { $("#qbrutto").attr("value", decodeURI(jQuery.url.param("qbrutto").replace(/\+/g, " "))); }
if (jQuery.url.param("qbestemmelsessted") != null) { $("#qbestemmelsessted").attr("value", decodeURI(jQuery.url.param("qbestemmelsessted").replace(/\+/g, " "))); }
if (jQuery.url.param("qomkomneantal") != null) { $("#qomkomneantal").attr("value", decodeURI(jQuery.url.param("qomkomneantal").replace(/\+/g, " "))); }
if (jQuery.url.param("qomkomnenavne") != null) { $("#qomkomnenavne").attr("value", decodeURI(jQuery.url.param("qomkomnenavne").replace(/\+/g, " "))); }
if (jQuery.url.param("qulykkessted") != null) { $("#qulykkessted").attr("value", decodeURI(jQuery.url.param("qulykkessted").replace(/\+/g, " "))); }
if (jQuery.url.param("qulykkesdato") != null) { $("#qulykkesdato").attr("value", decodeURI(jQuery.url.param("qulykkesdato").replace(/\+/g, " "))); }
if (jQuery.url.param("qulykkensart") != null) { $("#qulykkensart").attr("value", decodeURI(jQuery.url.param("qulykkensart").replace(/\+/g, " "))); }
if (jQuery.url.param("qomstaendigheder") != null) { $("#qomstaendigheder").attr("value", decodeURI(jQuery.url.param("qomstaendigheder").replace(/\+/g, " "))); }

// (Vores Kvarter)
if (jQuery.url.param("qArkitekt") != null) { $("#qArkitekt").attr("value", decodeURI(jQuery.url.param("qArkitekt").replace(/\+/g, " "))); }
if (jQuery.url.param("qBygningshistorie") != null) { $("#qBygningshistorie").attr("value", decodeURI(jQuery.url.param("qBygningshistorie").replace(/\+/g, " "))); }
if (jQuery.url.param("qForhusopfort") != null) { $("#qForhusopfort").attr("value", decodeURI(jQuery.url.param("qForhusopfort").replace(/\+/g, " "))); }

});

function submitForm() {
//getting time
var currentTime = new Date()
var today = currentTime.getDate() + "-" + (currentTime.getMonth() + 1) + "-" + currentTime.getFullYear()
var oldDate = "01-01-1200";
//Urls, hvilke konsekvenser får det at vi ikke har de andre database URLs med her ?
var normalUrl = "http://eba.esbjergkommune.dk/Esbjergs%20historie/Lokal politik/Esbjerg Byrådsprotokoller/basis%20s%C3%B8g.aspx";
var timeUrl = "http://eba.esbjergkommune.dk/Esbjergs%20historie/Lokal politik/Esbjerg Byrådsprotokoller/basis%20s%C3%B8g%28m.%20Alder%29.aspx"
//Length of urls 
var qStartLength = $("#qStart").val().length;
var qEndLength = $("#qEnd").val().length;
//checks and inputting data 
if (qStartLength == 4) {
$("#qStart").attr("value", "01-01-" + $("#qStart").val());
}
if (qEndLength == 4) {
$("#qEnd").attr("value", "01-01-" + $("#qEnd").val());
}
if (qStartLength == 0 && qEndLength == 0) {
$("#formSimpleSearch").attr("action", normalUrl);
}
if (qStartLength != 0 && qEndLength == 0) {
$("#qEnd").attr("value", today);
$("#formSimpleSearch").attr("action", timeUrl);
}
if (qStartLength == 0 && qEndLength != 0) {
$("#qStart").attr("value", oldDate);
$("#formSimpleSearch").attr("action", timeUrl);
}
//if both boxes contains a value
if (qStartLength != 0 && qEndLength != 0) {
$("#formSimpleSearch").attr("action", timeUrl);
}
$("#formSimpleSearch").submit();
}

function submitFormEx(normalUrl, timeUrl) {
//getting time
var currentTime = new Date()
var today = currentTime.getDate() + "-" + (currentTime.getMonth() + 1) + "-" + currentTime.getFullYear()
var oldDate = "01-01-1200";
//Length of urls 
var qStartLength = $("#qStart").val().length;
var qEndLength = $("#qEnd").val().length;
//checks and inputting data 
if (qStartLength == 4) {
$("#qStart").attr("value", "01-01-" + $("#qStart").val());
}
if (qEndLength == 4) {
$("#qEnd").attr("value", "01-01-" + $("#qEnd").val());
}
if (qStartLength == 0 && qEndLength == 0) {
$("#formSimpleSearch").attr("action", normalUrl);
}
if (qStartLength != 0 && qEndLength == 0) {
$("#qEnd").attr("value", today);
$("#formSimpleSearch").attr("action", timeUrl);
}
if (qStartLength == 0 && qEndLength != 0) {
$("#qStart").attr("value", oldDate);
$("#formSimpleSearch").attr("action", timeUrl);
}
//if both boxes contains a value
if (qStartLength != 0 && qEndLength != 0) {
$("#formSimpleSearch").attr("action", timeUrl);
}
$("#formSimpleSearch").submit();
}
