var control_querystring_prefix="TL";var txt_search="Sök";var txt_in_skane="i hela Skåne";var txt_search_word="Eget sökord";var param_languageid="sv";var global_date_format="yyyy-MM-dd";
var global_date_separator="-";
var global_timeformat="TT:MM";var txt_close_window="Stäng fönster ";
var txt_image_number="Bild nr ";
var txt_previous_image="Föregående bild ";
var txt_next_image="Nästa bild ";
var txt_eventform_writecodehere="Skriv koden här";var txt_eventform_yourphone="Ditt telefonnummer";var txt_eventform_youremail="Din e-postadress";var txt_eventform_yourname="Ditt namn";var txt_eventform_priceexample="Pris i kronor. Ex: 150";var txt_eventform_choosepriceType="Välj pristyp";var txt_eventform_chooseCategory="Typ av evenemang";var txt_eventform_to="Till";var txt_eventform_from="Från";var txt_eventform_place="Ställe där evenemanget äger rum";var txt_eventform_text2="Beskrivning av evenemang, max. 1000 tecken.";var txt_eventform_text="Text";var txt_eventform_address="Adress";var txt_eventform_zipcode="Postnummer";var txt_eventform_productname="Namn på evenemang";var txt_eventform_wrong_date="Datumet är fel";var txt_eventform_wrong_time="Klockslaget är fel ifyllt";var txt_eventform_no_days_checked="Inga dagar är ikryssade";var txt_eventform_warning_nopricecategory="Ingen pristyp är vald";var txt_eventform_warning_price="Priset är fel ifyllt";var txt_eventform_choosedate="Välj datum";var txt_eventform_place="Ställe där evenemanget äger rum";var txt_eventform_please="Vänligen";var txt_eventform_please_fillout="Vänligen fyll i";var txt_eventform_antispam="Vänligen skriv anti-spamkoden du ser nedan";var txt_eventform_name="Fullständigt namn på evenemanget";var txt_eventform_dateperiod="Datumperiod";var txt_eventform_daybyday="Enstaka tillfällen";var tellUsEFtypeofdatereg="1";var dpu1=new Array();dpu1[0]="Söndag";dpu1[1]="Måndag";dpu1[2]="Tisdag";dpu1[3]="Onsdag";dpu1[4]="Torsdag";dpu1[5]="Fredag";dpu1[6]="Lördag";
var dpmm1=new Array();dpmm1[0]="januari";dpmm1[1]="februari";dpmm1[2]="mars";dpmm1[3]="april";dpmm1[4]="maj";dpmm1[5]="juni";dpmm1[6]="juli";dpmm1[7]="augusti";dpmm1[8]="september";dpmm1[9]="oktober";dpmm1[10]="november";dpmm1[11]="december";var param_text=" ";
﻿
function isElementOfClass(DOMNode,sClass){
	var a=getClassName(DOMNode);
	var b=a.split(" ");
	for(var i=b.length-1; i>=0; i--)if(b[i]==sClass)return(true);
	return(false);
}

function getClassName(DOMNode) {
	var c="";
	try{
		if(DOMNode.getAttribute("class")!=null)c=DOMNode.getAttribute("class");
		if(c==""){
			c=DOMNode.className;
		}
		return(c);
	}catch (e){
		return(c);
	}
}

function setClassName(DOMNode, className) {
	try{
		if(DOMNode.className){
			DOMNode.className=className;
		}else{
			DOMNode.setAttribute("class",className);
		}
	}catch (e){
	}
}

String.prototype.split=function(d){
	var a=[];var b=-1;var i=this.indexOf(d);
	while(i >= 0){a[a.length]=this.substring(b+1,i);b=i;i=this.indexOf(d,i+1);}a[a.length]=this.substring(b+1,this.length);
	return(a);
}

String.prototype.trim=function(){
	try{
		var a=this;	if(a.length==0)return(a);
		while(a.charAt(0)==" ")a=a.substring(1,this.length);
		while(a.charAt(a.length-1)==" ")a=a.substring(0,a.length-1);
		return(a);
	}catch(e){return(this);}
	return(this);
}

function Request(){
	this.cookies=[];
	var a=location.search;
	var b=a.substring(1,a.length).split("&");
	for(var i=0;i<b.length;i++)this[unescape(b[i].split("=")[0])]=unescape(b[i].split("=")[1]);
	var c=window.top.document.cookie;var d=c.split(";");
	for(var i=d.length-1;i>=0;i--){var e=d[i].split("=");var k=unescape(e[0]).trim();var v=unescape(e[1]).trim();this.cookies[k]=v;}
	a=null;b=null;c=null;d=null;e=null;k=null;v=null;
}Request.prototype=new Array();
try{Request.prototype.constructor=Request;}catch(e){}    
﻿
function changeDynamicSearchLink() {
	var dl = document.getElementById("dynamiclink");
	var cat = document.getElementById(control_querystring_prefix + "cat");
	if (cat) {
		if(cat.style.display != "none"){
			var id = cat.options[cat.selectedIndex].value;
			var text = cat.options[cat.selectedIndex].text;
			if (dl) {
				if (text.indexOf("- ") > -1) {
					text = text.substring(text.indexOf(" "));
				}
				dl.href = "http://www.skane.com/cmarter/cmarter.asp?doc=2381&id=" + id;
				var newtext = txt_search + " " + text + " " + txt_in_skane + " »";
				dl.innerHTML = newtext;
			}
		}
	}
}

//TODO: fikse denne til å håndtere rett ord: skal ikke hoppe tilbake til "tull" når tull fjernes fra søkeboksen.... skal gi korrekt ledertekst.
var oldWord = "";
function handleTextFieldClick() {
	oldWord = this.value;
	this.value = "";
}
function handleTextFieldBlur() {
	if (this.value != param_text && this.value != "") {}
	else {
		this.value = ''; //txt_search_word
	}
}

function checkFreeText() {
	var a = document.getElementById("searchForm");
	if (!a) {
		a = document.getElementById("konferensForm");
	}
	if (!a) {
		a = document.getElementById("eventSearchForm");
	}
	if (a) {
		var b = document.getElementById(control_querystring_prefix + "t");
		if (b.value.indexOf(txt_search_word) > -1) {
			b.value = "";
		}
	}
}
function checkForm() {
	checkFreeText();
	if (document.getElementById("konferensForm")) {
		var a = document.getElementById("haveaccom");
		if (!a.checked) {
			var b = document.getElementById(control_querystring_prefix + "cat");
			b.disabled=true;
		}
	}
}

function submitLLForm() {
	var h = document.getElementById("TellusListLimit");
	if(h)if(h.nodeName.toLowerCase()=="form"){h.submit();return(null);}
	if(document.forms.length == 1)document.forms[0].submit();
}

function submitSOForm() {
	var h = document.getElementById("TellusSort");
	if(h)if(h.nodeName.toLowerCase()=="form"){h.submit();return(null);}
	if(document.forms.length == 1)document.forms[0].submit();
}

function openCalendar() {
	pickDate(this);
}

function reset(){
	var a = document.getElementById("noaccom");
	var b = document.getElementById(control_querystring_prefix + "cat");
	var c = document.getElementById("konferensForm");
	var d = document.getElementById(control_querystring_prefix + "t");
	if(a)a.checked=true;
	if(b){
		b.style.display="none";
		b.value="1_655";
	}
	if(c){
		for (var i=0; i < c.TLf.length; i++){
			if (c.TLf[i].checked){
				c.TLf[i].checked = false;
			}
		}		
	}
	if(d)d.value=''; //txt_search_word
}

function test(){
}﻿
function toggleCategoryList() {
	var a = document.getElementById(control_querystring_prefix + "cat");
	if(a){
		var b = document.getElementById("haveaccom");
		if(b){
			if (a.style) {
				a.style.display=(b.checked)?"block":"none";
				if(this.id=="reset")a.style.display="none";
			}
		}
	}
}﻿
function navigateToProduct() {

	if (this.lastChild) {
		if (this.lastChild.lastChild) {
			if (this.lastChild.lastChild.lastChild) {
				var a = this.lastChild.lastChild.lastChild;
				if (isElementOfClass(a, "link")) {
					window.location.href = a.href;
				}
			}
		}
	}
	
}
﻿
var global_active_image=1;
var global_number_of_images=0;
var global_images=[];
function imageGallery(){
	var imageClass=getClassName(this);
	var imageClassSplit=imageClass.split("_");
	var imgNr=imageClassSplit[1];
	var numberOfImages=imageClassSplit[2];

	var b=document.getElementById("image"+global_active_image);
	if(b)b.style.display="none";
	var a=document.getElementById('link'+global_active_image);
	if(a){
		a.style.color="#000";
		a.style.fontSize="x-small";
	}
	if(imgNr==0){//venstre
		if(global_active_image>1)global_active_image--;
	}else if(imgNr==-1){//høyre
		if(global_active_image<numberOfImages)global_active_image++;
	}else{//tall
		global_active_image=imgNr;
	}
	var c="";
	var ul=document.getElementById("imagesGallery");
	var listeElement="";
	var lenke="";
	var image="";
	if(ul){
		while(ul.hasChildNodes()){
			ul.removeChild(ul.lastChild);
		}
		if((global_active_image>3)||(global_active_image<(numberOfImages-2))){
			listeElement=document.createElement("li");
			lenke = document.createElement("a");
			lenke.setAttribute("title",txt_previous_image);
			lenke.id="link0";
			setClassName(lenke,"galleryImage meta_0_"+numberOfImages);
			lenke.innerHTML="&lt;&lt;";
			lenke.onclick=imageGallery;
			listeElement.appendChild(lenke);
			document.getElementById("imagesGallery").appendChild(listeElement);

			var d=(parseInt(global_active_image)-2);
			var e=(parseInt(global_active_image)+2);
			if(d<=0){
				d=1;
				e=5;
			}
			if(e>=numberOfImages){
				d=parseInt(numberOfImages)-4;
				e=numberOfImages;
			}
			if(d<=0)d=1;
			for(var i=d;i<=e;i++){
				listeElement=document.createElement("li");
				listeElement.id="list"+i;
				listeElement.setAttribute("class","listNumbers");
				listeElement.style.lineHeight="20px";

				lenke = document.createElement("a");
				lenke.setAttribute("title",txt_image_number + " " + i);
				lenke.id="link"+i;
				setClassName(lenke,"galleryImage viewImage meta_"+i+"_"+numberOfImages);
				lenke.innerHTML=i;
				lenke.onclick=imageGallery;
				lenke.onmouseover=viewImage;
				listeElement.appendChild(lenke);
				
				image=document.createElement("img");
				image.setAttribute("src",global_images[i].src);
				image.setAttribute("alt",global_images[i].alt);
				image.id="image"+i;
				setClassName(image,"gallery");
			
				
				listeElement.appendChild(image);
				document.getElementById("imagesGallery").appendChild(listeElement);
			}
			listeElement=document.createElement("li");
			lenke = document.createElement("a");
			lenke.setAttribute("title",txt_next_image);
			lenke.id="link-1";
			setClassName(lenke,"galleryImage meta_-1_"+numberOfImages);
			lenke.innerHTML="&gt;&gt;";
			lenke.onclick=imageGallery;
			listeElement.appendChild(lenke);
			document.getElementById("imagesGallery").appendChild(listeElement);
//alert(ul.innerHTML);
		}else{
			listeElement=document.createElement("li");
			lenke = document.createElement("a");
			lenke.setAttribute("title",txt_previous_image);
			lenke.id="link0";
			setClassName(lenke,"galleryImage meta_0_"+numberOfImages);
			lenke.innerHTML="&lt;&lt;";
			lenke.onclick=imageGallery;
			listeElement.appendChild(lenke);
			document.getElementById("imagesGallery").appendChild(listeElement);

			var d=(parseInt(global_active_image)-2);
			var e=(numberOfImages);
			if(d<=0)d=1;
			for(var i=d;i<=e;i++){
				listeElement=document.createElement("li");
				listeElement.id="list"+i;
				setClassName(listeElement,"listNumbers");
				listeElement.style.lineHeight="20px";

				lenke = document.createElement("a");
				lenke.setAttribute("title",txt_image_number + " " + i);
				lenke.id="link"+i;
				setClassName(lenke,"galleryImage galleryLink meta_"+i+"_"+numberOfImages);
				lenke.innerHTML=i;
				lenke.onclick=imageGallery;
				lenke.onmouseover=viewImage;
				listeElement.appendChild(lenke);
				
				image=document.createElement("img");
				image.setAttribute("src",global_images[i].src);
				image.setAttribute("alt",global_images[i].alt);
				image.id="image"+i;
				setClassName(image,"gallery");
				listeElement.appendChild(image);
				document.getElementById("imagesGallery").appendChild(listeElement);
			}
			listeElement=document.createElement("li");
			lenke = document.createElement("a");
			lenke.setAttribute("title",txt_next_image);
			lenke.id="link-1";
			setClassName(lenke,"galleryImage meta_-1_"+numberOfImages);
			lenke.innerHTML="&gt;&gt;";
			lenke.onclick=imageGallery;
			listeElement.appendChild(lenke);
			document.getElementById("imagesGallery").appendChild(listeElement);
		}
	}
	b=document.getElementById("image"+global_active_image);

	var h=document.getElementsByTagName("img");
	if(h){
		for(var i=h.length-1;i >= 0;i--){
			var v=h[i];
			if(isElementOfClass(v,"gallery")){
				v.style.display="none";
			}
		}
	}

	if(b){
		b.style.display="block";
		if (navigator.appName.indexOf("Microsoft") != -1){
			b.style.zIndex="80"+global_active_image;
		}
	}
	a = document.getElementById('link'+global_active_image);
	if(a){
		a.style.color="#980F05";
		a.style.fontSize="small";
	}
}

var c=1000;
function viewImage(){
	var h=document.getElementsByTagName("img");
	if(h){
		for(var i=h.length-1;i >= 0;i--){
			var v=h[i];
			if(isElementOfClass(v,"gallery")){
				v.style.display="none";
			}
		}
	}

	var imageClass=getClassName(this);
	var imageClassSplit=imageClass.split("_");
	var imgNr=imageClassSplit[1];
	var numberOfImages=imageClassSplit[2];
	var a=document.getElementById("image"+imgNr);
	if(a){
		c=c+1;
		a.style.display="block";
		a.style.zIndex=c;
	}
}﻿
function load() {
  if (GBrowserIsCompatible()) {
	var lat=document.getElementById("latitude");
	var lng=document.getElementById("longitude");
	if(lat)lat=lat.value;
	if(lat)lng=lng.value;
	if(lat && lng) {
		var map = new GMap2(document.getElementById("map"));
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		var koordinater = new GLatLng(lat,lng);
		var icon = new GIcon();
		icon.image = "http://www.tellus.angelholm.se/images/map_icon.gif";
		icon.shadow = "http://www.tellus.angelholm.se/images/images/map_icon.gif";
		icon.iconSize = new GSize(26,24);
		icon.shadowSize = new GSize(0, 0);
		icon.iconAnchor = new GPoint(13,12);
		icon.infoWindowAnchor = new GPoint(0, 0);
		icon.infoShadowAnchor = new GPoint(0, 0);
		map.setCenter(new GLatLng(lat, lng), 11);
		map.addOverlay(new GMarker(koordinater,icon));
//		map.addOverlay(new GMarker(koordinater));
	}
  }
}﻿Date.prototype.parseExact = function(dateString) {
	if (dateString.length != global_date_format.length)
	{ return (false); }
	var a = dateString.split(global_date_separator);
	if (a.length != 3) { return (false); }
	var b = global_date_format.split(global_date_separator);
	if (a[0].indexOf("0") == 0) a[0] = a[0].substring(1, 2);
	if (a[1].indexOf("0") == 0) a[1] = a[1].substring(1, 2);
	if (a[2].indexOf("0") == 0) a[2] = a[2].substring(1, 2);
	var c = 0;
	for (var i = 0; i < 3; i++) {
		switch (b[i]) {
			case "dd": c = parseInt(a[i]); if (c > 31) return (false); this.setDate(c); break;
			case "MM": c = parseInt(a[i]); if (c > 12) return (false); this.setMonth(c - 1); break;
			case "yyyy": if (a[i].length != 4) return (false); c = parseInt(a[i]); if (c > 3000) return (false); if (c < 1753) return (false); this.setYear(c); break;
			default: return (false); break;
		}
	}
	return (true);
}


var dp_timer = null;
var dp_container = null;
var dp_yy_container = null;
var dp_mm_container = null;
function showYear() {
	if (!(dp_yy_container)) dp_yy_container = document.getElementById("dpyy");
	dp_yy_container.innerHTML = global_yy;
} 

function showMonth() { try { if (!(dp_mm_container)) dp_mm_container = document.getElementById("dpmm"); dp_mm_container.innerHTML = dpmm[global_mm]; } catch (e) { errorHandler(e, this, arguments); } }
function addYear(yy) { try { global_yy += yy; showYear(); updateDatePicker(); } catch (e) { errorHandler(e, this, arguments); } }
function addMonth(mm) { try { global_mm += mm; if (global_mm == -1) { global_mm = 11; global_yy--; showYear(); } if (global_mm == 12) { global_mm = 0; global_yy++; showYear(); } showMonth(); updateDatePicker(); } catch (e) { errorHandler(e, this, arguments); } }
function updateDatePicker() {
	if (!(dp_container)) dp_container = document.getElementById("dpcontent");
	dpd.setYear(global_yy); dpd.setMonth(global_mm); dpd.setDate(1);
	var a = dpd.getDay(), b = global_mm, d = global_mm, o = "";
	if (a != 1) {
		if (a == 0) a = 7; for (var i = a; i > 1; i--) dpd.setDate(dpd.getDate() - 1); d = dpd.getMonth();
		while ((d < b) | (b == 0 & d == 11)) { o += "<p class=\"datepicker\">" + dpd.getDate() + "</p>"; dpd.setDate(dpd.getDate() + 1); d = dpd.getMonth(); }
	}
	while (d == b) { var l = dpd.getDate(); o += "<a href=\"#\" class=\"datepicker\" onclick=\"chooseDate(" + l + "," + (global_mm + 1) + "," + global_yy + ");return(false);\">" + l + "</a>"; dpd.setDate(l + 1); d = dpd.getMonth(); }
	a = dpd.getDay();
	if (a != 1) { if (a == 0) a = 7; for (var i = 7 - a; i >= 0; i--) { o += "<p class=\"datepicker\">" + dpd.getDate() + "</p>"; dpd.setDate(dpd.getDate() + 1); } }
	dp_container.innerHTML = o;
}


var dp_now = new Date(), dpd = new Date();
var dpmm = dpmm1;
var dpu = dpu1;
var global_yy = dpd.getYear(), global_mm = dpd.getMonth();
if (global_yy < 1000) global_yy += 1900;
var dp_close = "<a href=\"#\" onclick=\"clearDatePicker();\"  class=\"leftbtn\">" + txt_close_window + "</a><br />";
var dp_pn_yy = "<a class=\"prev datepicker\" href=\"#\" onclick=\"addYear(-1);return(false);\">&lt;</a><a class=\"next datepicker\" href=\"#\" onclick=\"addYear(1);return(false);\">&gt;</a>";
var dp_pn_mm = "<a class=\"prev datepicker\" href=\"#\" onclick=\"addMonth(-1);return(false);\">&lt;</a><a class=\"next datepicker\" href=\"#\" onclick=\"addMonth(1);return(false);\">&gt;</a>";
var dp_yy = "<div id=\"dpyy\" class=\"datepicker\">" + global_yy + "</div>";
var dp_mm = "<div id=\"dpmm\" class=\"datepicker\">" + dpmm[global_mm] + "</div>";
var dp_hr = "<div class=\"hr datepicker\"></div>";
var dp_ww = "<p class=\"datepicker\">" + dpu[1].charAt(0) + "</p><p class=\"datepicker\">" + dpu[2].charAt(0) + "</p><p class=\"datepicker\">" + dpu[3].charAt(0) + "</p><p class=\"datepicker\">" + dpu[4].charAt(0) + "</p><p class=\"datepicker\">" + dpu[5].charAt(0) + "</p><p class=\"dph datepicker\">" + dpu[6].charAt(0) + "</p><p class=\"dph datepicker\">" + dpu[0].charAt(0) + "</p>";
var dp_end = "<span id=\"dpcontent\" class=\"datepicker\"></span>";
var dp_all = dp_close + dp_pn_yy + dp_yy + dp_pn_mm + dp_mm + dp_hr + dp_ww + dp_end;
var global_date_target = null;
function pickDate(target) {
	global_date_target = target.id;
	var yyyy = "";
	var MM = "";
	var dd = "";
	if (global_date_target == "calendarfd") {
		yyyy = document.getElementById("fdy").value;
		MM = document.getElementById("fdm").value;
		if (parseInt(MM) < 10) {
			MM = "0" + MM;
		}
		dd = document.getElementById("fdd").value;
		if (parseInt(dd) < 10) {
			dd = "0" + dd;
		}
	}
	if (global_date_target == "calendartd") {
		yyyy = document.getElementById("tdy").value;
		MM = document.getElementById("tdm").value;
		if (parseInt(MM) < 10) {
			MM = "0" + MM;
		}
		dd = document.getElementById("tdd").value;
		if (parseInt(dd) < 10) {
			dd = "0" + dd;
		}
	}
	var tmpValue = yyyy + "-" + MM + "-" + dd;
	showDatePicker(tmpValue);
	return (false);
} 

var global_datepicker = null;
function showDatePicker(date) {
	if (!(global_datepicker)) global_datepicker = document.getElementById("datepicker");
	a = global_datepicker;
	if (!(a)) {
		global_datepicker = document.createElement("div");
		global_datepicker.setAttribute("id", "datepicker");
		global_datepicker.style.height = "auto";
		if (global_datepicker.className) { global_datepicker.className = "datepicker"; } else { global_datepicker.setAttribute("class", "datepicker"); }
		global_datepicker.innerHTML = dp_all;
		document.getElementsByTagName("body")[0].appendChild(global_datepicker);
	}
	a = global_datepicker;
	dpd = new Date();
	global_yy = dpd.getYear();
	global_mm = dpd.getMonth();
	if (dpd.parseExact(date)) {
		global_yy = dpd.getFullYear();
		global_mm = dpd.getMonth();
	}
	showYear();
	showMonth();
	updateDatePicker();
	a.style.display = "block";
	a.style.position = "absolute";
	a.style.left = (event.clientX +0) + "px";
	a.style.top = (event.clientY + 20) + "px";
	return (false);
}

function chooseDate(dd, mm, yyyy) {
	var d = new Date(yyyy, parseInt(mm) - 1, dd, 0, 0, 0, 0);
	var yyyy = "";
	var MM = "";
	var dd = "";
	if (global_date_target == "calendarfd") {
		document.getElementById("fdy").value = d.getFullYear();
		document.getElementById("fdm").value = d.getMonth()+1;
		document.getElementById("fdd").value = d.getDate();
		if(document.getElementById("tdy")){
			document.getElementById("tdy").value = d.getFullYear();
		}
		if(document.getElementById("tdm")){
			document.getElementById("tdm").value = d.getMonth()+1;
		}
		if(document.getElementById("tdd")){
			document.getElementById("tdd").value = d.getDate();
		}
	}
	if (global_date_target == "calendartd") {
		document.getElementById("tdy").value = d.getFullYear();
		document.getElementById("tdm").value = d.getMonth()+1;
		document.getElementById("tdd").value = d.getDate();
	}

	if (!(global_datepicker)) global_datepicker = document.getElementById("datepicker");
	if (global_datepicker) global_datepicker.style.display = "none";
} 


function handleChangeDate() {
	if (this.value > "") {
			var d = getDate(this.value);
			if (d != null) {
				global_date_target = this;
				chooseDate(d.getDate(), d.getMonth() + 1, d.getFullYear());
			}
		}

	} 

function clearLayers() {
	if (!isElementOfClass(event.srcElement, "datepicker")) clearDatePicker();
} 


function clearDatePicker() {
		if (!(global_datepicker)) global_datepicker = document.getElementById("datepicker");
		if (global_datepicker) global_datepicker.style.display = "none";
} 
﻿function changeToDate(){
	var a = document.forms["eventSearchForm"];
	if(a){
		var fromDateDay = document.forms["eventSearchForm"].fdd.value;
		var fromDateMonth = (document.forms["eventSearchForm"].fdm.value-1);
		var fromDateYear = document.forms["eventSearchForm"].fdy.value;
		var fromDate = new Date(fromDateYear,fromDateMonth,fromDateDay);
		var ToDayDate = new Date();
		ToDayDate.setDate(ToDayDate.getDate()-1);
		ToDayDate.setHours(23);
		ToDayDate.setMinutes(59);
		ToDayDate.setSeconds(59);
		if(fromDate < ToDayDate){
		}else{
			var tmpToDate = fromDate.getTime();
			tmpToDate = tmpToDate+60*60*1000;
			var newToDate = new Date(tmpToDate);
			var newToDateDay = newToDate.getDate();
			var newToDateMonth = newToDate.getMonth()+1;
			var newToDateYear = newToDate.getFullYear();
			document.forms["eventSearchForm"].tdd.value = newToDateDay;
			document.forms["eventSearchForm"].tdm.value = newToDateMonth;
			document.forms["eventSearchForm"].tdy.value = newToDateYear;
		}
	}
}
﻿var dp_timer = null;
var dp_container = null;
var dp_yy_container = null;
var dp_mm_container = null;
function showYear() {
	dp_yy_container = document.getElementById("dpyy"); //if (!(dp_yy_container))
	dp_yy_container.innerHTML = global_yy;
}
function showMonth() { try { if (!(dp_mm_container)) dp_mm_container = document.getElementById("dpmm"); dp_mm_container.innerHTML = dpmm[global_mm]; } catch (e) { errorHandler(e, this, arguments); } }
function addYear(yy) { try { global_yy += yy; showYear(); updateDatePicker(); } catch (e) { errorHandler(e, this, arguments); } }
function addMonth(mm) { try { global_mm += mm; if (global_mm == -1) { global_mm = 11; global_yy--; showYear(); } if (global_mm == 12) { global_mm = 0; global_yy++; showYear(); } showMonth(); updateDatePicker(); } catch (e) { errorHandler(e, this, arguments); } }
function updateDatePicker() {
	if (!(dp_container)) dp_container = document.getElementById("dpcontent");
	dpd.setFullYear(global_yy); dpd.setMonth(global_mm); dpd.setDate(1);
	var a = dpd.getDay(), b = global_mm, d = global_mm, o = "";
	if (a != 1) {
		if (a == 0) a = 7; for (var i = a; i > 1; i--) dpd.setDate(dpd.getDate() - 1); d = dpd.getMonth();
		while ((d < b) | (b == 0 & d == 11)) { o += "<p class=\"datepicker\">" + dpd.getDate() + "</p>"; dpd.setDate(dpd.getDate() + 1); d = dpd.getMonth(); }
	}
	while (d == b) { var l = dpd.getDate(); o += "<a href=\"#\" class=\"datepicker\" onclick=\"chooseDate(" + l + "," + (global_mm + 1) + "," + global_yy + ");return(false);\">" + l + "</a>"; dpd.setDate(l + 1); d = dpd.getMonth(); }
	a = dpd.getDay();
	if (a != 1) { if (a == 0) a = 7; for (var i = 7 - a; i >= 0; i--) { o += "<p class=\"datepicker\">" + dpd.getDate() + "</p>"; dpd.setDate(dpd.getDate() + 1); } }
	dp_container.innerHTML = o;
}

var dp_now = new Date(), dpd = new Date();
var dpmm = dpmm1;
var dpu = dpu1;
var global_yy = dpd.getFullYear(), global_mm = dpd.getMonth();
if (global_yy < 1000) global_yy += 1900;

var dp_head = "<a class=\"close datepicker\" href=\"#\" onclick=\"closeCalendar();return(false);\">X</a><br />";
var dp_pn_yy = "<a class=\"prev datepicker\" href=\"#\" onclick=\"addYear(-1);return(false);\">&lt;</a><a class=\"next datepicker\" href=\"#\" onclick=\"addYear(1);return(false);\">&gt;</a>";
var dp_pn_mm = "<a class=\"prev datepicker\" href=\"#\" onclick=\"addMonth(-1);return(false);\">&lt;</a><a class=\"next datepicker\" href=\"#\" onclick=\"addMonth(1);return(false);\">&gt;</a>";
var dp_yy = "<div id=\"dpyy\" class=\"datepicker\">" + global_yy + "</div>";
var dp_mm = "<div id=\"dpmm\" class=\"datepicker\">" + dpmm[global_mm] + "</div>";
var dp_hr = "<div class=\"hr datepicker\"></div>";
var dp_ww = "<p class=\"datepicker\">" + dpu[1].charAt(0) + "</p><p class=\"datepicker\">" + dpu[2].charAt(0) + "</p><p class=\"datepicker\">" + dpu[3].charAt(0) + "</p><p class=\"datepicker\">" + dpu[4].charAt(0) + "</p><p class=\"datepicker\">" + dpu[5].charAt(0) + "</p><p class=\"dph datepicker\">" + dpu[6].charAt(0) + "</p><p class=\"dph datepicker\">" + dpu[0].charAt(0) + "</p>";
var dp_end = "<span id=\"dpcontent\" class=\"datepicker\"></span>";
var dp_all = dp_head + dp_pn_yy + dp_yy + dp_pn_mm + dp_mm + dp_hr + dp_ww + dp_end;

var global_date_target_day = null;
var global_date_target_month = null;
var global_date_target_year = null;

function pickDate(targetId) {
	var target = targetId.split("0");
	global_date_target_year = target[1];
	global_date_target_month = target[2];
	global_date_target_day = target[3];
	showDatePicker();
	return (false);
}

var global_datepicker = null;

function showDatePicker() {
	if (!(global_datepicker)) global_datepicker = document.getElementById("datepicker");
	a = global_datepicker;
	if (!(a)) {
		global_datepicker = document.createElement("div");
		global_datepicker.setAttribute("id", "datepicker");
		global_datepicker.style.height = "auto";
		if (global_datepicker.className) { global_datepicker.className = "datepicker"; } else { global_datepicker.setAttribute("class", "datepicker"); }
		global_datepicker.innerHTML = dp_all;
		document.getElementsByTagName("body")[0].appendChild(global_datepicker);
	}
	a = global_datepicker;
	dpd = new Date();
	global_yy = dpd.getFullYear();
	global_mm = dpd.getMonth();
	showYear();
	showMonth();
	updateDatePicker();
	a.style.display = "block";
	a.style.position = "absolute";
	a.style.left = (event.clientX + 210) + "px";
	a.style.top = (event.clientY-17) + "px";
	return (false);
}

function chooseDate(day, month, year) {
	var a = document.getElementById(global_date_target_day);
	if (a) {
		for (i = 0; i < a.options.length; i++) {
			if (day == a.options[i].text) {
				a.selectedIndex = i;
			}
		}
	}
	a = document.getElementById(global_date_target_month);
	if (a) {
		for (i = 0; i < a.options.length; i++) {
			if (month == a.options[i].text) {
				a.selectedIndex = i;
			}
		}
	}
	a = document.getElementById(global_date_target_year);
	if (a) {
		for (i = 0; i < a.options.length; i++) {
			if (year == a.options[i].text) {
				a.selectedIndex = i;
			}
		}
	}
	closeCalendar();
}

function closeCalendar() {
	if (global_datepicker) {
		global_datepicker.style.display = "none";
	}
}﻿

var typeofdatereg = 1;
if (document.getElementById("typeofdatereg")) {
	typeofdatereg = document.getElementById("typeofdatereg").checked;
}

/*
function attachEvents() {
	var a = document.getElementById("saveProduct");
	if (a) {
		a.onclick = validateForm;
	}
	a = document.getElementById("param_maintext");
	if (a) {
		if (txt_eventform_text2.indexOf(a.value) > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	a = document.getElementById("param_fromtime");
	if (a) {
		if (a.value.indexOf("hh:mm") > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	a = document.getElementById("param_totime");
	if (a) {
		if (a.value.indexOf("hh:mm") > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	a = document.getElementById("param_fromprice");
	if (a) {
		if (txt_eventform_priceexample.indexOf(a.value) > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	a = document.getElementById("param_yourname");
	if (a) {
		if (txt_eventform_yourname.indexOf(a.value) > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	a = document.getElementById("param_youremail");
	if (a) {
		if (txt_eventform_youremail.indexOf(a.value) > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	a = document.getElementById("param_yourphone");
	if (a) {
		if (txt_eventform_yourphone.indexOf(a.value) > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	a = document.getElementById("param_antispam");
	if (a) {
		if (txt_eventform_writecodehere.indexOf(a.value) > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	a = document.getElementById("param_productname");
	if (a) {
		if (txt_eventform_name.indexOf(a.value) > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	var aNodeList = document.getElementsByTagName("a");
	if (aNodeList) {
	//TODO: fix hard coded string in test: will do this for all a-tags!
		for (var i = aNodeList.length; i >= 0; i--) {
			if (aNodeList[i]) {
				
				if (aNodeList[i].id.indexOf("tellUsEFCalendar") > -1) {
					var id = aNodeList[i].id;
					var a = document.getElementById(id);
					a.style.background = "url(images/TellusDatePicker.gif)";
					a.style.backgroundRepeat = "no-repeat";
					a.setAttribute("title", txt_eventform_choosedate + "");
					a.onclick = openCalendar;
				}
			}
		}
	}
	var a = document.getElementById("tellUsEFDateField");
	if (a) {
		// bug in IE, http://msdn.microsoft.com/en-us/library/ms536389.aspx
		var isIE = false;
		if (navigator.userAgent.indexOf('Internet Explorer') > -1 || navigator.userAgent.indexOf("MSIE") > -1) { isIE = true; }

		var input1 = document.createElement("input");
		if(isIE){
			input1 = document.createElement('<input name="typeofdatereg"/>');
		};
		input1.setAttribute("type", "radio");
		input1.setAttribute("name", "typeofdatereg");
		input1.setAttribute("value", "1");
		input1.setAttribute("class", "tellUsEFcheckbox");
		input1.id = "typeofdatereg1";
		input1.onclick = submitForm;

		var input2 = document.createElement("input");
		if(isIE){
			input2 = document.createElement('<input name="typeofdatereg"/>');
		};
		input2.setAttribute("type", "radio");
		input2.name = "typeofdatereg"; //("name", "typeofdatereg");
		input2.setAttribute("value", "2");
		input2.setAttribute("class", "tellUsEFcheckbox");
		input2.id = "typeofdatereg2";
		input2.onclick = submitForm;

		var label1 = document.createElement("label");
		label1.setAttribute("for", "typeofdatereg1");
		label1.setAttribute("class", "tellUsEFdatetypelabel");
		label1.innerHTML = txt_eventform_daybyday;

		var label2 = document.createElement("label");
		label2.setAttribute("for", "typeofdatereg2");
		label2.setAttribute("class", "tellUsEFdatetypelabel");
		label2.innerHTML = txt_eventform_dateperiod;

		var br = document.createElement("br");
		a.appendChild(input1);
		a.appendChild(label1);
		a.appendChild(br);
		a.appendChild(input2);
		a.appendChild(label2);

		if (tellUsEFtypeofdatereg == 1) {
			var b = document.getElementById("typeofdatereg1");
			b.checked = true;
		} else {
			var b = document.getElementById("typeofdatereg2");
			b.checked = true;
		}
	}
}
*/

function submitForm() {
	var currentForm = document.getElementById("tellUsEForm");
	currentForm.submit();
}

function openCalendar() {
	pickDate(this.id);
}

function clearValue() {
	this.value = "";
	this.style.color = "#000000";
	this.onfocus = null;
}

function restoreValue() {
	if (this.value != "") {
		return;
	}
	this.style.color = "#989898";
	if (this.id == "param_maintext") {
		this.value = txt_eventform_text2;
	}
	if (this.id == "param_fromtime") {
		this.value = "hh:mm";
	}
	if (this.id == "param_totime") {
		this.value = "hh:mm";
	}
	if (this.id == "param_fromprice") {
		this.value = txt_eventform_priceexample;
	}
	if (this.id == "param_yourname") {
		this.value = txt_eventform_yourname;
	}
	if (this.id == "param_youremail") {
		this.value = txt_eventform_youremail;
	}
	if (this.id == "param_yourphone") {
		this.value = txt_eventform_yourphone;
	}
	if (this.id == "param_antispam") {
		this.value = txt_eventform_writecodehere;
	}
	if (this.id == "param_productname") {
		this.value = txt_eventform_name;
	}
	this.onfocus = clearValue;
}

function validateForm() {
	var returnValue=true;
	var a = document.getElementById("param_productname");
	if (a) {
		if (a.value == "" || txt_eventform_name.indexOf(a.value) > -1) {
			alert(txt_eventform_please_fillout + " " + txt_eventform_productname.toLowerCase());
			a.focus();
			return (false);
		}
	}
	a = document.getElementById("param_category");
	if (a) {
		if (a.value == "0") {
			alert(txt_eventform_please + " " + txt_eventform_chooseCategory.toLowerCase());
			a.focus();
			return (false);
		}
	}
	a = document.getElementById("param_maintext");
	if (a) {
		if (a.value.length > 1000) {
			alert(txt_eventform_text2);
			a.focus();
			return (false);
		}
	}
	if (tellUsEFtypeofdatereg == 1) { //day by day
		returnValue = validateDayByDaySchedule();
		if (!returnValue) {
			return (false);
		}
	}
	else { //periode
		returnValue = validatePeriodeSchedule();
		if (!returnValue) {
			return (false);
		}
	}
	a = document.getElementById("param_place");
	if (a) {
		if (a.value == "") {
			alert(txt_eventform_please_fillout + " " + txt_eventform_place.toLowerCase());
			a.focus();
			return (false);
		}
	}
	a = document.getElementById("param_address");
	if (a) {
		if (a.value == "") {
			alert(txt_eventform_please_fillout + " " + txt_eventform_address.toLowerCase());
			a.focus();
			return (false);
		}
	}
	a = document.getElementById("param_municipality");
	if (a) {
		if (a.value == "") {
			alert(txt_eventform_please_fillout + " " + txt_eventform_municipality.toLowerCase());
			a.focus();
			return (false);
		}
	}
	returnValue = validatePrice();
	if (!returnValue) {
		return (false);
	}
	a = document.getElementById("param_yourname");
	if (a) {
		if (a.value == "" || txt_eventform_yourname.indexOf(a.value) > -1) {
			alert(txt_eventform_please_fillout + " " + txt_eventform_yourname.toLowerCase());
			a.focus();
			return (false);
		}
	}
	a = document.getElementById("param_youremail");
	if (a) {
		if (a.value == "" || txt_eventform_youremail.indexOf(a.value) > -1) {
			alert(txt_eventform_please_fillout + " " + txt_eventform_youremail.toLowerCase());
			a.focus();
			return (false);
		}
	}
	a = document.getElementById("param_yourphone");
	if (a) {
		if (a.value == "" || txt_eventform_yourphone.indexOf(a.value) > -1) {
			alert(txt_eventform_please_fillout + " " + txt_eventform_yourphone.toLowerCase());
			a.focus();
			return (false);
		}
	}
	a = document.getElementById("param_antispam");
	if (a) {
		if (a.value == "" || txt_eventform_writecodehere.indexOf(a.value) > -1) {
			alert(txt_eventform_antispam);
			a.focus();
			return (false);
		}
	}

	return(returnValue);
}

function validatePrice() {
	for (var i = 0; i < 11; i++) {
		var param_fromprice = "param_fromprice";
		var param_pricecategoryid = "param_pricecategoryid";
		if (i > 0) {
			param_fromprice = param_fromprice + "_" + i;
			param_pricecategoryid = param_pricecategoryid + "_" + i;
		}
		var fromPrice = document.getElementById(param_fromprice);
		var priceCategoryId = document.getElementById(param_pricecategoryid);
		if (fromPrice) {
			if (txt_eventform_priceexample.indexOf(fromPrice.value) == -1 && fromPrice.value != "") {
				if(isNaN(fromPrice.value)){
					alert(txt_eventform_warning_price);
					fromPrice.focus();
					return (false);
				}
				if (priceCategoryId.value == "0") {
					alert(txt_eventform_warning_nopricecategory);
					fromPrice.focus();
					return (false);
				}
			}
		}
	}
	return (true);
}

function validateDayByDaySchedule() {
	for (var i = 10; i > -1; i--) {
		var param_fromdatedayid = "param_fromdateday";
		var param_fromdatemonthid = "param_fromdatemonth";
		var param_fromdateyearid = "param_fromdateyear";
		var param_fromtimeid = "param_fromtime";
		var param_totimeid = "param_totime";
		if (i > 0) {
			param_fromdatedayid = "param_fromdateday_" + i;
			param_fromdatemonthid = "param_fromdatemonth_" + i;
			param_fromdateyearid = "param_fromdateyear_" + i;
			param_fromtimeid = "param_fromtime_" + i;
			param_totimeid = "param_totime_" + i;
		}
		var day = document.getElementById(param_fromdatedayid);
		var month = document.getElementById(param_fromdatemonthid);
		var year = document.getElementById(param_fromdateyearid);
		var fromTime = document.getElementById(param_fromtimeid);
		var toTime = document.getElementById(param_totimeid);
		if (i == 0) {
			if (fromTime) {
				if (document.getElementById("param_fromtime_1") != null && (fromTime.value == "" || fromTime.value.indexOf(global_timeformat) > -1)) {
					return (true);
				}
			}
		}
		if (day && month && year) {
			if (!validateDate(day.value, month.value, year.value, day)) {
				return (false);
			}
		}
		if (fromTime) {
			if (!validateTime(fromTime.value, fromTime)) {
				return (false)
			};
			if (toTime) {// no point to validate toTime if there is no fromDate
				if (toTime.value == "" || toTime.value.indexOf(global_timeformat) > -1) {
					toTime.value = "";
				} else {
					if (!validateTime(toTime.value, toTime)) {
						return (false);
					};
				}
			}
		}
	}
	return (true);
}

function validatePeriodeSchedule() {
	for (var i = 10; i > -1; i--) {
		var param_fromdatedayid = "param_fromdateday";
		var param_fromdatemonthid = "param_fromdatemonth";
		var param_fromdateyearid = "param_fromdateyear";
		var param_fromtimeid = "param_fromtime";
		var param_totimeid = "param_totime";
		var param_mondayid = "param_monday";
		var param_tuesdayid = "param_tuesday";
		var param_wednesdayid = "param_wednesday";
		var param_thursdayid = "param_thursday";
		var param_fridayid = "param_friday";
		var param_saturdayid = "param_saturday";
		var param_sundayid = "param_sunday";
		if (i > 0) {
			param_fromtimeid = "param_fromtime_" + i;
			param_totimeid = "param_totime_" + i;
			param_mondayid = "param_monday_" + i;
			param_tuesdayid = "param_tuesday_" + i;
			param_wednesdayid = "param_wednesday_" + i;
			param_thursdayid = "param_thursday_" + i;
			param_fridayid = "param_friday_" + i;
			param_saturdayid = "param_saturday_" + i;
			param_sundayid = "param_sunday_" + i;
		}
		var day = document.getElementById(param_fromdatedayid);
		var month = document.getElementById(param_fromdatemonthid);
		var year = document.getElementById(param_fromdateyearid);
		var monday = document.getElementById(param_mondayid);
		var tuesday = document.getElementById(param_tuesdayid);
		var wednesday = document.getElementById(param_wednesdayid);
		var thursday = document.getElementById(param_thursdayid);
		var friday = document.getElementById(param_fridayid);
		var saturday = document.getElementById(param_saturdayid);
		var sunday = document.getElementById(param_sundayid);

		var fromTime = document.getElementById(param_fromtimeid);
		if (i == 0) {
			if (fromTime) {
				if (document.getElementById("param_fromtime_1") != null && (fromTime.value == "" || fromTime.value.indexOf(global_timeformat) > -1)){
						return (true);
				}
			}
		}
		if (day && month && year) {
			if (!validateDate(day.value, month.value, year.value, day)) {
				return (false);
			}
		}
		if (fromTime) { // if a fromTime is set, then validate that the days is set too.
			if (!validateTime(fromTime.value, fromTime)) {
				return (false)
			};
			if (!(monday.checked
				|| tuesday.checked
				|| wednesday.checked
				|| thursday.checked
				|| friday.checked
				|| saturday.checked
				|| sunday.checked)
			) {
					alert(txt_eventform_no_days_checked);
					monday.focus();
					return (false);
			}
			var toTime = document.getElementById(param_totimeid); // no point to validate toTime if there is no fromDate
			if (toTime) {
				if (toTime.value == "" || toTime.value.indexOf(global_timeformat) > -1) {
					toTime.value = "";
				} else {
					if (!validateTime(toTime.value, toTime)) {
						return (false);
					};
				}
			}
		}
	}
	return (true);
}

function validateTime(theTime, theObject) {
	if (theTime.indexOf(global_timeformat) > -1) {
		alert(txt_eventform_wrong_time);
		theObject.focus();
		return (false);
	}
	try {
		var tmp = null;
		if (theTime.indexOf(".") > -1) {
			tmp = theTime.split(".");
		}
		else {
			tmp = theTime.split(":");
		}
		if (tmp.length < 2) {
			alert(txt_eventform_wrong_time);
			theObject.focus();
			return (false);
		}

		if (parseInt(tmp[0]) >= 24) {
			alert(txt_eventform_wrong_time);
			theObject.focus();
			return (false);
		}
		if (parseInt(tmp[1]) > 59) {
			alert(txt_eventform_wrong_time);
			theObject.focus();
			return (false);
		}
	} catch (timeException) {
		alert(txt_eventform_wrong_time);
		theObject.focus();
		return (false);
	}
	return (true);
}

function validateDate(day, month, year, theObject) {
	try {
		var myDate = new Date();
		myDate.setFullYear(parseInt(year), parseInt(month) - 1, parseInt(day));
	} catch (exception) {
		alert(txt_eventform_wrong_date);
		theObject.focus();
		return (false);
	}
	return (true);
}
if (window.addEventListener) {
	window.addEventListener("load", attachEvents, false);
} else {
	window.attachEvent("onload", attachEvents);
}
﻿
function attachEvents(){
	var a = document.getElementById("searchForm");
	if (!a) {
		a=document.getElementById("konferensForm");
	}
	if (!a) {
		a = document.getElementById("eventSearchForm");
	}
	if (a) {
    	var b = document.getElementById(control_querystring_prefix + "cat");
        b.onchange=changeDynamicSearchLink;
        b=document.getElementById(control_querystring_prefix+"t");
        //b.onclick=handleTextFieldClick;
        b.onblur=handleTextFieldBlur;
	}
	var h=document.getElementsByTagName("a");
	if(h){
		for(var i=h.length-1;i >= 0;i--){
			var v=h[i];
			if(isElementOfClass(v,"targetBlank"))v.onclick=function(){open(this.href,'','');return(false);};
			if(isElementOfClass(v,"navigateBack"))v.onclick=function(){javascript:history.back()};
			if(isElementOfClass(v,"galleryImage"))v.onclick=imageGallery;
			if(isElementOfClass(v,"galleryLink"))v.onmouseover=viewImage;
			if(isElementOfClass(v,"btnreset"))v.onclick=reset;
		}
	}
	h=document.getElementsByTagName("input");
	if(h){
		for(var i=h.length-1;i >= 0;i--){
			var v=h[i];
			if(isElementOfClass(v,"sbmbtn"))v.onclick=checkForm;
			if(isElementOfClass(v,"btn"))v.onclick=checkForm;
		}
	}
	h = document.getElementsByTagName("li");
	if (h) {
		for(var i=h.length-1;i >= 0;i--){
			var v = h[i];
			if (isElementOfClass(v, "TellusProduct")) v.onclick = navigateToProduct;
		}
	}
	h=document.getElementById("TellusListLimit");
	if(h){
		var b=h.getElementsByTagName("select");
		for(var i=b.length-1;i >= 0;i--){
			var v=b[i];
			v.onchange=submitLLForm;
		}
	}
	h=document.getElementById("TellusSort");
	if(h){
		var b=h.getElementsByTagName("select");
		for(var i=b.length-1;i >= 0;i--){
			var v=b[i];
			v.onchange=submitSOForm;
		}
	}
	h = document.getElementById("haveaccom");
	if(h)h.onclick = toggleCategoryList;
	h = document.getElementById("noaccom");
	if(h)h.onclick = toggleCategoryList;
	h=document.getElementById("reset");
	if(h)h.onclick = toggleCategoryList;
	toggleCategoryList();
	//<image_gallery>
	var f=document.getElementById("imagesGallery");
	if(f==null){
		f=document.getElementById("oneImage");
	}
	if(f){
		var g=getClassName(f);
		if(g){
			global_number_of_images=parseInt(g.substring(2,g.length));
		}
		for(var i=1;i<=global_number_of_images;i++){
			var j=document.getElementById("image"+i);
			if(j)global_images[i]=j;
		}
		var l=global_images[1].height;
		if(global_number_of_images>5){
			for(var i=6;i<=global_number_of_images;i++){
				var k=document.getElementById("list"+i);
				if(k){
					k.style.display="none";
				}
			}
		}

		var n=document.getElementById("link1");
		if(n){
			n.style.color="#980F05";
			n.style.fontSize="small";
		}
	}
	//</image_gallery>
	var a = document.getElementById(control_querystring_prefix + "t");
	if (a) {
		
		if ((param_text.length == 1 && param_text.indexOf(" ")>-1)) {
			//a.value = ''; //txt_search_word
		}
		else {
			a.value = param_text;
		}
	}
	a = document.getElementById("calendarfd");
	if (a) {
		a.onclick = openCalendar;
		a.style.display = "inline";
		var img = document.createElement("img");
		img.src = "http://www.tellus.angelholm.se/images/calendar_icon.gif";
		a.appendChild(img);
	}
	a = document.getElementById("calendartd");
	if (a) {
		a.onclick = openCalendar;
		a.style.display = "inline";
		var img = document.createElement("img");
		img.src = "http://www.tellus.angelholm.se/images/calendar_icon.gif";
		a.appendChild(img);
	}
	changeDynamicSearchLink(); 
	
	/* Event Form Events: */
	var a = document.getElementById("saveProduct");
	if (a) {
		a.onclick = validateForm;
	}
	a = document.getElementById("param_maintext");
	if (a) {
		if (txt_eventform_text2.indexOf(a.value) > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	a = document.getElementById("param_fromtime");
	if (a) {
		if (a.value.indexOf("hh:mm") > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	a = document.getElementById("param_totime");
	if (a) {
		if (a.value.indexOf("hh:mm") > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	a = document.getElementById("param_fromprice");
	if (a) {
		if (txt_eventform_priceexample.indexOf(a.value) > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	a = document.getElementById("param_yourname");
	if (a) {
		if (txt_eventform_yourname.indexOf(a.value) > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	a = document.getElementById("param_youremail");
	if (a) {
		if (txt_eventform_youremail.indexOf(a.value) > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	a = document.getElementById("param_yourphone");
	if (a) {
		if (txt_eventform_yourphone.indexOf(a.value) > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	a = document.getElementById("param_antispam");
	if (a) {
		if (txt_eventform_writecodehere.indexOf(a.value) > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	a = document.getElementById("param_productname");
	if (a) {
		if (txt_eventform_name.indexOf(a.value) > -1) {
			a.style.color = "#989898";
			a.onfocus = clearValue;
			a.onblur = restoreValue;
		}
	}
	var aNodeList = document.getElementsByTagName("a");
	if (aNodeList) {
	//TODO: fix hard coded string in test: will do this for all a-tags!
		for (var i = aNodeList.length; i >= 0; i--) {
			if (aNodeList[i]) {
				
				if (aNodeList[i].id.indexOf("tellUsEFCalendar") > -1) {
					var id = aNodeList[i].id;
					var a = document.getElementById(id);
					a.style.background = "url(images/TellusDatePicker.gif)";
					a.style.backgroundRepeat = "no-repeat";
					a.setAttribute("title", txt_eventform_choosedate + "");
					a.onclick = openCalendar;
				}
			}
		}
	}
	var a = document.getElementById("tellUsEFDateField");
	if (a) {
		// bug in IE, http://msdn.microsoft.com/en-us/library/ms536389.aspx
		var isIE = false;
		if (navigator.userAgent.indexOf('Internet Explorer') > -1 || navigator.userAgent.indexOf("MSIE") > -1) { isIE = true; }

		var input1 = document.createElement("input");
		if(isIE){
			input1 = document.createElement('<input name="typeofdatereg"/>');
		};
		input1.setAttribute("type", "radio");
		input1.setAttribute("name", "typeofdatereg");
		input1.setAttribute("value", "1");
		input1.setAttribute("class", "tellUsEFcheckbox");
		input1.id = "typeofdatereg1";
		input1.onclick = submitForm;

		var input2 = document.createElement("input");
		if(isIE){
			input2 = document.createElement('<input name="typeofdatereg"/>');
		};
		input2.setAttribute("type", "radio");
		input2.name = "typeofdatereg"; //("name", "typeofdatereg");
		input2.setAttribute("value", "2");
		input2.setAttribute("class", "tellUsEFcheckbox");
		input2.id = "typeofdatereg2";
		input2.onclick = submitForm;

		var label1 = document.createElement("label");
		label1.setAttribute("for", "typeofdatereg1");
		label1.setAttribute("class", "tellUsEFdatetypelabel");
		label1.innerHTML = txt_eventform_daybyday;

		var label2 = document.createElement("label");
		label2.setAttribute("for", "typeofdatereg2");
		label2.setAttribute("class", "tellUsEFdatetypelabel");
		label2.innerHTML = txt_eventform_dateperiod;

		var br = document.createElement("br");
		a.appendChild(input1);
		a.appendChild(label1);
		a.appendChild(br);
		a.appendChild(input2);
		a.appendChild(label2);

		if (tellUsEFtypeofdatereg == 1) {
			var b = document.getElementById("typeofdatereg1");
			b.checked = true;
		} else {
			var b = document.getElementById("typeofdatereg2");
			b.checked = true;
		}
	}
}

if(window.addEventListener){
	window.addEventListener("load",attachEvents,false);
	var request=new Request();
	var product = request["id"];
	if(product != "" && product != null && product != "undefined"){
		if(document.getElementById("map") == null){
			window.setTimeout('load()', 800);
		}else if(document.getElementById("map")){
			window.addEventListener("load", loadProduct, false);
			window.addEventListener("onunload", GUnload, false);
		}
	}
}else{
	window.attachEvent("onload",attachEvents);
	if(document.getElementById("map")){
		window.attachEvent("onload", load);
		window.attachEvent("onunload", GUnload);
	}
}
