﻿// JScript File
function bookmark_us(url, title){

if (window.sidebar) // firefox
    window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
    var elem = document.createElement('a');
    elem.setAttribute('href',url);
    elem.setAttribute('title',title);
    elem.setAttribute('rel','sidebar');
    elem.click();
} 
else if(document.all)// ie
    window.external.AddFavorite(url, title);
    
return false;
}

function maxi() {
    self.moveTo(0, 0);
    self.resizeTo(screen.availWidth, screen.availHeight);
    $j("body").sImgSize();

}

$j(document).ready(function() {
var b = $j('body').height();
var d = $j(document).height();
var h = $j('html').height();
//alert('body:' + b);
//alert('doc:' + d);
//alert('html:' + h);
    adjust();
});

$j(window).resize(function() {

var h = $j('html').height();
//alert('html:' + h);
    adjust();
});

function adjust() {
    var b = $j('html').height();
   // var b = $j(document).height() - 500;
    var w = $j(document).width() + 20;
    var bi = $j('body').css("background-image");
    var l = bi.length;
    var f = bi.substring(5, l - 2);
    var h1 = $j('.header').height() - 500;
    
    if (b < 850) {
        if ((b - 500) > 100) {
    //        $j('body').css("background-position", "center " + ((b - 850) / 2));
          //  $j('.header').css("min-height", 850 + ((b - 850) * 1.5) + "px");
        }
        $j('body').css("background-position", "center center");
       // alert($j('.header').css("min-height"));
        //alert(b);
        b = b - 500;
        if (b > 100) {
            $j('.showreel').css("margin-top", b / 2 + "px");
        }
        else
            $j('.showreel').css("margin-top", "20px");
        //$j('.header').css("min-height", ((b - 800) / 2)));
    }
    else {
       $j('body').css("background-position", "center top");
        $j('.header').css("max-height", "850px");
        b = b - 500;
        if (b > 100 && b < 400) {
            $j('.showreel').css("margin-top", b / 2 + "px");
        }
        else if (b >= 400) {
            $j('.showreel').css("margin-top", "200px");
        }
        else
            $j('.showreel').css("margin-top", "20px");
    }
    // $j('body').css("background-image", "url('" + f + "?maxheight=" + h + "')");
    // alert($j('body').css("background-image"));
    $j('.showreel').css("display", "block");
}


function showVid(vid) {
    var player = $f("player", "/flash/flowplayer-3.2.7.swf");
    
    $j('#videoplayer').modal(
    { 
        onShow: function(dialog) {
            // Access elements inside the dialog
            // Useful for binding events, initializing other plugins, etc.
            player.load();
            autoBuffering: true;
            player.play(vid);

        // For example:
    }


    });
}
