$(function($) { 
		   
	$("form#loginForm").keydown(function (event) {
		if(event.keyCode == 13){
			$(this).parent().find("form")[0].submit();
			$(this).parent().html("Loading...").css({height : "60px", padding : "30px"}).addClass("AJAXloading").css("background-color","#fff");
		}
	});
		   
	$("#swlLoginA").click(function () {
			$(this).parent().parent().parent().find("form")[0].submit();
			$(this).parent().parent().parent().html("Loading...").css({height : "60px", padding : "30px"}).addClass("AJAXloading").css("background-color","#fff");
	});

	$("input#remind").click(function(){
		var pswBox = $(this).parent().parent().find("div.loginPassword");
		
		if(editionLCID==1053){
			var remindBtnTxt 	= "Begär lösenord";
			var loginBtnTxt		= "Logga in";
		}else{
			var remindBtnTxt 	= "Request password";
			var loginBtnTxt		= "Login";
		}
		
		if($(this).is(":checked")){
			pswBox.slideUp("fast")
			$("#swlLoginA").html(remindBtnTxt);
		}else{
			pswBox.slideDown("fast")
			$("#swlLoginA").html(loginBtnTxt);
		}
	});


	ajaxRenewSession();

});


function ajaxRenewSession(){
	if($(".ajaxRenewLoginSession").is('*')){
		var theKey		= $(".ajaxRenewLoginSession > .key").text();
		var theRandom	= $(".ajaxRenewLoginSession > .rnd").text();
		var theSalt		= $(".ajaxRenewLoginSession > .salt").text();
		var theDate		= $(".ajaxRenewLoginSession > .dte").text();
	   $(".ajaxRenewLoginSession").load("/core/coreSrc/modules/_tools/misc/renewAjaxSession.asp",{randomInt : theRandom, keyStr : theKey, saltInt : theSalt, timeDate: theDate}, function(){});
	   setTimeout('ajaxRenewSession()',120000);
	}
}
$(function() {
	if($("#mainHoverMenu").is('*')){
		$(".menu.level1").superfish({
			hoverClass:    "hover-menu",
			delay:         500,
			animation:     {height:"show"},
			speed:         "fast",
			autoArrows:    true,
			dropShadows:   true,
			disableHI:     false
		});
		
	}
});

/* JQUERY */
$(function() {
	// SYSTEM MESSAGE
	if($("div.systemMessageBox").is('*')){
	   $("div.systemMessageBox").fadeIn("slow");
	   $("div.systemMessageBox").animate({opacity: 0.7}, 2500);
	}
	setTimeout('hideSystemMessage()', 3000);

	// DATE PICKER
	$("input.datePickerjQuery").datepicker({
		monthNames: ['Januari','Februari','Mars','April','Maj','Juni','Juli','Augusti','September','Oktober','November','December'],
		monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
		dayNames: ['Söndag', 'Måndag', 'Tisdag','Onsdag', 'Torsdag', 'Fredag', 'Lördag'],
		dayNamesShort: ['Sön', 'Mån', 'Tis', 'Ons', 'Tors', 'Fre', 'Lör'],
		dayNamesMin: ['Sö', 'Må', 'Ti', 'On', 'To', 'Fr', 'Lö'],
		firstDay: 1,
		dateFormat: $.datepicker.ATOM, 
		showOn: "both",
		buttonImage: "/core/coreStyle/gfx/icons/24/calendar_24.gif", 
		buttonImageOnly: true
   });
	$("#altInline").hide();
});

/* TOOL TIP */
$(function($) { 
	$("a.toolActivator").toggle(function () {
		$("div.toolTip",this).show("slow");
	},function () {
		$("div.toolTip",this).hide("slow");
	}); 

/* CLEAR FORM FIELD */
	$("input#userNewPassword").val("")
	$(".autoEmpty").find("input").focus(function () {
		$(this).val("");
	});

/* COLUMNBOXES */
	$(".colBoxContainer > .top").click(function () {
		var theContentBox 	= $(this).parent().find(".content");
		var theIcon 		= $(this).find(".icon");
		
		if(theContentBox.is(":visible")){
			theContentBox.slideUp("fast");
			if(theIcon.is(".visible")){
				theIcon.removeClass("visible");
			}else{
				theIcon.addClass("visible");
			}
		}else{
			theContentBox.slideDown("fast");
			if(theIcon.is(".visible")){
				theIcon.removeClass("visible");
			}else{
				theIcon.addClass("visible");
			}
		}
	}); 
	
/* MODILEBOXES */
	$(".moduleBoxContainer > .top").toggle(function () {
		$(this).parent().find(".content").slideUp("slow");
	},function () {
		$(this).parent().find(".content").slideDown("slow");
	}); 

/* INSTRUCTIONS */
	$(".helpIcon").toggle(function(){
			$(this).parent().find(".helpBox").slideDown("fast");
		},function(){
			$(this).parent().find(".helpBox").slideUp("slow");			
	});

// TABLE SORTER PLUGIN
	if($("table#mainDataTable").is('*')){
	   $("table#mainDataTable").tablesorter({
		 widgets: ['zebra']	
	   });
	}
	
	
/* RESIZE IMAGES */
	$("img.resizeAjax").each(function(){
		var theImage	= $(this);
		var originalSrc = theImage.attr("src");
		theImage.attr({"src" : "/core/coreStyle/gfx/icons/ajax-loader.gif"});
		var newWidth 	= theImage.attr("width");
		var theHeight 	= theImage.height();
		$.ajax({
		  type: "GET",
		  url: "/core/coreSrc/modules/_tools/ajax/ajax-resize-image.asp",
		  data: "width="+newWidth+"&path="+originalSrc+"&height="+theHeight,
		  contentType: "text/html; charset=iso-8859-1",
		  success : function (data) {
			  	theImage.attr({"src" : data});
			  }
		})
	});

	
});

// SYSTEM MESSAGE
function hideSystemMessage(){
	if($("div.systemMessageBox").is('*')){
	   $("div.systemMessageBox").fadeOut('slow');
	}
}


	
/* ASSETS */
function winBRopen(theURL, theName, theWidth, theHeight) { 
	  var theLeft 	= (screen.width - theWidth) / 2;
	  var theTop 	= (screen.height - theHeight) / 2;
	  var theProps 	= "width="+theWidth+",height="+theHeight+",left="+theLeft+",top="+theTop+",scrollbars=yes,resizable=no";
	  theWindow		= window.open(theURL, theName, theProps);
	  theWindow.creator = self;
	  theWindow.window.focus();
};

function goto_URL(object) {
	    window.location.href = object.options[object.selectedIndex].value;
};


function modalDialogShow_IE(url,width,height) //IE
{
	return window.showModalDialog(url,window,
		"dialogWidth:"+width+"px;dialogHeight:"+height+"px;edge:Raised;center:Yes;help:No;Resizable:Yes;Maximize:Yes");
};

function modalDialogShow_Moz(url,width,height) //Moz
{
    var left = screen.availWidth/2 - width/2;
    var top = screen.availHeight/2 - height/2;
    activeModalWin = window.open(url, "", "width="+width+"px,height="+height+",left="+left+",top="+top);
    window.onfocus = function(){if (activeModalWin.closed == false){activeModalWin.focus();};};
};

var sActiveAssetInput;

function setAssetValue(v){
    document.getElementById(sActiveAssetInput).value = v;
};

function openAsset(s){
	sActiveAssetInput = s
	if(navigator.appName.indexOf('Microsoft')!=-1)
		document.getElementById(sActiveAssetInput).value=modalDialogShow_IE("/core/coreSrc/externalSrc/WYSIWYG/assetManager/assetmanager.asp",640,520); //IE	
	else
		modalDialogShow_Moz("/core/coreSrc/externalSrc/WYSIWYG/assetManager/assetmanager.asp",640,520); //Moz	
};

// GET OBJECTS /////////////////////////////////
function getFormObject(objectName){
	return document.forms[objectName];
};

function getHTMLObject(objectName){
// Old browsers
	if (!document.getElementById) {
		getHTMLObject = function(objectName){
			if (document.layers) return document[objectName];
			if (document.all) return document.all[objectName];
			return null; // expect the unexpected
		}
	}
// New browsers
	return document.getElementById(objectName);
};


// TOGGLE DISPLAY /////////////////////////////////
function hideItem(theItem){
	getHTMLObject(theItem).style.display	= "none";
};

function showItem(theItem){
	getHTMLObject(theItem).style.display	= "block";	
};

function toggleShowItem(theItem){
	if(getHTMLObject(theItem).style.display	== "block"){
//		$("#"+theItem).css({display : "none"});
		getHTMLObject(theItem).style.display	= "none";
	}else{
//		$("#"+theItem).slideDown("slow");
		getHTMLObject(theItem).style.display	= "block";	
	}
};

function toggleShowTableRowGroup(theItem){
	if(navigator.appName.indexOf("Microsoft") > -1){
		var canSee = "block";
	} else {
		var canSee = "table-row-group";
	}	

	if(getHTMLObject(theItem).style.display	== "none"){
		getHTMLObject(theItem).style.display	= canSee;
	}else{
		getHTMLObject(theItem).style.display	= "none";
	}
};

// EMAIL /////////////////////////////////
function renderEmail(username,hostname,subject){
	window.location = "mail" + "to:" + username + "@" + hostname +"?"+ subject;
};

/* CONFIRM REMOVE */
function removeArticleConfirm(theURL){
	if(confirm("Ta bort inlägget? Denna artikel och dess kommentarer kommer att tas bort!")){
		document.location=theURL;
	}
}

$(function() { 
/* --------------------------------------------------------------------- */

	if($("div.newsContainer").is("*")){
		$("div.newsContainer").addClass("AJAXloading");
  		reAttachEvents($("div.newsContainer"));
	}

/* --------------------------------------------------------------------- */
		   
	/* AJAX SEARCH */
	$(".articleAJAXSearchStr > input").keyup(function (){
		var sourceID 		= $("div.articleSubTools span.archiveIDS").text();
		var newsContainer 	= $("div.newsContainer");
		var searchString	= this.value;
		newsContainer.html("<br/>");
		newsContainer.addClass("AJAXloading");		
		$.ajax({
		  type: "GET",
		  url: "/core/coreSrc/modules/article/public/AJAXSearchPost.asp",
		  data: "archiveID="+sourceID+"&postCount=null&searchStr="+searchString,
		  contentType: "text/html; charset=iso-8859-1",
		  error : function(data,string) {alert(string);},
		  success : function (data) {
			  	newsContainer.append(data);
			  	reAttachEvents(newsContainer)
			  }
		})
	});

	/* SHOW ALL NEWS */
	$("a.allNews").click(function () {
		var sourceID = $("div.articleSubTools span.archiveIDS").text();
		var newsContainer = $("div.newsContainer");
		newsContainer.html("<br/>");
		newsContainer.addClass("AJAXloading");
		$.ajax({
		  type: "GET",
		  url: "/core/coreSrc/modules/article/public/AJAXGetAllPost.asp",
		  data: "archiveID="+sourceID+"&postCount=null",
		  contentType: "text/html; charset=iso-8859-1",
		  error : function(data,string) {alert(string);},
		  success : function (data) {
			  	newsContainer.append(data);
			  	reAttachEvents(newsContainer)
			  }
		});
	});

	/* MAXIMIZE/MINIMIZE */
	$(".articleSubTools .toggleMinMax").toggle(function(){
		$(".ajaxArticles .articleTeaser").slideDown("fast");
		$(".ajaxArticles .articleContent").slideDown("fast");
	},function(){
		$(".ajaxArticles .articleTeaser").slideUp("slow");
		$(".ajaxArticles .articleContent").slideUp("slow");
	});
	
/* --------------------------------------------------------------------- */

	function reAttachEvents(newsContainer){
	  newsContainer.removeClass("AJAXloading");
		$(".clientShowArticle").toggle(function () {
			$(this).parent().find(".articleTeaser").slideDown("fast");
			$(this).parent().find(".articleContent").slideDown("fast");
		  },function (){
			$(this).parent().find(".articleTeaser").slideUp("slow");
			$(this).parent().find(".articleContent").slideUp("slow");					
		});
	}

/* --------------------------------------------------------------------- */
});
/* CONFIRM REMOVE */
function removeRegistredUserConfirm(theURL){
	if(confirm("Ta bort personen från anmälningslistan?")){
		window.location = theURL;
	}
}
function removeActivityConfirm(theURL){
	if(confirm("Ta bort aktiviteten? Denna aktivitet, dess kommentarer och anmälningar kommer att tas bort!")){
		document.location=theURL;
	}
}

function selectTemplate(URL){
	// Determine prefix
	if (URL.indexOf("?") != -1){
		var prefix = "&";
	}else{
		var prefix = "?";
	}
	if(URL.match(/modID/)){
		document.location = URL.replace(/modID=\d/, "modID="+document.selectTemplateForm.template_id.value);			
	}else{
		document.location = URL + prefix + "modID=" + document.selectTemplateForm.template_id.value;
	}
}

$(function($) {		   
	$(".calAdminMenu li").click(function(){
		if($(".calAdminRepeat").is(":visible")){
			$(".calAdminRepeat").hide("fast");
			$(".calAdminSingle").show("fast");
			$(".calAdminMenu li.repeat").removeClass("choosen");
			$(".calAdminMenu li.single").addClass("choosen");
		}else{
			$(".calAdminSingle").hide("fast");
			$(".calAdminRepeat").show("fast");
			$(".calAdminMenu li.single").removeClass("choosen");
			$(".calAdminMenu li.repeat").addClass("choosen");
		}
	});
}); 
$(function() { 	

	reAttachFullCalendarEvents();
	
	function reAttachFullCalendarEvents(){

		$(".activity-popup > li.registration").each(function(){
			$(this).parent().parent().parent().addClass("registration");												
		});

	  $(".has-activities").hover(function (){
		$(this).css({opacity: "0.85"});
	   },function(){
		$(this).css({opacity: "1"});
	  });

	  $(".has-activities").each(function () {
		var hideDelayTimer = null;
		var beingShown = false;
		var shown = false;
		var trigger = $(this);
		var popup = $(".activity-container ul", this).css("opacity", 0);
 
		$([trigger.get(0), popup.get(0)]).mouseover(function () {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			if (beingShown || shown) {
				return;
			} else {
				$(".activity-container ul").css("display", "none");
				beingShown = true;
				popup.css({
					bottom: 20,
					left: -76,
					display: "block"
				})
				.animate({
					bottom: "+=" + 10 + "px",
					opacity: 1
				}, 250, "swing", function() {
					beingShown = false;
					shown = true;
				});
			}
		}).mouseout(function () {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			hideDelayTimer = setTimeout(function () {
				hideDelayTimer = null;
				popup.animate({
					bottom: "-=" + 10 + "px",
					opacity: 0
				}, 250, "swing", function () {
					shown = false;
					popup.css("display", "none");
				});
			}, 300);
		});
	  });

	  $(".change-month").click(function (){
		var calBox 		= $(this).parent();
		var theYear		= $(this).find(".the-year").text();
		var theMonth	= $(this).find(".the-month").text();
		var theCalendar	= $(this).find(".the-calendar").text();
		updateCalendar(calBox,theYear,theMonth,theCalendar);
	  });

	  function updateCalendar(theBox,theYear,theMonth,theCalendar){
		theBox.html("<br/>");
		theBox.addClass("AJAXloading").css("background-color","#fff");
		$.ajax({
		  type: "GET",
		  url: "/core/coreSrc/modules/calendar/public/AJAX-update-full-calendar.asp",
		  data: "theYear="+theYear+"&theMonth="+theMonth+"&theCalendar="+theCalendar,
		  contentType: "text/html; charset=iso-8859-1",
		  error : function(data,string) {alert(string);},
		  success : function (data) {
			  	theBox.append(data);
				theBox.removeClass("AJAXloading");		
				reAttachFullCalendarEvents();
			  }
		});
	  }
	  
	}
});

$(function($) {		   
	var natDays = $(".foundDates").text();
		natDays = natDays.split("||");
		for(i=0;i<natDays.length;i++){
			natDays[i] = natDays[i].split(",");
			natDays[i][0] = parseFloat(natDays[i][0]);
			natDays[i][1] = parseFloat(natDays[i][1]);
			natDays[i][2] = parseFloat(natDays[i][2]);
		}
	
	function nationalDays(date) {
		for (i = 0; i < natDays.length; i++) {
			if (date.getFullYear() == natDays[i][0] && date.getMonth() == natDays[i][1] - 1 && date.getDate() == natDays[i][2]) {
				return [true, natDays[i][3] + ' activityDay'];
			}
		}
		return [false, ''];
	}

	$("#calendarDatePickerContainer").datepicker({ 
		monthNames: ['Januari','Februari','Mars','April','Maj','Juni','Juli','Augusti','September','Oktober','November','December'],
		monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
		dayNames: ['Söndag', 'Måndag', 'Tisdag','Onsdag', 'Torsdag', 'Fredag', 'Lördag'],
		dayNamesShort: ['Sön', 'Mån', 'Tis', 'Ons', 'Tors', 'Fre', 'Lör'],
		dayNamesMin: ['Sö', 'Må', 'Ti', 'On', 'To', 'Fr', 'Lö'],
		firstDay: 1,
		dateFormat: $.datepicker.ATOM, 
		showOn: "both",
		buttonImage: "templates/images/calendar.gif", 
		buttonImageOnly: true,
		beforeShowDay: nationalDays,
		onSelect: function(selectedDate) { 
			$("#foundCalendarPosts").html("<br/>");
			$("#foundCalendarPosts").addClass("AJAXloading").css("background-color","#fff");
			$("#foundCalendarPosts").load("/core/coreSrc/modules/calendar/public/AJAXGetCalendarPost.asp", {theDate: selectedDate, calendarID:$('input#calendarID').attr("value"), returnURL:$('input#returnURL').attr("value")}, function(){});
			$("#foundCalendarPosts").removeClass("AJAXloading");		
		} 
	}); 
	$("#altInline").hide();

	$("#yearCalendarContainer").datepicker({ 
		monthNames: ['Januari','Februari','Mars','April','Maj','Juni','Juli','Augusti','September','Oktober','November','December'],
		monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
		dayNames: ['Söndag', 'Måndag', 'Tisdag','Onsdag', 'Torsdag', 'Fredag', 'Lördag'],
		dayNamesShort: ['Sön', 'Mån', 'Tis', 'Ons', 'Tors', 'Fre', 'Lör'],
		dayNamesMin: ['Sö', 'Må', 'Ti', 'On', 'To', 'Fr', 'Lö'],
		firstDay: 1,
		inline: true,
		numberOfMonths: [2, 3],
		dateFormat: $.datepicker.ATOM, 
		showOn: "both",
		buttonImage: "templates/images/calendar.gif", 
		buttonImageOnly: true,
		beforeShowDay: nationalDays,
		onSelect: function(selectedDate) { 
			$("#foundCalendarPosts").load("/core/coreSrc/modules/calendar/public/AJAXGetCalendarPost.asp", {theDate: selectedDate, calendarID:$('input#calendarID').attr("value"), returnURL:$('input#returnURL').attr("value")}, function(){});
		} 
	}); 

	$(".statusInfoActivator").toggle(function(){
		$(this).parent().parent().find("td > .statusInfo").slideDown("fast");
	  },function(){
		$(this).parent().parent().find("td > .statusInfo").slideUp("slow");
	});

	$("#calSnippetFullMini").datepicker({ 
		monthNames: ['Januari','Februari','Mars','April','Maj','Juni','Juli','Augusti','September','Oktober','November','December'],
		monthNamesShort: ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
		dayNames: ['Söndag', 'Måndag', 'Tisdag','Onsdag', 'Torsdag', 'Fredag', 'Lördag'],
		dayNamesShort: ['Sön', 'Mån', 'Tis', 'Ons', 'Tors', 'Fre', 'Lör'],
		dayNamesMin: ['Sö', 'Må', 'Ti', 'On', 'To', 'Fr', 'Lö'],
		firstDay: 1,
		dateFormat: $.datepicker.ATOM, 
		showOn: "both",
		beforeShowDay: nationalDays,
		onSelect: function(selectedDate) { 
			$("#calSnippetFullMiniPost").html("<br/>");
			$("#calSnippetFullMiniPost").addClass("AJAXloading").css("background-color","#fff");
			$("#calSnippetFullMiniPost").load("/core/coreSrc/modules/calendar/public/AJAXGetCalendarPost.asp", {theDate: selectedDate, calendarID:$('#snippetCalID').attr("value"), returnURL:$('#snippetReturnURL').attr("value")}, function(){});
			$("#calSnippetFullMiniPost").removeClass("AJAXloading");		
		} 
	}); 
	$("#altInline").hide();
}); 
$(function($) {		   
	$("#messageRecipient").change(function(){
		$(this).parent().parent().parent().find("#messageSubject").val($(this).find("option:selected").text());
	});
	
	$(".autoEmptyFields").find("input").click(function(){
		$(this).val("");								 
	});
	$(".autoEmptyFields").find("textarea").click(function(){
		$(this).val("");								 
	});
	
}); 
/* CONFIRM REMOVE */
function removefaqConfirm(theURL){
	if(confirm("Ta bort fråga/svar?")){
		window.location = theURL;
	}
}

$(function($) {		   
    $("#faqAccordion").accordion({
		autoHeight: false,
		alwaysOpen: false
	});
}); 
$(function() {
	$(".fileExplorer > li > .folderName").toggle(function () {
	  $(this).parent().find(".fileExplorer:first").slideDown("fast");
	},function () {
	  $(this).parent().find(".fileExplorer:first").slideUp("fast");
	});
	$(".noFiles").each(function(){
	  $(this).parent().parent().addClass("noFilesFound");
	});
});

function removeImageConfirm(theURL){
	if(confirm("Ta bort bilden?")){
		document.location=theURL;
	}
}
function removeGalleryConfirm(theURL){
	if(confirm("Ta bort galleriet? Alla bilder, kommentarer och statistik \ntill detta  galleri kommer att tas bort.")){
		document.location=theURL;
	}
}
$(function() {
  if($("div.imageSwitcher").is("*")){
	var switchImages = $("div.imageSwitcher img");   
	switchImages.each(function(index){
		var currentImage = $(switchImages[index]);
		currentImage.hide();
		currentImage.click(function(){
			switchImages.hide();
			if(index==(switchImages.size()-1)){
				$(switchImages[0]).show();
			}else{
				$(switchImages[index+1]).show();					
			}
		});
	});
	$(switchImages[0]).show();
  }
});
$(function() {
	if($(".lightboxGallery").is("*")){
								
		var thumbs 			= $(".lightboxGallery > img");
		var overlay 		= $("<div class='lightboxOverlay'></div>");
		var container 		= $("<div class='lightboxContainer'></div>");
		var viewPort		= $("<div class='lightboxViewport'></div>");
		var captionBox		= $("<div class='lightboxCaption'></div>");
		var navRow			= $("<div class='lightboxNavigation'></div>");
		var closeBtn		= $("<span class='closeBtn btn'>×</span>");
		var prevBtn			= $("<span class='prevBtn btn'>«</span>");
		var nextBtn			= $("<span class='nextBtn btn'>»</span>");
		var winH			= $(window).height();
		var winW			= $(window).width();
		var currentImage	= 0;
		
		$("body").append(overlay).append(container);
		container.append(navRow).append(viewPort).append(closeBtn).append(captionBox);
		navRow.append(prevBtn).append(nextBtn);
		container.show().css({"top": Math.round((winH-container.outerHeight())/2) + "px","left": Math.round((winW-container.outerWidth())/2) + "px"}).hide();

		thumbs.each(function(index){
		 $(this).click(function(){overlay.css({"opacity" : 0.8, "height" : $(document).height()+"px"}); overlay.add(container).fadeIn("slow"); loadImage(index);});
		 $(this).attr({"image-index": index});
		});
	
		function loadImage(imageIndex) {
		  container.addClass("loadingImage");
		  
		    var newImage = thumbs.eq(imageIndex);	
			var img = new Image();
				img.onload = function() {
				img.style.display = "none";
			
				var maxWidth = winW-20-100;
				var maxHeight = winH-20-200; 
				if(img.width > maxWidth || img.height > maxHeight){
					var ratio = img.width / img.height;
					if(img.height >= maxHeight) {
						img.height = maxHeight;
						img.width = maxHeight*ratio;
					}else{
						img.width = maxWidth;
						img.height = maxWidth*ratio;
					}
				}
				navRow.css({"width" : img.width+"px", "top" : img.height/3 +"px","opacity" : 0.7});
				container.animate({"width": img.width,"height": img.height,"top": Math.round((winH - img.height - 20)/2) + "px","left": Math.round((winW - img.width - 20)/2) + "px"},
									"normal", function(){
										viewPort.append(img);
										$(img).fadeIn("normal",function(){
											captionBox.html((currentImage+1)+" / "+thumbs.size()+"<br/>"+newImage.attr("alt"));
											container.removeClass("loadingImage");
											container.animate({"height": container.height() + captionBox.height() + 30},"fast", function(){
												captionBox.fadeIn("fast",function(){closeBtn.fadeIn("fast",function(){navRow.fadeIn("fast");});});
											});
										});
				});
				
				
			} 
			img.src = newImage.attr("src");
			thumbs.filter(".selected").removeClass("selected");
			newImage.addClass("selected");
			currentImage = parseInt(thumbs.filter(".selected").attr("image-index"));
			$.scrollTo("0px",800);
		}
	
		closeBtn.add(overlay).click(function(){
			viewPort.children().fadeOut("normal",function(){viewPort.children().remove();});
			overlay.add(container).add(closeBtn).add(captionBox).fadeOut("normal");
		});
	
		nextBtn.add(prevBtn).click(function(){
			navRow.hide();
			closeBtn.fadeOut("fast",function(){captionBox.fadeOut("fast");});
			viewPort.children().fadeOut("normal",function(){viewPort.children().remove();});
			if($(this).is(".prevBtn")){
				loadImage(currentImage == 0 ? thumbs.size()-1 : currentImage-1);
			}else{
				loadImage(currentImage == (thumbs.size()-1) ? 0 : currentImage+1);
			}
		});
	}
});


$(function() { 
	$("form#GITSearchForm > a.competitionSearch").click(function (){
		$("div.GITSearchResult").html("<br/>").addClass("AJAXloading");
		document.GITSearchForm.submit();
	});
});
$(function() {
	$("a.ruleOption").toggle(function () {
		$(this).parent().find("div.optionResponse").show("normal");
		$(this).parent().parent().find("div.ruleText").show("normal");
		},function () {
		$(this).parent().find("div.optionResponse").hide("normal");
	});
});

/* CONFIRM REMOVE */
function removeUserConfirm(theURL){
	if(confirm("Ta bort användare från gruppen?")){
		window.location = theURL;
	}
}
function removeGroupConfirm(theURL){
	if(confirm("Ta bort gruppen? Denna grupp och alla undergrupper kommer att tas bort!")){
		document.location=theURL;
	}
}

$(function() { 
/* --------------------------------------------------------------------- */

	/* UPCOMING EVENT SNIPPET */
	$(".showMoreActivities").click(function (){
		var me = $(this);
		me.hide("fast");
		me.parent().find(".smallLink").slideDown("slow");
	});

/* --------------------------------------------------------------------- */

});
$(function() {
	if($(".hiddenSurveillance").is('*')){
		$(".hiddenSurveillance").each(function(){
			var hiddenArea 	= $(this);
			var formField 	= hiddenArea.parent().find("div > #userEmail");
			formField.val("Ange din e-postadress");
			formField.focus(function(){$(this).val("");});
			formField.keyup(function(){
				if(formField.val().length>6){
					if(hiddenArea.is(":hidden")){hiddenArea.slideDown("normal");}
				}else{
					if(hiddenArea.is(":visible")){hiddenArea.slideUp("fast");}
				}
			});
		});
	}
});

/* CONFIRM REMOVE */
function removeNewsletterConfirm(theURL){
	if(confirm("Ta bort brevet?\nObservera att redan utskickade meddelanden inte påverkas av detta.")){
		document.location=theURL;
	}
}

$(function() {
	if($("#newsletterEditor").is("*")){
//--------------------------------------------------------------------->
		var letterContent	= $("#newsletterContentBox");
		var images 			= $(".newsletterIMAGE");
		var textareas		= $(".newsletterTEXT");
		var modules			= $(".newsletterMODULES");
		var imageLinks		= $(".newsletterLINK");
		var imageEditBox	= $(".tempImgBox");
		var textEditBox		= $(".tempTextBox");
		var moduleEditBox	= $(".tempModuleBox");
		var fileField 		= imageEditBox.find("#tempImg");
		var fileLinkField	= imageEditBox.find("#tempImgLink");
		var textField		= textEditBox.find("#tempText");
		var textLinkField	= textEditBox.find("#tempTextLink");
		var modHeader		= moduleEditBox.find("#tempModuleHeader");
		var modType			= moduleEditBox.find("#tempModuleType");
		var modID			= moduleEditBox.find("#tempModuleIDs");
		var modCount		= moduleEditBox.find("#tempModulePostCount");
		var systemURL		= $("#systemURL").text();
		var instructionText	= $(".newsletterInstruction");
		var defaultImg		= "/core/coreStyle/gfx/newsletterIMAGEModule.jpg";
		var choosenImg		= "/core/coreStyle/gfx/newsletterIMAGEModuleChoosen.jpg";
//--------------------------------------------------------------------->

		// HIDE EDITOR TOOLS AND DISABLE NEWSLETTER LINKS CLICK
		imageEditBox.add(textEditBox).add(moduleEditBox).hide();
		imageLinks.click(function(){return false;});
		
		
		// SAVE BUTTONS
		$("#saveNewsletter").click(function(){
			$("#workCopyContent").val(letterContent.html());
			$(".un-edited").remove();
			$("#finalContent").val(letterContent.html());
			letterContent.html("");
			letterContent.addClass("AJAXloading");
			setTimeout('saveNewsletterForm()',3000);
		});

		// GENERIC CHOOSE/INPUT
		function newsletterItemSelect(me,editTool){
			// DETERMINE WHICH ELEMENT IS PRE-CHOOSEN
			if(me.is(".is-choosen")){
				var preChoosen = me;
				var showTools = false;
			}else{
				var preChoosen = $(".is-choosen");
				var showTools = true;
			}
			
			// HIDE PRECHOOSEN ELEMENT
			if(preChoosen.is("img")){
			 endImageSelect("ABORT");
			 newsletterItemDone(imageEditBox);	
			}
			if(preChoosen.is(".newsletterTEXT")){
			 endTextInsert("ABORT");
			 newsletterItemDone(textEditBox);
			}
			if(preChoosen.is(".newsletterMODULES")){
			 endModuleInsert("ABORT");
			 newsletterItemDone(moduleEditBox);
			}
			
			// SHOW TOOLS IS PRE-CHOOSEN WAS NOT SAME AS NEW-CHOOSEN (ME)
			if(showTools){
				me.removeClass("un-edited");
				me.addClass("is-choosen");
				instructionText.hide();
				editTool.fadeIn("fast");
			}
		}
		function newsletterItemDone(editTool){
			editTool.hide();
			$(".is-choosen").removeClass("is-choosen");
			instructionText.show();
		}


//--------------------------------------------------------------------->
// MODULES --------------------------------------------------------------------->
		modules.each(function(i){
		 var me = $(this);
			me.click(function(){
				modID.val("0");
				modHeader.val("");
				newsletterItemSelect(me,moduleEditBox);
		    });
		});
		
		$("#chooseModule").click(function(){endModuleInsert("INPUT");});
		$("#abortModule").click(function(){endModuleInsert("ABORT");});
		$("#removeModule").click(function(){endModuleInsert("REMOVE");});

		function endModuleInsert(moduleAction){
		 var targetModuleBox = $(".is-choosen");
			switch(moduleAction)
			{
			case "INPUT":
			 targetModuleBox.addClass("AJAXloading");
				$.ajax({
				  type: "GET",
				  url: "/core/coreSrc/modules/newsletter/admin/AJAX-get-modul-content.asp",
				  data: "theType="+modType.val()+"&theIDs="+modID.val()+"&thePostCount="+modCount.val()+"&theHeader="+modHeader.val(),
				  contentType: "text/html; charset=iso-8859-1",
				  error : function(data,string) {alert(string);},
				  success : function (data) {
					    targetModuleBox.html(data);
						targetModuleBox.removeClass("AJAXloading");		
					  }
				});
			  break;
			case "ABORT":
			  if(targetModuleBox.html()=="" || targetModuleBox.html()=="MODUL"){targetModuleBox.addClass("un-edited");}
			  break;
			case "REMOVE":
				$(".is-choosen").html("MODUL");
				$(".is-choosen").addClass("un-edited");
			  break;
			default:
			}
			newsletterItemDone(moduleEditBox);
		}


//--------------------------------------------------------------------->
// TEXT --------------------------------------------------------------------->
		textareas.each(function(i){
		 var me = $(this);
			me.click(function(){
				newsletterItemSelect(me,textEditBox);
				textField.val(me.html().replace(/<br>/g,"\n"));
				textField.focus();
		    });
		});
		
		$("#chooseText").click(function(){endTextInsert("INSERT");});
		$("#abortText").click(function(){endTextInsert("ABORT");});
		$("#removeText").click(function(){endTextInsert("REMOVE");});

		function endTextInsert(actionType){
		 var choosenText = $(".is-choosen");	
			switch(actionType){
				case "INSERT":
				 choosenText.html(textField.val().replace(/\n/g,"<br>"));
				 break;
				case "ABORT":
				 if(choosenText.html()=="" || choosenText.html()=="(tom)"){choosenText.addClass("un-edited");}
				 break;
				case "REMOVE": 
				 $(".is-choosen").html("(tom)");
				 $(".is-choosen").addClass("un-edited");
				 break;
			default:
			}
			newsletterItemDone(textEditBox);
		}

		$("#urlInsert").click(function(){
		   var textRutan 	= document.getElementById("tempText");									   
			var startPos 	= textRutan.value.length;
			var endPos 		= textRutan.value.length;
			var selectedText= "";
			if ($.browser.msie) {
			  	selectedText = document.selection.createRange().text;
				startPos 	 = textRutan.value.indexOf(selectedText);
				endPos 	 	 = textRutan.value.indexOf(selectedText)+selectedText.length;
			}else{
				startPos 	 = textRutan.selectionStart;
				endPos 		 = textRutan.selectionEnd;
				selectedText = textField.val().substring(startPos,endPos)
			}
		  	textField.val(textField.val().substring(0,startPos)+"<a href=\""+ textLinkField.val() +"\">"+selectedText+"</a>"+textField.val().substring(endPos));
		});

//--------------------------------------------------------------------->
// IMAGES --------------------------------------------------------------------->
		images.each(function(i){
		 var me = $(this);
		  if(me.attr("src")==""){me.attr({"src": defaultImg});}
			me.click(function(){
				newsletterItemSelect(me,imageEditBox);
				if(me.attr("src")==defaultImg){
					fileField.attr({"value":""});
					fileLinkField.attr({"value" : "http://"});
				}else{
					fileField.attr({"value": me.attr("src").replace(systemURL,"")});
					fileLinkField.attr({"value" : me.parent().attr("href")});
				}
				
				// SHOW/HIDE URL INPUT FIELD
				   me.parent().is("a") ? fileLinkField.parent().show() : fileLinkField.parent().hide()
				fileField.focus();
			});
		});
		
		$("#chooseImage").click(function(){endImageSelect("INSERT");});
		$("#abortImage").click(function(){endImageSelect("ABORT");});
		$("#removeImage").click(function(){endImageSelect("REMOVE");});

		function endImageSelect(actionType){
		 var theChoosenImage = $(".is-choosen");			
			switch(actionType){
				case "INSERT":
				 theChoosenImage.attr({"src": systemURL+fileField.val().replace(systemURL,"")});
				 if(theChoosenImage.parent().is("a")){
					theChoosenImage.parent().attr({"href":fileLinkField.val()});
				 }
				 break;
				case "ABORT":
				 if(theChoosenImage.attr("src")=="" || theChoosenImage.attr("src")==defaultImg){theChoosenImage.addClass("un-edited");}
				 break;
				case "REMOVE":
				 theChoosenImage.addClass("un-edited");
				 theChoosenImage.attr({"src": defaultImg});
				 break;
			 default:
			  break;
			}
			newsletterItemDone(imageEditBox);
		}
		
//--------------------------------------------------------------------->
	}
});

// DELAYED FORM SUBMIT
function saveNewsletterForm(){
	document.saveForm.submit();
}



$(function() {
	if($("#newsletterRecipientsTool").is("*")){
//--------------------------------------------------------------------->
		$(".chooseAll > input.checkbox").toggle(function(){
			$(this).parent().parent().find("div > input.checkbox").attr("checked", true);
		  },function(){
			$(this).parent().parent().find("div > input.checkbox").attr("checked", false);
		});
//--------------------------------------------------------------------->
	}
});

function removeContentConfirm(theURL){
	if(confirm("Töm innehållet i anslagstavlan?")){
		document.location=theURL;
	}
}

/* CONFIRM REMOVE */
function removePageConfirm(theURL){
	if(confirm("Ta bort sidan?")){
		document.location=theURL;
	}
}
/* CONFIRM REMOVE */
function removeEntityConfirm(theURL){
	if(confirm("Ta bort bokningsbar produkt/tjänst?")){
		document.location=theURL;
	}
}


function selectEntity(URL){

	// Determine prefix
	if (URL.indexOf("?") != -1){
		var prefix = "&";
	}else{
		var prefix = "?";
	}
	
	if(URL.match(/&id/)){
		document.location = URL.replace(/&id=\d/, "&id="+document.selectEntityForm.entityID.value);			
	}else{
		document.location = URL + prefix + "id=" + document.selectEntityForm.entityID.value;
	}
}
$(function() {
	if($("table.reservationMainTable").is("*")){
		
		/* ADD/REMOVE TO RESERVATION */
	   $("td.entityFree").toggle(function(){
		  $(this).addClass("active");
		  $("#currentReservation > .tempMessage").remove();

		  var tempID 	= $(".entityID",this).text();
		  var tempNAME 	= $(".entityName",this).text();
		  var tempDATE 	= $(".entityDate",this).text();
		  var tempTIME 	= $(".entityTime",this).text();
		  var tempPRICE	= $(".entityPrice",this).text();		  
		  
		  /* INPUT  */
		  var tempStr 	= "<input type='hidden' id='reservations' name='reservations' class='reservasionHiddens "+tempID+"-"+tempDATE.replace("-","")+"-"+tempTIME.replace(":","")+"' value='"+tempID+"|"+tempDATE+"|"+tempTIME.replace(":","")+"|"+tempPRICE+"'>"
		  $("#currentReservationData").append(tempStr);
		  reCalculateReservation();

		},function(){
		  $(this).removeClass("active");
		  var tempID 	= $(".entityID",this).text();		  
		  var tempDATE 	= $(".entityDate",this).text();
		  var tempTIME 	= $(".entityTime",this).text();
		  $("#currentReservationData > input."+tempID+"-"+tempDATE.replace("-","")+"-"+tempTIME.replace(":","")).remove();		  
		   reCalculateReservation();
		});

		/* CALCULATE RESERVATION */
		function reCalculateReservation(){
		  $("#currentReservation").children().remove();
		  var tempStr = "";
		  $(".reservasionHiddens").each(function(){tempStr = tempStr + $(this).val() + ", ";});
			$.ajax({
			  type: "GET",
			  url: "/core/coreSrc/modules/reservation/public/AJAX-calculate-total-sum.asp",
			  data: "reservationString="+tempStr,
			  contentType: "text/html; charset=iso-8859-1",
			  success : function (data) {
					$("#currentReservation").append(data);
					$("#currentReservation").children().hide();
					$("#currentReservation").children().fadeIn("normal");
					if($("#totalSumInt").html()>0){
						 $("#reservationForm").fadeIn("slow");
						}else{
						 $("#reservationForm").fadeOut("fast");
						 $("#currentReservation").children().fadeOut("fast");
						}
				  }
			});
		}


		/* FREE HOVER */
	   $("th.entities").toggle(function(){
		  $("div.entityDescription",this).show("fast");
		},function(){
		  $("div.entityDescription",this).hide("slow");
		});
	   $("td.entityFree").hover(function(){
		  $(this).addClass("hover");
		},function(){
		  $(this).removeClass("hover");
		});
	   

		/* RESERVED HOVER */
	   $("td.hoverInfo").toggle(function(){
		  $("div.reservationInfo",this).show("fast");
		},function(){
		  $("div.reservationInfo",this).hide("slow");
		});
	   
		/* RESERVED HOVER */
	   $("div.reservationInfo > div.removeButton").click(function(){
		  if(confirm("Ta bort?")){ 
		  	window.location = $("div.removeURL",this).text();
	   	  }
		});

   }
});

function swlValidateReservation(){

	var theName 	= $("input#customer_name").val();
	var theEmail 	= $("input#customer_email").val();
	var thePhone 	= $("input#customer_phone").val();
	var message		= "";
	
	if(theName==""){message 	+= "* Du har inte angett något namn\n";}	
	if(theEmail==""){message 	+= "* Du har inte angett någon e-postadress\n";}
	if(thePhone==""){message 	+= "* Du har inte angett något telefonnummer\n";}

	if(message.length>0){alert("VARNING\n"+message);}

	if(confirm("Spara bokning?\nObservera att anonyma bokningar kommer att plockas bort.")){
		document.reservationForm.submit();
	}
	
}
function setBookmark(url,title){
	
	// Explorer
	if(document.all){
		window.external.AddFavorite(url, title);
	}
	// Firefox
	else if(window.sidebar){
		window.sidebar.addPanel(title, url, "");
	}
	// Opera
	else if(window.print && window.opera){
		var bmLink = document.createElement('a');
		bmLink.setAttribute('href',url);
		bmLink.setAttribute('title',title);
		bmLink.setAttribute('rel','sidebar');
		bmLink.click();
	} 
	// Others
	else{
		if(editionLCID==1053){
			alert("Vi saknar tyvärr direktlänk för att lägga till bokmärket i den webbläsare du använder.");	
		}else{
			alert("Unfortunatly we were not able to add the bookmark directly to the browser you are using.");	
		}
	}
}
function modMatrixUpdateList(){
	setTimeout('replaceMatrixFormContent()',100);
	return true;
}

function replaceMatrixFormContent(){
	getHTMLObject("matrixSearchBox").innerHTML = "Loading..";
}


/* CONFIRM REMOVE */
function matrixRemoveUserConfirm(theURL){
	if(confirm("Ta bort användare?")){
		window.location = theURL;
	}
}

$(function() {
  /*
	$(".userDetailsLink_OLD").toggle(function () {
		$(this).parent().find(".moreInfo").slideDown("fast");
	  },function () {
		$(this).parent().find(".moreInfo").slideUp("slow");
	}); 
  */

	$(".userDetailsLink").click(function () {
		if($(this).parent().find(".moreInfo").is(":hidden")){
		 $(this).parent().find(".moreInfo").show(); 
		}else{
		 $(this).parent().find(".moreInfo").hide();
		}
	}); 

});



/* CONFIRM REMOVE */
function removePollConfirm(theURL){
	if(confirm("Ta bort omröstning?")){
		window.location = theURL;
	}
}

$(function() { 
/* --------------------------------------------------------------------- */

	/* INITIALIZE */
	if($("div.webshopCart").is("*")){
		$("div.webshopCart").addClass("AJAXloading");
  		reAttachWebshopEvents($("div.webshopCart"));
	}

	/* AJAX ADD PRODUCT */
	$(".webshopAddProduct").click(function (){

		$(this).find("div.order").slideUp("slow");
		
		var cartContainer 	= $("div.webshopCart");
		
		if($(this).parent().find(".orderCount > div.selectCount > select").length>0){
			var orderCount		= $(this).parent().find(".orderCount > div.selectCount > select").val();	
		}else if($(this).parent().find(".orderCount > div.textCount > input").length>0){
			var orderCount		= $(this).parent().find(".orderCount > div.textCount > input").val();
		}else{
			var orderCount		= 1
		}
		
		var orderModelName	= $(this).parent().find(".orderModel").text();
		var orderPrice		= $(this).parent().find(".orderPrice > .price").text();
		var orderSize		= $(this).parent().find(".orderSize > div.selectSize > select").val();
		var orderColor		= $(this).parent().find(".orderColor > div.selectColor > select").val();
		var orderProductName= $(this).find(".orderProduct").text();				
		var orderModelID	= $(this).find(".modelID").text();
		var orderProductID	= $(this).find(".productID").text();

		cartContainer.html("<br/><br/><br/>");
		cartContainer.addClass("AJAXloading").css("background-color","#fff");		
		
		$.ajaxSetup({contentType: "application/x-www-form-urlencoded; charset=iso-8859-1"})
		$.ajax({
		  type: "GET",
		  url: "/core/coreSrc/modules/webshop/public/AJAXaddproduct.asp",
		  data: "oCount="+orderCount+"&oModel="+orderModelName+"&oProduct="+orderProductName+"&oPrice="+orderPrice+
		  		"&oSize="+orderSize+"&oColor="+orderColor+"&oModelID="+orderModelID+"&oProductID="+orderProductID,
		  error : function(data,string) {alert(string);},
		  success : function (data) {
	  			cartContainer.html("");
				cartContainer.removeClass("AJAXloading");
				cartContainer.append(data);				
				//cartContainer.css('border','1px solid red');
				reAttachWebshopEvents(cartContainer);
			  }
		})

		$(this).find("div.order").slideDown("fast");
	  //$(this).parent().html("<td colspan=8 class=orderModel>Produkten är nu tillagd i varukorgen.</td>");		
		
	});


/* --------------------------------------------------------------------- */
		   
function reAttachWebshopEvents(cartContainer){
	cartContainer.removeClass("AJAXloading");

	/* AJAX PLUS PRODUCT */
	cartContainer.find(".webshopPlusProduct").click(function (){
		var cartContainer 	= $("div.webshopCart");
		var orderCartPostID	= $(this).find(".cartPostID").text();
		var isInCashier		= $(this).find(".isInCashier").text(); 

		$.ajaxSetup({contentType: "application/x-www-form-urlencoded; charset=iso-8859-1"})
		$.ajax({
		  type: "GET",
		  url: "/core/coreSrc/modules/webshop/public/AJAXplusproduct.asp",
		  data: "oCartPostID="+orderCartPostID+"&isInCashier="+isInCashier,
		  error : function(data,string) {alert(string);},
		  success : function (data) {
	  			cartContainer.html("");
				cartContainer.append(data);
				reAttachWebshopEvents(cartContainer);
			  }
		})
	});
	
	/* AJAX MINUS PRODUCT */
	cartContainer.find(".webshopMinusProduct").click(function (){
		var cartContainer 	= $("div.webshopCart");
		var orderCartPostID	= $(this).find(".cartPostID").text();
		var isInCashier		= $(this).find(".isInCashier").text(); 
		
		$.ajaxSetup({contentType: "application/x-www-form-urlencoded; charset=iso-8859-1"})
		$.ajax({
		  type: "GET",
		  url: "/core/coreSrc/modules/webshop/public/AJAXminusproduct.asp",
		  data: "oCartPostID="+orderCartPostID+"&isInCashier="+isInCashier,
		  error : function(data,string) {alert(string);},
		  success : function (data) {
	  			cartContainer.html("");
				cartContainer.append(data);		
				reAttachWebshopEvents(cartContainer);
			  }
		})
	});
	
	
	/* AJAX EMPTY CART */
	cartContainer.find(".webshopEmptyCart").click(function (){
	  if(confirm("Vill du tömma din varukorg?\nSamtliga produkter kommer att tas ur din varukorg.")){
		  
		var cartContainer 	= $("div.webshopCart");
		var isInCashier		= $(this).find(".isInCashier").text(); 

		$.ajaxSetup({contentType: "application/x-www-form-urlencoded; charset=iso-8859-1"});
		$.ajax({
		  type: "GET",
		  url: "/core/coreSrc/modules/webshop/public/AJAXemptycart.asp",
		  data: "isInCashier="+isInCashier,
		  error : function(data,string) {alert(string);},
		  success : function (data) {
	  			cartContainer.html("");
				cartContainer.append(data);		
				reAttachWebshopEvents(cartContainer);
			  }
		});
		
	  }		
	});
	
	
}

/* --------------------------------------------------------------------- */

});
$(function() { 
/* --------------------------------------------------------------------- */
	var priceTable		= $(".productPriceTable");
	var showPriceButton = $(".showProductlistingPrices");
	var productShow		= $(".productShowPost");
	
	if(showPriceButton.is("*")){
		showPriceButton.each(function(){
		  var currentButton = $(this);
			currentButton.toggle(function(){
				currentButton.parent().find(".productPriceTable").slideDown("fast");	
			},function(){
				currentButton.parent().find(".productPriceTable").slideUp("slow");
			});							  
		});
	}
	

	if(productShow.is("*")){
		productShow.each(function(){
		  var currentButton = $(this);
			currentButton.click(function(){
				document.location = currentButton.attr("theURL");	
			});							  
		});
	}

	if(priceTable.is("*")){
		priceTable.each(function(){
		  var currentPriceTable = $(this);
			currentPriceTable.find("td").toggle(function(){
				$("."+$(this).attr("class")).addClass("choosenCol");
			 },function(){
				$(".choosenCol").removeClass("choosenCol");
			});							  
		});
	}
	
	
/* --------------------------------------------------------------------- */
});

