
/*** Oikean palstan sisältö alkaa ***/
document.write('<div id="floating-div">');
document.write('	<div style="margin-bottom: 20px; float: left;">');
document.write('		<div style="clear: both; padding-bottom: 20px;">');
document.write('			<script src="http://connect.facebook.net/fi_FI/all.js#xfbml=1"></script><fb:like href="http://www.mustalista.biz" layout="button_count" font="arial" colorscheme="dark"></fb:like>');
document.write('		</div>');
document.write('		<div style="clear: both;">');
document.write('			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.mustalista.biz" data-count="horizontal" data-via="S1mppa">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>');
document.write('		</div>	');
document.write('		<div style="clear: both; padding-top: 10px;">');
document.write('			<p><strong>Musta Lista muualla:</strong></p>');
document.write('			<a href="https://www.facebook.com/pages/Musta-Lista/154216654622418"><img SRC="img/facebook_logo.png" alt="Facebook"  title="Facebook" width="38" height="38" border="0" target="_blank" /></a>');
document.write('			<a href="http://www.mikseri.net/artists/?id=115731"><IMG SRC="img/mikseri_logo3.png" alt="Mikseri.net" title="Mikseri.net" width=38 height=38 border=0 target="_blank" /></a>');
document.write('			<a href="http://www.myspace.com/mustalista1"><IMG SRC="img/myspace-logo.png" alt="MySpace" title="MySpace" width=38 height=38 border=0 target="_blank" /></a>');
document.write('		</div>'); 
document.write('		<div style="clear: both; padding-top: 5px;">');
document.write('			<a href="http://maihinnousu.net/a/1703"><IMG SRC="img/maihinnousu_logo.gif" alt="Maihinnousu" title="Maihinnousu" width=55 height=38 border=0 target="_blank" /></a>');
document.write('			<a href="http://www.hitlantis.com/#/musta-lista"><img width="38" height="38" alt="Hitlantis" title="Hitlantis" src="img/hitlantis.png" border="0" complete="complete" target="_blank"/></a>');
document.write('		</div>');
document.write('		<div style="clear: both; padding-top: 5px;">');
document.write('			<img style="visibility:hidden;width:0px;height:0px;" border=0 width=0 height=0 src="http://counters.gigya.com/wildfire/IMP/CXNID=2000002.0NXC/bT*xJmx*PTEyODk2Nzg*NTQzNzUmcHQ9MTI4OTY3ODYyMjM3NSZwPTI3MDgxJmQ9YmFubmVyX2ZpcnN*X2dlbiZnPTEmbz*wZjdm/YzhhZWIxNjM*ODlhYTIxOWQyYzI2NmZhOGY4OSZvZj*w.gif" />');
document.write('			<a href="http://www.reverbnation.com/c./a4/2383381/1099930/Artist/1099930/Artist/link"><img alt="Musta Lista" border="0" src="http://www.reverbnation.com/c./a3/2383381/1099930/Artist/1099930/Artist/res.gif?1" /></a>');
document.write('			<a href="http://www.quantcast.com/p-05---xoNhTXVc" target="_blank"><img src="http://pixel.quantserve.com/pixel/p-05---xoNhTXVc.gif" style="display: none" border="0" height="1" width="1" alt="Quantcast"/></a>');
document.write('		</div>');
document.write('		<div style="clear: both; padding-top: 5px;">');
document.write('			<a href="musiikki_popup.html?KeepThis=true&TB_iframe=true&height=400&width=400" class="thickbox ohjelmisto-link">Ohjelmisto</a>');
document.write('		</div>');
document.write('	</div>');
document.write('</div>');
/*** Oikean palstan sisältö loppuu ***/

$(document).ready(function()
{
	/*** Asetukset ***/
	// Oikean palstan marginaali yläreunasta
	var topMargin = 0;
	// Oikean palstan marginaali oikeasta reunasta
	//var rightMargin = 260;
	var rightMargin = 175;
	// x-koordinaatti, jonka jälkeen oikeaa palstaa ei enää siirretä vasemmalle. 
	var minWindowWidth = 1124;
	//var minWindowWidth = 1420;
	/*** Asetukset ***/
	
	if ($(window).width() < minWindowWidth) {
		$("#floating-div").css("left", minWindowWidth + "px");
	} else {
		$("#floating-div").css("left",($(window).width() - rightMargin) + "px");
	}
	$("#floating-div").css("top",($(window).scrollTop() + topMargin) + "px");
	$("#floating-div").css("visibility","visible");
	var docHeight = $(document).height();
	
	//alert(($(window).height() + $("#floating-div").height()));
	//alert((docHeight + topMargin));
	$(window).scroll(function()
	{
		if ($(window).width()>= minWindowWidth) {
			$("#floating-div").css("left",($(window).width() - rightMargin) + "px");
		} else {
			$("#floating-div").css("left",(minWindowWidth - rightMargin) + "px");
		}
		//if (($(window).height() + $("#floating-div").height()) < (docHeight + topMargin)) {
		if (($(window).scrollTop() + $("#floating-div").height()) > (docHeight + topMargin)) {
			$("#floating-div").css("top",topMargin);
		} else {
			$("#floating-div").css("top",($(window).scrollTop() + topMargin) + "px");
		}
		
	});
	$(window).resize(function()
	{
		//window.status = $(window).width();
		if ($(window).width()>= minWindowWidth) {
			$("#floating-div").css("left",($(window).width() - rightMargin) + "px");
		}else {
			$("#floating-div").css("left",(minWindowWidth - rightMargin) + "px");
		}
		if (($(window).height() + $("#floating-div").height()) < (docHeight + topMargin)) {
			$("#floating-div").css("top",topMargin);
		} else {
			$("#floating-div").css("top",($(window).scrollTop() + topMargin) + "px");
		}
	});
});
