var cardWidth=312;
var minWidth=944;
window.onload=function()
{
    window.onresize();
}

window.onresize=function()
{
    var maxWidth=document.body.offsetWidth;
    n=Math.floor(maxWidth/cardWidth);
    w=n*cardWidth;
    setPlayerWidth("content",w+"px");
    CWidth=f_clientWidth();
    w=(CWidth>minWidth)?CWidth:minWidth;
    CHeight=f_clientHeight();
    h=getElementHeight("wrapper")+20;
    h=(h>CHeight)?h:CHeight;
    setPlayerWidth("flash",w+"px");
    setPlayerHeight("flash",h+"px");
    w=getElementWidth("flash");
}

function centerDiv()
{
    var maxWidth=document.body.offsetWidth;
    n=Math.floor(maxWidth/cardWidth);
    w=n*cardWidth;
    alert(w);
    setPlayerWidth("content",w+"px");
}
function getClientHeight()
{
    var test1=document.body.scrollHeight;
    var test2=document.body.offsetHeight;
    if(test1>test2)
    {
        return document.body.scrollHeight;
    }
    else
    {
        return document.body.offsetHeight;
    }
}

function getClientWidth()
{
    var test1=document.body.scrollWidth;
    var test2=document.body.offsetWidth;
    if(test1>test2)
    {
        return document.body.scrollWidth;
    }
    else
    {
        return document.body.offsetWidth;
    }
}

function getElementWidth(id)
{
    if(document.getElementById)
    {
        oWidth=document.getElementById(id).offsetWidth;
    }
    else if(document.layers)
    {
        oWidth=document.layers[id].clip.width;
    }
    return oWidth;
}

function getElementHeight(id)
{
    if(document.getElementById)
    {
        oHeight=document.getElementById(id).offsetHeight;
    }
    else if(document.layers)
    {
        oHeight=document.layers[id].clip.height;
    }
    return oHeight;
}

function setPlayerWidth(id,h)
{
    //var fpDiv=getElement(id);
    //var stl=fpDiv.style;
    //stl.width=h;
}

function setPlayerHeight(id,h)
{
   // var fpDiv=getElement(id);
   // var stl=fpDiv.style;
   // stl.height=h;
}

function getElement(id)
{
    return document.getElementById?document.getElementById(id):(document.all?document.all[id]:null);
}

function f_clientWidth()
{
    return f_filterResults(window.innerWidth?window.innerWidth:0,document.documentElement?document.documentElement.clientWidth:0,document.body?document.body.clientWidth:0);
}
function f_clientHeight()
{
    return f_filterResults(window.innerHeight?window.innerHeight:0,document.documentElement?document.documentElement.clientHeight:0,document.body?document.body.clientHeight:0);
}

function f_scrollLeft()
{
    return f_filterResults(window.pageXOffset?window.pageXOffset:0,document.documentElement?document.documentElement.scrollLeft:0,document.body?document.body.scrollLeft:0);
}

function f_scrollTop()
{
    return f_filterResults(window.pageYOffset?window.pageYOffset:0,document.documentElement?document.documentElement.scrollTop:0,document.body?document.body.scrollTop:0);
}
function f_filterResults(n_win,n_docel,n_body)
{
    var n_result=n_win?n_win:0;
    if(n_docel&&(!n_result||(n_result>n_docel)))
        n_result=n_docel;
    
    return n_body&&(!n_result||(n_result>n_body))?n_body:n_result;
}
