var currentItem;

function _console_log(msg) {
    if (window.console) {
	console.log(Array.prototype.slice.call(arguments).join(', '));
    }
}

function resizeDocumentTo(setw,seth) {
    window.resizeTo(setw,seth);
    var w = setw*2 - ((typeof window.innerWidth == 'undefined') ? document.body.clientWidth : window.innerWidth);
    var h = seth*2 - ((typeof window.innerHeight == 'undefined') ? document.body.clientHeight : window.innerHeight);
    window.resizeTo(w,h);
}

function resizeatronic(section, w, h, ieW, ieH, ie6W, ie6H) {    
    if(currentItem == section) return;
    currentItem = section;

    // I have dreamed of days when ponies ride free and IE cooperates with all
    if($.browser.msie) {
        if($.browser.version <= 6) {
            window.resizeTo(ie6W, ie6H);
        } else {
            window.resizeTo(ieW, ieH);
        }
    } else if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {
	// chrome needs to be handled differently than others browsers, too - resizeDocumentTo had strange results
        window.resizeTo(ieW-10, ieH-20);
    } else {
        resizeDocumentTo(w, h);
    }
}

function showPlaylist() {
    setTimeout(function() {
        resizeatronic('playlist', 540,545, 550,615, 550,594);
    }, 10);
}

function showShare() {
    setTimeout(function() {
        resizeatronic('share', 540,500, 550,570, 550,549);
    }, 10);
}

function showAbout() {
    setTimeout(function() {
        resizeatronic('about', 540,250, 550,325, 550,304);
    }, 10);
}

function backToNormal() {
    setTimeout(function() {
        resizeatronic('none', 540,164, 550,234, 550,213);
    }, 10);
}
