/*$( function()
{
    $( '#menu ul ul' ).hide();

    var lastli = false;
    var lastsub = false;
    $( '#menu li' ).mouseover(
        function()
        {
            var sub = $( this ).find( 'ul' );
            if( sub.length )
            {
                lastli = $( this );
                lastsub = sub;
                $( document.body ).append( sub );
                var pos = $( this ).getPos();
                sub.css( 'top', pos.top + 20 ).css( 'left', pos.left );
                sub.addClass( 'menu-sub' );
                sub.show();
            }
        }
    );

    $( document ).mousemove(
        function( e )
        {
            var sub = lastsub;
            var domsub = sub.get(0);
            var top = sub.css( 'top' );
            var left = sub.css( 'left' );
            var bottom = top + domsub.offsetHeight;
            var right = left + domsub.offsetWidth;

            if(
                e.pageY < bottom &&
                e.pageY > top &&
                e.pageX < right &&

            )
            {
                lastli.append( sub );
                sub.hide();
            }
        }
    );
} );
*/

sfHover = function() {
    if(document.getElementById("nav")){
    	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
    	for (var i=0; i<sfEls.length; i++) {
    		sfEls[i].onmouseover=function() {
    		    //this.parentNode.style.height = this.parentNode.offsetHeight+'px';
    			this.className+=" sfhover";
    		}
    		sfEls[i].onmouseout=function() {
    			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
    		}
    	}
    }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

var Feedback = function()
{
	this.init();
}

Feedback.prototype = {

	div: false,

	init: function()
	{
		var div = $( '#feedback' );
		if( !div.length )
		{
			div = this.createFeedback();
		}
		this.div = div;
		$( document.body ).append( div );
	},

	createFeedback: function()
	{
		var div = $( '<div id="feedback"><h2>Meddelande</h2><ul></ul>\
				<input type="submit" id="feedbacksubmit" onclick="this.parentNode.parentNode.removeChild( this.parentNode );return false;" value="OK" class="button_small"></div>' );

		return div;
	},

	addFeedback: function( str )
	{
		var found = false;
		this.div.find( 'li' ).each(
			function()
			{
				if( $( this ).html() == str ) found = true;
			}
		);

		if( !found )
		{
			this.div.find( 'ul' ).append( $( '<li>'+ str +'</li>' ) );
		}
	},

	removeFeedback: function()
	{
		this.div.remove();
	}

};

function getPageSize()
{
	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY) {
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;

	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth;
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = xScroll;
	} else {
		pageWidth = windowWidth;
	}

	arrayPageSize = {width:pageWidth,height:pageHeight,winwidth:windowWidth,winheight:windowHeight};
	return arrayPageSize;
}