// find what browser the user uses
if( navigator.appName == 'Microsoft Internet Explorer' )
browser_ie = true;
else
browser_ie = false;
function createAjax()
{
var xmlHttp;
try
{
xmlHttp=new XMLHttpRequest();
}
catch(e)
{
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); //ie6
}
catch(e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); //ie5
}
catch(e)
{
return false;
}
}
}
return xmlHttp;
}
function getContent(mode, tab_number)
{
var image;
var big_tabs = new Array( 5, 11 );
var tabs_number = new Array( 1, 3, 5, 7, 9, 11, 13 );
number = tabs_number[tab_number];
var tabs = document.getElementById('homepage_tabs');
if( browser_ie == true )
{
big_tabs = new Array(2, 5);
tabs_number = new Array( 0, 1, 2, 3, 4, 5, 6 );
number = tabs_number[tab_number];
for( i=0; i<7; i++ )
{
if( i == big_tabs[0] || i == big_tabs[1] )
image = 'bigdarktab';
else
image = 'smalldarktab';
tabs.childNodes[i].style.background = 'url(images/'+image+'.jpg)';
}
big_tab = 2;
}
else
{
for( i=1; i<=13; i+=2 )
{
if( i == big_tabs[0] || i == big_tabs[1] )
image = 'bigdarktab';
else
image = 'smalldarktab';
tabs.childNodes[i].style.background = 'url(images/'+image+'.jpg)';
}
}
if( number == big_tabs[0] || number == big_tabs[1] )
image = 'biglighttab';
else
image = 'smalllighttab';
tabs.childNodes[number].style.background = 'url(images/'+image+'.jpg)';
var xmlHttp = createAjax();
xmlHttp.onreadystatechange = function()
{
if(xmlHttp.readyState == 4)
{
document.getElementById('featured_music').innerHTML=xmlHttp.responseText;
}
}
var url='http://www.muzilla.net/ajaxedcontent.html';
var param="mode="+mode;
xmlHttp.open("POST", url, true);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-Length", param.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(param);
}
/*
* send request for the player
*/
function loadPlayer( song_id )
{
var xmlHttp = createAjax();
xmlHttp.onreadystatechange = function()
{
if(xmlHttp.readyState == 4)
{
var playlist = xmlHttp.responseText;
if( playlist.length > 0 )
document.getElementById('song_'+song_id).innerHTML = '';
/*
text = text.replace(/#playlist#/g, playlist);
document.getElementById('song_'+song_id).innerHTML = text;
document.getElementById('song_'+song_id).visibility = 'visible';
*/
}
}
var url = 'http://www.muzilla.net/player_ajax.html';
var param = "song_id="+song_id;
xmlHttp.open("POST", url, true);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-Length", param.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(param);
}
/*
* show/hide the details box for each release
*/
function albumArt( id )
{
var albums = document.getElementById('album_arts');
var album_id;
for( i=0; i0 )
{
album_id = albums.childNodes[i].childNodes[b].childNodes[1].childNodes[2].id;
var albumChild = 2;
// alert(album_id);
if( album_id == false || album_id == undefined ) // IE case
{
if( albums.childNodes[i].childNodes[b].childNodes[0].childNodes[1] )
{
album_id = albums.childNodes[i].childNodes[b].childNodes[0].childNodes[1].id;
var albumChild = 1;
}
else
album_id = albums.childNodes[i].childNodes[b].childNodes[1].childNodes[1].id;
}
if( album_id == id )
{
if( albums.childNodes[i].childNodes[b].childNodes[albumChild].style.display == 'none' || albums.childNodes[i].childNodes[b].childNodes[1].style.display == '' )
albums.childNodes[i].childNodes[b].childNodes[albumChild].style.display = 'block';
}
else if ( albums.childNodes[i].childNodes[b].childNodes[albumChild].style.display == 'block' )
albums.childNodes[i].childNodes[b].childNodes[albumChild].style.display = 'none';
}
}
}
return false;
}
//get the width and the height of the display
if( browser_ie == true )
{
width = document.documentElement.clientWidth;
height = document.documentElement.clientHeight;
if( width == 0 || height == 0 )
{
width = document.body.clientWidth;
height = document.body.clientHeight;
}
}
else
{
width = window.innerWidth;
height = window.innerHeight;
}
/*
* display and position the popup
* then load the info
*/
function loadPopup( mode, url, artist_url, album_url, song_url )
{
var crd = getScrollXY();
// set some styles with the default values
document.getElementById('inner').style.padding = '0px';
document.getElementById('details_urls').style.display = 'none';
document.getElementById('innerImage').style.padding = '0px';
document.getElementById('lyricsBox').innerImage = '';
if( mode == 'youtube' )
{
document.getElementById('popup').style.left = (width/2) - 231+'px';
document.getElementById('popup').style.top = crd[1] + 90+'px';
document.getElementById('inner').style.left = (width/2) - 215+'px';
document.getElementById('inner').style.top = crd[1] + 100+'px';
document.getElementById('inner').style.width = 425 + 'px';
document.getElementById('inner').style.display = "block";
document.getElementById('popup').style.display = "block";
document.getElementById('popup').style.width = 451 + 'px';
document.getElementById('popup').style.height = 368 + 'px';
if( browser_ie == true )
{
document.getElementById('thetable').style.width = 419 + 'px';
document.getElementById('thetable').style.height = 344 -26 + 'px';
}
document.getElementById('innerImage').style.width = '425px';
document.getElementById('innerImage').style.height = '344px';
document.getElementById('innerImage').style.background = "url('http://www.muzilla.net/images/loader.gif') center center no-repeat";
document.getElementById('innerImage').innerHTML = document.getElementById(url).innerHTML;
}
else if( mode == 'flickr' )
{
loading('show');
document.getElementById('popup').style.display = "none";
document.getElementById('inner').style.display = "none";
document.getElementById('innerImage').style.width = 0;
document.getElementById('innerImage').style.height = 0;
var to_show = '
';
if( browser_ie == true )
{
//document.getElementById('popup').style.display = "none";
document.getElementById('innerImage').innerHTML = to_show;
}
else
{
document.getElementById('loader_temp').innerHTML = to_show;
//document.getElementById('innerImage').innerHTML = to_show;
}
document.getElementById('popup').style.left = 0;//Math.round(width/2) - 150+'px';
document.getElementById('popup').style.top = 0;//(crd[1]) + 100+'px';
document.getElementById('inner').style.left = Math.round(width/2) - 150+'px';
document.getElementById('inner').style.top = (crd[1]) + 100+'px';
showPopup();
}
else if( mode == 'lyrics' )
{
document.getElementById('innerImage').style.display = "inline";
document.getElementById('innerImage').style.background = "";
var lyric = lyrics[url];
lyric = lyric.replace(/#@#b/g, '');
document.getElementById('innerImage').innerHTML = ''+ lyric +'';
document.getElementById('lyricsBox').style.overflow = "auto";
document.getElementById('innerImage').style.padding = '5px';
document.getElementById('inner').style.width = 395 + 'px';
document.getElementById('inner').style.padding = '2px 0px 3px 0px';
document.getElementById('popup').style.width = 421 + 'px';
document.getElementById('popup').style.height = 533 + 'px';
document.getElementById('lyricsBox').style.width = 390 + 'px';
document.getElementById('lyricsBox').style.height = 500 + 'px';
document.getElementById('innerImage').style.width = 390 + 'px';
document.getElementById('innerImage').style.height = 500 + 'px';
document.getElementById('inner').style.display = "block";
document.getElementById('popup').style.display = "block";
if( browser_ie == true )
{
document.getElementById('popup').style.width = 418 + 'px';
document.getElementById('popup').style.height = 504 + 'px';
document.getElementById('lyricsBox').style.height = 466 + 'px';
document.getElementById('innerImage').style.height = 470 + 'px';
document.getElementById('thetable').style.width = 415 + 'px';
document.getElementById('thetable').style.height = 450 + 'px';
}
$(function()
{
$('#lyricsBox').jScrollPane();
});
//===== Show the details links if any
if( artist_url.length > 5 )
{
var c = 0;
var left_links = document.getElementById('details_urls');
left_links.innerHTML = '';
if( song_url.length > 1 )
{
left_links.innerHTML += 'song';
c++;
}
if( album_url.length > 1 )
{
left_links.innerHTML += 'album';
c++;
}
if( artist_url.length > 1 )
{
left_links.innerHTML += 'artist';
c++;
}
if( c == 3 )
var element_width = 94;
else
var element_width = 96;
document.getElementById('details_urls').style.width = element_width*c + 'px';
left_links.style.display = 'inline';
}
//===== Position the divs
document.getElementById('popup').style.left = (width/2) - 200 - 16 + 'px';
document.getElementById('popup').style.top = crd[1] + 90 + 'px';
document.getElementById('inner').style.left = (width/2) - 200+'px';
document.getElementById('inner').style.top = crd[1] + 100+'px';
}
return false;
}
function showPopup()
{
var crd = getScrollXY();
if( browser_ie == true )
{
document.getElementById('inner').style.display = "block";
var imageWidth = document.getElementById('flickrpic').width;
var imageHeight = document.getElementById("flickrpic").height;
if( imageWidth > 66 ) // bug in IE shows > 0 even if the image is not loaded
{
var width = window.innerWidth;
if( width == undefined )
width = document.body.clientWidth;
document.getElementById('popup').style.left = (width/2) - Math.round(imageWidth/2)+'px';
document.getElementById('inner').style.left = (width/2) - Math.round(imageWidth/2)+'px';
document.getElementById('inner').style.width = imageWidth + 'px';
document.getElementById('thetable').style.width = imageWidth + 'px';
document.getElementById('thetable').style.height = imageHeight -26 + 'px';
document.getElementById('closeItPopup').style.display = 'block';
document.getElementById('popup').style.width = imageWidth + 26 + 'px';
document.getElementById('popup').style.height = imageHeight + 'px';
//===== Position the divs
document.getElementById('popup').style.left = (width/2) - (imageWidth/2) - 16 + 'px';
document.getElementById('popup').style.top = crd[1] + 94 + 'px';
document.getElementById('inner').style.left = (width/2) - (imageWidth/2) + 1 +'px';
document.getElementById('inner').style.top = crd[1] + 104+'px';
loading('hide');
document.getElementById('popup').style.display = "inline";
// document.getElementById('inner').style.display = "block";
}
else
setTimeout("showPopup()", 50);
}
else
{
var imageWidth = document.getElementById("flickrpic").width;
if( imageWidth > 15 )
{
width = window.innerWidth;
height = window.innerHeight;
document.getElementById('innerImage').innerHTML = document.getElementById('loader_temp').innerHTML;
// document.getElementById('loader_temp').innerHTML = '';
imageWidth = document.getElementById("flickrpic").width;
var imageHeight = document.getElementById("flickrpic").height;
if( imageWidth == 0 || imageWidth == null )
setTimeout("showPopup()", 50);
document.getElementById('popup').style.width = imageWidth + 26 + 'px';
document.getElementById('popup').style.height = imageHeight + 23 + 'px';
//===== Position the divs
document.getElementById('popup').style.left = (width/2) - (imageWidth/2) - 16 + 'px';
document.getElementById('popup').style.top = crd[1] + 90 + 'px';
document.getElementById('inner').style.left = (width/2) - (imageWidth/2)+'px';
document.getElementById('inner').style.top = crd[1] + 100+'px';
document.getElementById('inner').style.width = imageWidth + 'px';
if( imageWidth > 0 )
{
loading('hide');
document.getElementById('popup').style.display = "inline";
document.getElementById('inner').style.display = "block";
}
}
else
setTimeout("showPopup()", 50);
}
}
function point_it(event)
{
pos_x = event.offsetX ? (event.offsetX) : event.pageX - document.getElementById("pointer_div").offsetLeft;
pos_y = event.offsetY ? (event.offsetY) : event.pageY - document.getElementById("pointer_div").offsetTop;
document.getElementById("cross").style.left = (pos_x-1) ;
document.getElementById("cross").style.top = (pos_y-15) ;
document.getElementById("cross").style.visibility = "visible" ;
document.pointform.form_x.value = pos_x;
document.pointform.form_y.value = pos_y;
}
function getScrollXY()
{
var scrOfX = 0, scrOfY = 0;
if( typeof( window.pageYOffset ) == 'number' )
{
//Netscape compliant
scrOfY = window.pageYOffset;
scrOfX = window.pageXOffset;
}
else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )
{
//DOM compliant
scrOfY = document.body.scrollTop;
scrOfX = document.body.scrollLeft;
}
else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) )
{
//IE6 standards compliant mode
scrOfY = document.documentElement.scrollTop;
scrOfX = document.documentElement.scrollLeft;
}
return [ scrOfX, scrOfY ];
}
/* close the popup window */
function closePopup()
{
document.getElementById('popup').style.display = 'none';
document.getElementById('inner').style.display = 'none';
document.getElementById('innerImage').innerHTML = '';
return false;
}
function loading(mode)
{
if( mode == 'show' )
{
var crd = getScrollXY();
if(navigator.appName.indexOf("Microsoft") != -1 )
{
winW = document.body.offsetWidth;
winH = document.body.offsetHeight;
}
else
{
winW = window.innerWidth;
winH = window.innerHeight;
}
document.getElementById('loading').style.left = (winW/2) - 100 + 'px';
document.getElementById('loading').style.top = crd[1] + (winH/2) - 50 + 'px';
document.getElementById('loading').style.display = 'block';
}
else
document.getElementById('loading').style.display = 'none';
}
/*
* show/hide the box with the different types of releases
*/
function openAlbumType(id)
{
var albums = document.getElementById('album_arts');
var album_id;
for( i=0; i 0 ? 0 : '' ) + (seconds % 60) + ( seconds % 60 == 0 ? 0 : '' );
}
function whatTime()
{
var text = 'this_is';
text += '_now';
document.getElementById('what_time').value = text;
}
function bindClicker()
{
$("[rel=nofollow]").each( function(i){
var url = $(this).attr('href');
if( url && url.match('/visits/') && $(this).attr('rev') != 'clickerd' )
{
$(this).attr('rev', 'clickerd');
$(this).click(function(e) {
clicker($(this).attr('href'), $(this).attr('title') );
});
}
});
}
function clicker(href, title)
{
$.post('http://www.muzilla.net/clicker.html', {'target': href, 'title': title});
}