﻿function PageInit() {

    // png fix
    jQuery(document).pngFix(); 
    // setup pretty photo galleries
    jQuery("a[rel^='prettyPhoto']").prettyPhoto({ theme: 'facebook' });

    // setup jPlayer
    // Local copy of jQuery selectors, for performance.
//    
//        var jpPlayInfo = jQuery("#play-info");
//        if(document.getElementById("playlist")!==null){ 
//            var playList = document.getElementById("playlist").getElementsByTagName("a");
//        }
//        var trackNumber = 0

//        jQuery("#jquery_jplayer").jPlayer("onSoundComplete", function() {
//            jQuery("#jquery_jplayer").jPlayer("clearFile");
//            trackNumber++
//            jQuery("#jquery_jplayer").jPlayer("setFile", playlist[trackNumber].attributes("href")).jPlayer("play");
//        });

//        jQuery(".track01").click(changeTrack);
//        jQuery(".track02").click(changeTrack);
//    

//    function changeTrack(e) {
//        jQuery("#trackname").text(jQuery(this).text());
//        jQuery("#jquery_jplayer").jPlayer("setFile", jQuery(this).attr("href")).jPlayer("play");
//        jQuery(this).blur();
//        return false;
//    }

//    // set mouse over
//    jQuery(".browser").mouseover(function() {
//        jQuery(".browser").stop().animate({
//            marginTop: "-160px"
//        }, { "duration": 250, queue: false })
//    });

//    // set mouse out
//    jQuery(".browser").mouseout(function() {
//        jQuery(".browser").stop().animate({
//            marginTop: "-25px"
//        }, { "duration": 1000, queue: false })
//    });

//    // set browser items mouseover
//    jQuery('li.item a').mouseover(function() {

//        jQuery(this).stop().animate({
//            top: "-160px"
//        }, { "duration": 50, queue: false })
//    });

//    // set browser items mouseout
//    jQuery('li.item').mouseout(function() {
//        jQuery('li.item a').stop().animate({
//            top: "-120px"
//        }, { "duration": 200, queue: false })
//    });
//    
//    // setup browser
//    document.body.height = document.documentElement.clientHeight;
//    jQuery(".browser").animate({
//            height: "200px"
//    }, { "duration": 500, queue: false })
}

function view(request, width, height, title, description, type) {
    width = (width == "") ? "500" : width;
    height = (height == "") ? "500" : height;
    type = (type == undefined) ? null : type;
    description = (description == "" || description == undefined) ? "" : description;
    var frameSrc = request.href;
    title = (title == "undefined" ? request.title : title)
    if (type == null) {
        frameSrc = frameSrc + "?&iframe=true&width=" + width + "&height=" + height;
    }
    jQuery.prettyPhoto.open(frameSrc, description, title);
}
