document ready function Get the properties of the document var trueHei

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
$(document).ready(function(){
/**** Get the properties of the document ****/
var trueHeight = $(document).height();
var visibleHeight = $("body").height();
var visibleWidth = $("body").width();
/**** Set up player appearance ****/
function play(url){
var flashvars = {st:"http://pravbrat.ru/video-content/video15-325.txt",file:url};
var params = {bgcolor:"#f3e5c1", allowFullScreen:"true", allowScriptAccess:"always"};
var attributes = {id:"player",name:"player"};
swfobject.embedSWF("http://pravbrat.ru/video-content/uppod.swf", "player", "500", "375", "9.0.0",false,flashvars, params,attributes);
}
/**** Create and stretch out the matte, create the player in the correct position ****/
$("div.op-element a.openplayer").click(function(){
var flvUrl = $(this).children("span.flv-video").html();
flvUrl = "http://pravbrat.ru/video-content/" + flvUrl;
$("div#player-bg").fadeIn().css("height",trueHeight);
var playerTopMargin = (visibleHeight - 375) / 2;
var playerLeftMargin = (visibleWidth - 500) / 2;
$("div#player-set").show().css("top",playerTopMargin).css("left",playerLeftMargin);
play(flvUrl);
return false;
});
/**** Hide player on user's panic ****/
$("div#player-bg").click(function(){
$("div#player-set").hide();
$(this).fadeOut();
});
/**** Re-estimate position of player on window resize ****/
$(window).resize(function(){
visibleHeight = $("body").height();
visibleWidth = $("body").width();
playerTopMargin = (visibleHeight - 375) / 2;
playerLeftMargin = (visibleWidth - 500) / 2;
$("div#player-set").css("top",playerTopMargin).css("left",playerLeftMargin);
});
});