<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function AddToFavorites(strTitle,strUrl){
	if (document.all){
		window.external.AddFavorite(strUrl,strTitle);
	}
	else if (window.sidebar){
		window.sidebar.addPanel(strTitle,strUrl,"");
	}
}

//Article tip
var gobjSendArticleWin;
function openSendArticleTipWindow(sUrl){
	gobjSendArticleWin=window.open(sUrl,'SendArtTip','width=425,height=420,top=20,left=20,toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0');
	gobjSendArticleWin.focus();
}
function sendArticleTip(sId){
	openSendArticleTipWindow('/include/modules/email/SendArticle.asp?id='+sId);
}

//email verif.
function validateEmailAddress(sEAddress){
	var regex=new RegExp("^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$");
	return regex.test(sEAddress);
}

//Show original/big image in popup
function openWinStripped(doc,width,height)
{
	win=window.open(doc,"","screenX="+width+",screenY="+height+",scrollbars=0,resizable=0,width="+width+",height="+height+",status=0,toolbar=0,menubar=0");
	win.focus();
}

//Default text för snabbsök
function setQuickSearchText(thisElem,thisEvent){
	var sDefText="";
	if (thisEvent=="focus"){
		if (thisElem.value==sDefText) thisElem.value="";
	}
	else{
		if(thisElem.value=="") thisElem.value=sDefText;
	}
}

//Webbfrågan
var gobjVoteResultWindow;
function voteSubmit(iVote,iVoteId){
	gobjVoteResultWindow=window.open('/include/modules/vote/result.asp?id='+iVoteId+'&vote='+iVote,'VoteResultWindow','width=400,height=300,top=300,left=300,toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=0');
	gobjVoteResultWindow.focus();
}

//Översikten
function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}


// Falling ad i högerspalten
function runningAd(sLayerId, iTopOffset, iSlideTime, iCeiling, iFloor) {
	this.runningDiv = null;
	this.layerId = sLayerId;
	this.topOffset = iTopOffset;
	this.slideTime = iSlideTime;
	this.ceiling = iCeiling;
	this.floor = iFloor;
	runningAd.registry[runningAd.registry.length] = this;
}

runningAd.isIE = window.clientInformation ? true : false;
runningAd.isN4 = document.layers ? true : false;
runningAd.isN6 = navigator.appName == "Netscape" && parseInt(navigator.appVersion, 10) >= 5;
runningAd.isO5 = navigator.userAgent.indexOf("Opera") != -1 && parseInt(navigator.appVersion, 10) >= 4;
runningAd.registry = new Array( );
runningAd.callRate = 10;
window.setInterval("runningAd.timer( )", runningAd.callRate);

runningAd.timer = function() {
	for (var i = 0; chObj = this.registry[i]; i++) {
		if (!chObj.runningDiv) {
			chObj.attemptLoad();
//			break;
		}
		if (chObj.runningDiv) {
			chObj.main();
			break;
		}
	}
};

runningAd.prototype.attemptLoad = function() {
	var chDiv = null;
	if (runningAd.isN6 || runningAd.isO5) {
		chDiv = document.getElementById(this.layerId);
	} else if (runningAd.isIE) {
		chDiv = document.all[this.layerId];
	} else if (runningAd.isN4) {
		chDiv = document.layers[this.layerId];
	}
	if (chDiv && chDiv !== null) {
		this.runningDiv = chDiv;
		this.initRunningDiv();
	}
};

runningAd.prototype.initRunningDiv = function() {
	if (this.runningDiv) {
		if (parseInt(this.ceiling, 10) != this.ceiling-0) {
			this.setCeiling();
		}
	this.runningDiv.style.position = "absolute";
//	this.moveTo(this.ceiling + 10);
	this.moveTo(this.ceiling);
	}
};

runningAd.prototype.setCeiling = function() {
	var curtop = 0;
	var tempRunningDiv = this.runningDiv;
	if (tempRunningDiv.offsetParent) {
		curtop = tempRunningDiv.offsetTop;
		while (tempRunningDiv = tempRunningDiv.offsetParent) {
			curtop += tempRunningDiv.offsetTop;
		}
	}
	this.ceiling = curtop;
};

runningAd.prototype.main = function( ) {
	this.currentY = this.getCurrentY();
	var scrollTop = runningAd.getWindowScroll();
	var newTargetY = scrollTop + this.topOffset;
	var floor = runningAd.getDocumentHeight() - this.floor;
	newTargetY = Math.max( newTargetY, this.ceiling);
	if (!runningAd.isO5) {
		newTargetY = Math.min(newTargetY, floor);
	}
	if ( this.currentY != newTargetY ) {
		if ( newTargetY != this.targetY ) {
			this.targetY = newTargetY;
			this.slideInit( );
		}
		this.slide( );
	}
};

runningAd.prototype.slideInit = function( ) {
	this.A = (this.targetY - this.currentY) / this.slideTime / this.slideTime;
	this.startT = (new Date()).getTime();
	this.startP = this.getCurrentY();
	this.D = this.targetY - this.startP;
};

runningAd.prototype.slide = function( ) {
	var elapsed = (new Date()).getTime() - this.startT;
	if (elapsed < this.slideTime) {
		this.moveTo(this.D - (Math.round(Math.pow(this.slideTime - elapsed, 2) * this.A)) + this.startP);
	}
};

runningAd.prototype.moveTo = function(ny) {
	if (runningAd.isN4) { this.runningDiv.top = ny; }
	else { this.runningDiv.style.top = ny + "px"; }
};

runningAd.prototype.getCurrentY = function() {
	var n = runningAd.isN4 ? this.runningDiv.top : parseInt(this.runningDiv.style.top, 10);
	return isNaN(n) ? 0 : n;
};

runningAd.getWindowScroll = function() {
	if (window.pageYOffset) {
		return window.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop) {
		return document.documentElement.scrollTop;
	} else if (document.body && document.body.scrollTop) {
		return document.body.scrollTop;
	} else {
		return 0;
	}
};

runningAd.getDocumentHeight = function() {
	if (window.document.height) {
		return window.document.height;
	} else if (document.body.scrollHeight) {
		return Math.max(document.body.scrollHeight, document.body.offsetHeight);
	} else if (document.documentElement.scrollHeight) {
		return Math.max(document.documentElement.scrollHeight, document.documentElement.offsetHeight);
	} else {
		return 5000;
	}
};

function createRunningAdOnAd1() {
   /* ("google-runner", 25, 1500, null , 0) */
	var StickyPosition1 = new runningAd("runningad", 10, 1200, null , 0);
}

window.onload = createRunningAdOnAd1;

// nwt.se startsida
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

// Show-hide-divs
$(document).ready(function() {
 // hides the slickbox as soon as the DOM is ready
 // (a little sooner than page load)
  $('#bottommenu').hide();
 // shows the slickbox on clicking the noted link
  $('a#menu-show').click(function() {
 $('#bottommenu').show('slow');
 return false;
  });
 // hides the slickbox on clicking the noted link
  $('a#menu-hide').click(function() {
 $('#bottommenu').hide('fast');
 return false;
  });
 // toggles the slickbox on clicking the noted link
  $('a#menu-toggle').click(function() {
 $('#bottommenu').toggle(400);
 return false;
  });
   // hides the slickbox on clicking the noted link
  $('a#ad-hide').click(function() {
 $('#adfullscreen').hide('fast');
return false;
  });
  // toggles the slickbox on clicking the noted link
  $('a#sitemap-toggle').click(function() {
 $('#sitemap').slideToggle(400);
 return false;
  });
});

// Map Google Maps
var markerCenter = null;

function ms_mapLoad(mapId)
{
    if (ms_mapBrowserIsCompatible()) 
    {
      return new GMap2(document.getElementById(mapId));
    }
    return null;
}

function ms_mapAddCoord(map, longitude, latitude, text, markerImage, markerTextOnHover) 
{
	if (ms_mapBrowserIsCompatible()) 
	{
        var markerIcon = new GIcon(G_DEFAULT_ICON);
        markerIcon.image = markerImage;
        markerIcon.iconAnchor = new GPoint(10, 34);
		var markerOptions = { icon:markerIcon, title: markerTextOnHover };        
		
		var point = new GLatLng(latitude, longitude);
	    var marker = new GMarker(point, markerOptions);
	    
        if (text != '')
        	GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(text);});
	    
	    map.addOverlay(marker);
	}
}

function ms_mapSetCenter(map, longitude, latitude, zoom) 
{
	if (ms_mapBrowserIsCompatible()) 
	{
	    map.setCenter(new GLatLng(latitude, longitude), zoom);
	}
}

function ms_mapBrowserIsCompatible()
{
	return GBrowserIsCompatible();
}

function ms_mapFindCoordinates(map, address)
{
  var geocoder = null;
  geocoder = new GClientGeocoder();

  if (geocoder) 
  {
    geocoder.getLatLng(
      address,
      function(point) {
        if (!point) {
          alert(address + " ej funnen");
        } else {
          ms_mapSetCenter(map, point.x, point.y, map.getZoom());
          var marker = new GMarker(point);
          map.addOverlay(marker);
          marker.openInfoWindowHtml(address);
          document.getElementById("longitude").value = point.x;
          document.getElementById("latitude").value = point.y;
          document.getElementById("zoom").value = map.getZoom();
        }
      }
    );
  }
}

function ms_mapAddControls(map)
{
	if (ms_mapBrowserIsCompatible)
	{
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
	}
}

function ms_mapFindCoordMoveEvent(map)
{
	GEvent.addListener(map, "moveend", function() 
	{
	    document.getElementById("centerLongitude").value = map.getCenter().lng();
	    document.getElementById("centerLatitude").value = map.getCenter().lat();
	    document.getElementById("zoom").value = map.getZoom();
	    
	    if (markerCenter != null)
		    map.removeOverlay(markerCenter);
	    
	    var point = new GLatLng(map.getCenter().lat(), map.getCenter().lng());
        var marker = new GMarker(point);
	    map.addOverlay(marker);
	    markerCenter = marker;
   });
}

// Map Interface
function mapLoad(mapId)
{
	return ms_mapLoad(mapId);
}

function mapAddCoord(map, longitude, latitude, text, markerImage, markerTextOnHover)
{
	ms_mapAddCoord(map, longitude, latitude, text, markerImage, markerTextOnHover);
}

function mapSetCenter(map, longitude, latitude, zoom)
{
	ms_mapSetCenter(map, longitude, latitude, zoom);
}

function mapBrowserIsCompatible()
{
	return ms_mapBrowserIsCompatible();
}

function mapFindCoordinates(map, address)
{
	ms_mapFindCoordinates(map, address);
}

function mapAddControls(map)
{
	ms_mapAddControls(map);
}

function mapFindCoordMoveEvent(map)
{
	ms_mapFindCoordMoveEvent(map);
}
