function fallout(tab)
{
	if(eval("document.getElementById('tab_" + tab + "').style.display") == "none")
	{
		eval("document.getElementById('tab_" + tab + "').style.display = 'block'");
		eval("document.getElementById('img_" + tab + "').src = '/lib/img/arrow_red_down.gif'");
	}
	else
	{
		eval("document.getElementById('tab_" + tab + "').style.display = 'none'");
		eval("document.getElementById('img_" + tab + "').src = '/lib/img/arrow_red_right.gif'");
	}
}

function isEmail(sEmail)
{
	var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	if(!re.test(sEmail))
	{
		alert("E-postadressen är felaktig!\nVar god ange en korrekt e-postadress.");
	}
	return(re.test(sEmail));
}

function openwin(url, name, width, height)
{
	//center the window on the screen
	var w = 480, h = 340;
	
	w = screen.availWidth; //document.body.clientWidth;
	h = screen.availHeight; //document.body.clientHeight;

	var leftPos = (w-width)/2, topPos = (h-height)/2;
	
	msgWindow = open(url, name,'menubar=0,status=0,scrollbars=1,resizable=1,toolbar=0,location=0,width=' + width + ',height=' + height + ',top=' + topPos + ',left=' + leftPos);
	msgWindow.focus;
	return msgWindow;
}

function printPage() {
    var da = (document.all) ? 1 : 0;
    var pr = (window.print) ? 1 : 0;

    if (!pr)
        return;

    var printArea = document.getElementById("mainareadiv");

    if (printArea == null && da)
        printArea = document.all.mainareadiv;

    if (printArea) {
        var sStart = "<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"/styles/structure.css\"><link rel=\"stylesheet\" type=\"text/css\" href=\"/styles/editor.css\"><link rel=\"stylesheet\" type=\"text/css\" href=\"/styles/units.css\"></head><body onload=\"javascript:window.print();\">";
        sStop = "</body></html>";

        var w = window.open('', 'printWin', 'width=650,height=440,scrollbars=yes');
        wdoc = w.document;
        wdoc.open();
        wdoc.write(sStart + printArea.innerHTML);
        wdoc.writeln(sStop);
        wdoc.close();
    }
}

//$(function() {
	
//	$('#hh_play_twitter .content').twittersearch({
//		tag			: 'japan',
//		count		: 10,
//		avatar	: false,
//		
//		from					: 'Fr' + unescape("%E5") + 'n ',
//		seconds_ago		: ' sekunder sedan',
//		a_minute_ago	: 'en minut sedan',
//		minutes_ago		: ' minuter sedan',
//		an_hour_ago		: 'en timme sedan',
//		hours_ago			: ' timmar sedan',
//		a_day_ago			: 'en dag sedan',
//		days_ago			: ' dagar sedan',
//		about					: 'ungef' + unescape("%E4") + 'r ',
//		on_success: function() {
//			$(this).jScrollPane();
//		}
//	});
	
	// Main video
//	setTimeout(function() {
//		
//		if ( $('.main_video .bambuser').length > 0 ) {
//			$('.main_video .bambuser').html( '<object id="bplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="620" height="380"><embed name="bplayer" src="http://static.bambuser.com/r/player.swf?vid=' + $('.main_video .bambuser').attr('id').replace('video-', '') + '" type="application/x-shockwave-flash" width="620" height="380" allowfullscreen="true" allowscriptaccess="always" wmode="opaque"></embed><param name="movie" value="http://static.bambuser.com/r/player.swf?vid=' + $('.main_video .bambuser').attr('id').replace('video-', '') + '"></param><param name="allowfullscreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="wmode" value="opaque"></param></object>' );
//		}
//		
//		if ( $('.main_video .youtube').length > 0 ) {
//			$('.main_video .youtube').html('<iframe id="rand' + Math.round( Math.random() * 100 ) + '" width="620" height="380" src="http://www.youtube.com/embed/' + $('.main_video .youtube').attr('id').replace('video-', '') + '" frameborder="0" allowfullscreen></iframe>');
//		}
//		
//	}, 500);
	
//});
