<!--
function ShowHide(objName){

    if (document.getElementById(objName).style.display=='')
    {
        document.getElementById(objName).style.display='none';
    }
    else{
        document.getElementById(objName).style.display = '';

    }


}

function Show(objName){

    document.getElementById(objName).style.display = '';

}

function Hide(objName){

    document.getElementById(objName).style.display = 'none';

}

function format_sel(v)
{

    if (document.getSelection)
    {
        var strd=document.add.content.value;
        var selText = window.getSelection();
        str = selText.toString();
        selstart=document.add.content.selectionStart
        selend=document.add.content.selectionEnd
        len=selend-selstart;
        str=strd.substr (selstart, len);
        document.add.content.focus();
        var sel = "<" + v + ">" + str + "</" + v + ">";
        if (window.RegExp)
        {
            str = strd.replace(str, sel);
        }

        document.add.content.value = str;


    }
    else if (document.selection && document.selection.createRange)
    {
        var range = document.selection.createRange();
        var str = range.text;
        document.add.content.focus();
        var sel = document.selection.createRange();
        sel.text = "<" + v + ">" + str + "</" + v + ">";
    }

    return;
}

function inserttag(v)
{
    if (document.getSelection)
    {
        var strd=document.add.content.value;
        var selText = window.getSelection();
        str = selText.toString();
        selstart=document.add.content.selectionStart
        selend=document.add.content.selectionEnd
        len=selend-selstart;
        str=strd.substr (selstart, len);
        document.add.content.focus();
        var sel =  "{" + v + "}" + str;
        if (window.RegExp)
        {
            str = strd.replace(str, sel);
        }

        document.add.content.value = str;

    }
    else if (document.selection && document.selection.createRange)
    {
        var range = document.selection.createRange();
        var str = range.text;
        document.add.content.focus();
        var sel = document.selection.createRange();
        sel.text = "{" + v + "}" + str;
    }

    return;
}

function format_sel_square(v)
{
    if (document.getSelection)
    {
        var strd=document.add.content.value;
        var selText = window.getSelection();
        str = selText.toString();
        selstart=document.add.content.selectionStart
        selend=document.add.content.selectionEnd
        len=selend-selstart;
        str=strd.substr (selstart, len);
        document.add.content.focus();
        var sel = "[" + v + "]" + str + "[/" + v + "]";
        if (window.RegExp)
        {
            str = strd.replace(str, sel);
        }

        document.add.content.value = str;



    }
    else if (document.selection && document.selection.createRange)
    {
        var range = document.selection.createRange();
        var str = range.text;
        document.add.content.focus();
        var sel = document.selection.createRange();
        sel.text = "[" + v + "]" + str + "[/" + v + "]";
    }

    return;
}
function format_sel_square_param(p, v)
{
    if (document.getSelection)
    {
        var strd=document.add.content.value;
        var selText = window.getSelection();
        str = selText.toString();
        selstart=document.add.content.selectionStart
        selend=document.add.content.selectionEnd
        len=selend-selstart;
        str=strd.substr (selstart, len);
        document.add.content.focus();
        var   sel = "[" + p + "]" + v + "[/" + p + "]";
        if (window.RegExp)
        {
            str = strd.replace(str, sel);
        }

        document.add.content.value = str;



    }
    else if (document.selection && document.selection.createRange)
    {
        var range = document.selection.createRange();
        var str = range.text;
        document.add.content.focus();
        var sel = document.selection.createRange();
        sel.text = "[" + p + "]" + v + "[/" + p + "]";
    }

    return;
}


function format_font(v,ve) {


    if (document.getSelection)
    {
        var strd=document.add.content.value;
        var selText = window.getSelection();
        str = selText.toString();
        selstart=document.add.content.selectionStart
        selend=document.add.content.selectionEnd
        len=selend-selstart;
        str=strd.substr (selstart, len);
        document.add.content.focus();
        var     sel = v + str + ve ;
        if (window.RegExp)
        {
            str = strd.replace(str, sel);
        }

        document.add.content.value = str;




    }
    else if (document.selection && document.selection.createRange)
    {
        var range = document.selection.createRange();
        var str = range.text;
        document.add.content.focus();
        var sel = document.selection.createRange();
        sel.text = v + str + ve ;
    }

    return;


}


  

function insert_link() {

    var my_link = prompt("Podaj adres URL:","http://");

    if (document.getSelection)
    {
        var strd=document.add.content.value;
        var selText = window.getSelection();
        str = selText.toString();
        selstart=document.add.content.selectionStart
        selend=document.add.content.selectionEnd
        len=selend-selstart;
        str=strd.substr (selstart, len);
        document.add.content.focus();
        var   sel = "<a href=\"" + my_link + "\">" + str + "</a>";
        if (window.RegExp)
        {
            str = strd.replace(str, sel);
        }

        document.add.content.value = str;




    }
    else if (document.selection && document.selection.createRange)
    {
        var range = document.selection.createRange();
        var str = range.text;
        document.add.content.focus();
        var sel = document.selection.createRange();
        sel.text = "<a href=\"" + my_link + "\">" + str + "</a>";
    }


}

function insert_smile(text) {

    var item = null;
    if (document.getElementById) {
        item = document.getElementById('content');
    } else if (document.all) {
        item = document.all['content'];
    } else if (document.layers){
        item = document.layers['content'];
    }
    if (item) {
        item.focus();
        item.value = item.value + " " + text;
        item.focus();
    }
    return;
}

function MyPopUP(link, width, height)
{
    var winl = (screen.width - width) / 2;
    var wint = (screen.height - height) / 2;
    win2=window.open("http://www.pifpaf.pl/"+link,'windowPIFPAF','width=' + width + ',height=' + height+ ',scrollbars=yes,status=no,resizable=yes');
    win2.moveTo(winl, wint);
    win2.focus();
}

function MyPopUPRaw(link, width, height)
{
    var winl = (screen.width - width) / 2;
    var wint = (screen.height - height) / 2;
    win2=window.open(link,'windowPIFPAF','width=' + width + ',height=' + height+ ',scrollbars=yes,status=no,resizable=yes');
    win2.moveTo(winl, wint);
    win2.focus();
}

function MyPopUPRawName(link, width, height,name)
{
    var winl = (screen.width - width) / 2;
    var wint = (screen.height - height) / 2;
    win2=window.open(link,name,'width=' + width + ',height=' + height+ ',scrollbars=yes,status=no,resizable=yes');
    win2.moveTo(winl, wint);
    win2.focus();
}


function OpenMS()
{
    var width=800;
    var height=695;
    var winl = (screen.width - width) / 2;
    var wint = (screen.height - height) / 2;
    link="http://ms.pifpaf.pl/";
    winms=window.open(link,'windowPIFPAF','width=' + width + ',height=' + height+ ',resizable=no, status=no, title=no, toolbar=no, menubar=no, location=no');

    //  winms=window.open(,'PIFPAF.pl Moje Serwery','width=800, height=695, resizable=no, status=no, title=no, toolbar=no, menubar=no, location=no');
    winms.moveTo(winl, wint);
    winms.focus();
}

function OpenTREE(cupid, phaseid)
{
    var width=900;
    var height=695;
    var winl = (screen.width - width) / 2;
    var wint = (screen.height - height) / 2;
    link="http://cup.pifpaf.pl/showcupresults/"+cupid+"/"+phaseid;
    winms=window.open(link,'windowPIFPAF','width=' + width + ',height=' + height+ ',scrollbars=yes,resizable=yes, status=no, title=no, toolbar=no, menubar=no, location=no');

    //  winms=window.open(,'PIFPAF.pl Moje Serwery','width=800, height=695, resizable=no, status=no, title=no, toolbar=no, menubar=no, location=no');
    winms.moveTo(winl, wint);
    winms.focus();
}


function OpenMSOrder(id)
{
    var width=800;
    var height=695;
    link="http://ms.pifpaf.pl/?area=order";
    if (id!="") link=link+"&referenceid="+id;
    var winl = (screen.width - width) / 2;
    var wint = (screen.height - height) / 2;
    winms=window.open(link,'windowPIFPAF','width=' + width + ',height=' + height+ ',resizable=no, status=no, title=no, toolbar=no, menubar=no, location=no');
    winms.moveTo(winl, wint);
    winms.focus();
}


function NewWindowPopup(link)
{
    win2=window.open("http://www.pifpaf.pl/"+link,'windowPIFPAF','scrollbars=yes,status=yes,resizable=yes,menubar=yes, toolbar=yes,location=yes, links=yes');
    win2.focus();
}


function ClickLink (textLinkID, header)
{
    window.status=header;
    //  document.location='adclick.php?tlid=' + textLinkID;
    url='/adclick/' + textLinkID;

    win2=window.open(url,'blank_','scrollbars=yes,status=yes,resizable=yes,menubar=yes, toolbar=yes,location=yes, links=yes');
    win2.focus();

};

var globalgames=new Array();
var globalinfos= new Array();
var globalgameid;
var globaltypeid;


function FilterChange ()
{
    typeidbox=document.forms[0].typeid;
    gameidbox=document.forms[0].gameid;
    if (typeidbox.selectedIndex==-1) return FALSE;
    typeid = typeidbox.options[typeidbox.selectedIndex].value;
    globaltypeid=typeid;
    // wyzerowanie selecta
    gameidbox.options.length = 0;
    i=0;
    for (var id in games)
    {
        if (games[id]==typeid)
        {
            // dopisanie opcji do selecta
            gameidbox.options[i] = new Option(infos[id],id);
            i++;
        }
    }

}


function FilterInit (games, infos, gameidselected)
{
    globalgames=games;
    globalinfos=infos;
    globalgameid=gameidselected;

    typeidbox=document.forms[0].typeid;
    gameidbox=document.forms[0].gameid;
    if (typeidbox.selectedIndex==-1) return FALSE;
    typeid = typeidbox.options[typeidbox.selectedIndex].value;

    globaltypeid=typeid;
    // wyzerowanie selecta
    gameidbox.options.length = 0;
    i=0;
    selindex=0;
    for (var id in games)
    {
        if (games[id]==typeid)
        {
            // dopisanie opcji do selecta
            gameidbox.options[i] = new Option(infos[id],id);
            if (gameidselected==id) selindex=i;
            i++;
        }
    }
    gameidbox.selectedIndex=selindex;

}

function imgClickHandler (evt, img) {
    if (window.event)
        alert(window.event.offsetX + ':' + window.event.offsetY);
    else if (evt.target) {
        var coords = {
            x: 0,
            y: 0
        };
        var el = evt.target;
        do {
            coords.x += el.offsetLeft;
            coords.y += el.offsetTop;
        }
        while ((el = el.offsetParent));
        var offsetX = evt.clientX - coords.x;
        var offsetY = evt.clientY - coords.y;
        document.forms[0].x.value=offsetX;
        document.forms[0].y.value=offsetY;
    }
}

function ShowPlace (row, place, obj)
{

}
function DeleteConfirmation (message, doc)
{
    var result = confirm((message));
    if(result)
    {
        window.location.href = (doc);
    }
    else
    {

}
}


function NewWindowPopup(link)
{
    win2=window.open(link,'windowPIFPAF','scrollbars=yes,status=yes,resizable=yes,menubar=yes, toolbar=yes,location=yes, links=yes');
    win2.focus();
}



var globalgames=new Array();
var globalinfos= new Array();
var globalgameid;
var globaltypeid;


function FilterChange ()
{
    typeidbox=document.forms[0].typeid;
    gameidbox=document.forms[0].gameid;
    if (typeidbox.selectedIndex==-1) return FALSE;
    typeid = typeidbox.options[typeidbox.selectedIndex].value;
    globaltypeid=typeid;
    // wyzerowanie selecta
    gameidbox.options.length = 0;
    i=0;
    for (var id in games)
    {
        if (games[id]==typeid)
        {
            // dopisanie opcji do selecta
            gameidbox.options[i] = new Option(infos[id],id);
            i++;
        }
    }

}


function FilterInit (games, infos, gameidselected)
{
    globalgames=games;
    globalinfos=infos;
    globalgameid=gameidselected;

    typeidbox=document.forms[0].typeid;
    gameidbox=document.forms[0].gameid;
    if (typeidbox.selectedIndex==-1) return FALSE;
    typeid = typeidbox.options[typeidbox.selectedIndex].value;

    globaltypeid=typeid;
    // wyzerowanie selecta
    gameidbox.options.length = 0;
    i=0;
    selindex=0;
    for (var id in games)
    {
        if (games[id]==typeid)
        {
            // dopisanie opcji do selecta
            gameidbox.options[i] = new Option(infos[id],id);
            if (gameidselected==id) selindex=i;
            i++;
        }
    }
    gameidbox.selectedIndex=selindex;

}

function imgClickHandler (evt, img) {
    if (window.event)
        alert(window.event.offsetX + ':' + window.event.offsetY);
    else if (evt.target) {
        var coords = {
            x: 0,
            y: 0
        };
        var el = evt.target;
        do {
            coords.x += el.offsetLeft;
            coords.y += el.offsetTop;
        }
        while ((el = el.offsetParent));
        var offsetX = evt.clientX - coords.x;
        var offsetY = evt.clientY - coords.y;
        document.forms[0].x.value=offsetX;
        document.forms[0].y.value=offsetY;
    }
}

function ShowPlace (row, place, obj)
{

}

function ToFmt(x){
    this.x=x;
    this.fmt00 = fmt00;
    this.fmtF = fmtF;
    this.fmtE=fmtE;
    this.fmtI=fmtI;
    this.spacer=" ";
    this.setSpacer=setSpacer;
}

function fmt00(){
    // fmt00: Tags leading zero onto numbers 0 - 9.
    // Particularly useful for displaying results from Date methods.
    //
    if (parseInt(this.x) < 0) var neg = true;
    if (Math.abs(parseInt(this.x)) < 10){
        this.x = "0"+ Math.abs(this.x);
    }
    if (neg) this.x = "-"+this.x;
    return this.x;
}

function fmtF(w,d){

    // fmtF: formats in a style similar to Fortran's Fw.d, where w is the
    // width of the field and d is the number of figures after the decimal
    // point.
    // The result is aligned to the right of the field.  The default
    // padding character is a space " ". This can be modified using the
    // setSpacer(string) method of ToFmt.
    // If the result will not fit in the field , the field will be returned
    // containing w asterisks.
    var width=w;
    var dpls=d;
    var lt1=false;
    var len=this.x.toString().length;
    var junk;
    var res="";
    // First check for valid format request
    if ( width < (dpls+2)){
        window.alert("Illegal format specified : w = " + d +
            " w = " + d +
            "\nUsage: [ToFmt].fmtF(w,d)" +
            "\nWidth (w) of field must be greater or equal to the number " +
            "\nof digits to the right of the decimal point (d) + 2");
        junk = filljunk(width);
        return junk;
    }
    // Work with absolute value
    var absx=Math.abs(this.x);
    // Nasty fix to deal with numbers < 1 and problems with leading zeros!
    if ((absx < 1) && (absx > 0)){
        lt1 = true;
        absx+=10;
    }
    // Get postion of decimal point
    var pt_pos = absx.toString().indexOf(".");
    if ( pt_pos == -1){
        res+= absx;
        res+= ".";
        for (var i = 0; i < dpls; i++){
            res += 0;
        }
    }
    else{
        res = Math.round(absx * Math.pow(10,dpls));
        res=res.toString();
        if (res.length ==
            Math.round(Math.floor(absx * Math.pow(10,dpls))).toString().length){
            res = res.substring(0,pt_pos) + "." +
            res.substring(pt_pos,res.length);
        }
        else{
            pt_pos++;
            res = res.substring(0,pt_pos) + "." +
            res.substring(pt_pos,res.length);
        }
        // Remove leading 1 from  numbers < 1 (Nasty fix!)
        if (lt1) {
            res=res.substring(1,res.length);
        }
    }
    // Final formatting statements
    // Reinsert - sign for negative numbers
    if (this.x < 0)res = "-"+res;
    // Check whether the result fits in the width of the field specified
    if (res.length > width){
        res=filljunk(width);
    }
    // If necessary, pad from the left with the spacer string
    else if (res.length < width){
        var res_bl="";
        for (var i = 0; i < (width - res.length); i++){
            res_bl += this.spacer ;
        }
        res = res_bl + res;
    }
    return res;
}

function fmtE(w,d){

    // fmtE: formats in a style similar to Fortran's Ew.d, where w is the
    // width of the field and d is the number of figures after the decimal
    // point.
    // The result is aligned to the right of the field.  The default
    // padding character is a space " ". This can be modified using the
    // setSpacer(string) method of ToFmt.
    // If the result will not fit in the field , the field will be returned
    // containing w asterisks.
    //
    var width=w;
    var dpls=d;
    var e="E+";
    var len=this.x.toString().length;
    var pow10;
    var xp10;
    var junk;
    var res="";
    // First check for valid format request
    if ( width < (dpls+5)){
        window.alert("Illegal format specified : w = " + d +
            " w = " + d +
            "\nUsage: [ToFmt].fmtE(w,d)" +
            "\nWidth (w) of field must be greater or equal to the number " +
            "\nof digits to the right of the decimal point (d) + 6");
        junk = filljunk(w);
        return junk;
    }
    // Work with absolute value
    var absx=Math.abs(this.x);
    // Get postion of decimal point
    var pt_pos = absx.toString().indexOf(".");
    // For x=0
    if (absx == 0){
        res +="0.";
        for (var i=0; i< dpls; i++){
            res += "0";
        }
        res  += "E+00";
    }
    // For abs(x) >= 1
    else if (absx >= 1.0){
        pow10=1;
        xp10 = absx;
        while (xp10 >= 1.){
            pow10++;
            xp10 /= 10;
        }
        res = Math.round(xp10 * Math.pow(10,dpls));
        res=res.toString();
        if (res.length ==
            Math.round(Math.floor(xp10 * Math.pow(10,dpls))).toString().length){
            pow10--;
        }
        res = "0." + res.substring(0,dpls) + e + (new ToFmt(pow10)).fmt00();
    }
    // For abs(x) < 1
    else if (absx < 1.0){
        pow10=1;
        xp10 = absx;
        while (xp10 < 1.){
            pow10--;
            xp10 *= 10;
        }
        res = Math.round(xp10/10 * Math.pow(10,dpls));
        res=res.toString();
        if (res.length !=
            Math.round(Math.floor(xp10/10 * Math.pow(10,dpls))).toString().length){
            pow10++;
        }
        if (pow10 < 0) e = "E-";
        res = "0." + res.substring(0,dpls) + e + (new ToFmt(Math.abs(pow10))).fmt00();
    }
 
    if (this.x < 0)res = "-"+res;
    if (res.length > width){
        res=filljunk(width);
    }
    else if (res.length < width){
        var res_bl="";
        for (var i = 0; i < (width - res.length); i++){
            res_bl += this.spacer ;
        }
        res = res_bl + res;
    }
    return res;
 
}

function fmtI(w){

    // fmtI: formats in a style similar to Fortran's Iw, where w is the
    // width of the field.
    // Floating point values are truncated (rounded down) for integer
    // representation.
    // The result is aligned to the right of the field.  The default
    // padding character is a space " ". This can be modified using the
    // setSpacer(string) method of ToFmt.
    // If the result will not fit in the field , the field will be returned
    // containing w asterisks.
    var width=w;
    var lt0=false;
    var len=this.x.toString().length;
    var junk;
    var res="";
    // Work with absolute value
    var absx = Math.abs(this.x);

    // Test for < 0
    if (parseInt(this.x) < 0){
        lt0 = true;
    }
    res = Math.round(Math.floor((absx))).toString();
    if (lt0){
        res = "-"+res;
    }
    if (res.length > width){
        res=filljunk(width);
    }
    else if (res.length < width){
        var res_bl="";
        for (var i = 0; i < (width - res.length); i++){
            res_bl += this.spacer ;
        }
        res = res_bl + res;
    }
    return res;
}

function filljunk(lenf){
    // Fills field of length lenf with asterisks
    var str="";
    for (var i=0; i < lenf; i++){
        str +="*";
    }
    return str;
}

function setSpacer(spc){
    var spc;
    this.spacer=spc;
    return this.spacer;
}

function fixImgs() {
    var maxW=600;
    var pix=document.getElementsByTagName('img');

    for (i=0; i<pix.length; i++) {

        w=pix[i].width;
        h=pix[i].height;
        if (w > maxW) {
            f=1-((w - maxW) / w);
            pix[i].width=w * f;
            pix[i].height=h * f;
        }
    }
}

function fixImgs( maxW) {
    
    var pix=document.getElementsByTagName('img');
    for (i=0; i<pix.length; i++) {

        var id =pix[i].id;
        if (id=="banner") continue;

        w=pix[i].width;
        h=pix[i].height;
        if (w > maxW) {
            f=1-((w - maxW) / w);
            pix[i].width=w * f;
            pix[i].height=h * f;
        }
    }
}




function fixFlash() {


    var pix=document.getElementsByTagName('object');
    for (i=0; i<pix.length; i++)
    {
        d=pix[i];
        var attr = document.createAttribute('wmode');
        attr.value = 'opaque';
        d.setAttributeNode(attr);
    //    d.createtAttribute("value","opaque")
    }
}


function EmbedFlash(_src, _width, _height, bgcolor)
{
    document.write("<object " +
        "type=\"application/x-shockwave-flash\" " +
        "data=\"" + _src + "\" " +
        "width=\"" + _width + "\" " +
        "height=\"" + _height + "\">");
    document.write("<param " +
        "name=\"movie\" " +
        "value=\"" + _src + "\" />");
    document.write("<param " +
        "name=\"allowScriptAccess\" " +
        "value=\"sameDomain\" />");
    document.write("<param " +
        "name=\"quality\" " +
        "value=\"high\" />");
    document.write("<param " +
        "name=\"bgcolor\" " +
        "value=\"" + bgcolor + "\" />");
    document.write("<param " +
        "name=\"wmode\" " +
        "value=\"transparent\" />");
    document.write("<param " +
        "name=\"embed\" " +
        "wmode=\"transparent\" />");
    document.write ("<param " + " name=\"scale\" value=\"exactfit\" />");
    document.write("</object>");

}

function URLDecode(psEncodeString)
{
    // Create a regular expression to search all +s in the string
    var lsRegExp = /\+/g;
    // Return the decoded string
    return unescape(String(psEncodeString).replace(lsRegExp, " "));
}
function EmbedFlashText(_src, _width, _height, bgcolor, text1, text2, _type)
{

    document.write("<object " +
        "type=\"application/x-shockwave-flash\" " +
        "data=\"" + _src + "\" " +
        "width=\"" + _width + "\" " +
        "height=\"" + _height + "\">");
    document.write("<param " +
        "name=\"movie\" " +
        "value=\"" + _src + "\" />");
    document.write("<param " +
        "name=\"allowScriptAccess\" " +
        "value=\"sameDomain\" />");
    document.write("<param " +
        "name=\"quality\" " +
        "value=\"high\" />");
    document.write("<param " +
        "name=\"bgcolor\" " +
        "value=\"" + bgcolor + "\" />");

    document.write("<param " +
        "name=\"FlashVars\" " +
        "value=\"anim="+_type+"&text_1="+(text1)+"&text_2="+(text2)+"\" />");

    document.write("<param " +
        "name=\"wmode\" " +
        "value=\"transparent\" />");



    document.write ("<param " + " name=\"scale\" value=\"exactfit\" />");
    document.write("</object>");

}
/*
function correctPNG()
   {
   for(var i=0; i<document.images.length; i++)
      {
   var img = document.images[i]
   var imgName = img.src.toUpperCase()
   if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
      {
   var imgID = (img.id) ? "id='" + img.id + "' " : ""
   var imgClass = (img.className) ? "class='" + img.className + "' " : ""
   var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='"
+ img.alt + "' "
   var imgStyle = "display:inline-block;" + img.style.cssText 
   if (img.align == "left") imgStyle = "float:left;" + imgStyle
   if (img.align == "right") imgStyle = "float:right;" + imgStyle
  // if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
   var strNewHTML = "<span " + imgID + imgClass + imgTitle
   + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;"
+ imgStyle + ";"
      + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
   + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
   img.outerHTML = strNewHTML
   i = i-1
      }
      }
   }     */
/* function correctPNG(img)
   {
   for(var i=0; i<document.images.length; i++)
      {
  var obj = document.images[i]
   var imgName = img.src.toUpperCase()
   if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
      {
   var imgID = (img.id) ? "id='" + img.id + "' " : ""
   var imgClass = (img.className) ? "class='" + img.className + "' " : ""
   var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='"
+ img.alt + "' "
   var imgStyle = "display:inline-block;" + img.style.cssText
   if (img.align == "left") imgStyle = "float:left;" + imgStyle
   if (img.align == "right") imgStyle = "float:right;" + imgStyle
   if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
   var strNewHTML = "<span " + imgID + imgClass + imgTitle
   + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;"
+ imgStyle + ";"
      + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
   + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
   img.outerHTML = strNewHTML
   i = i-1
      }
      }
   }    */

//window.attachEvent("onload", correctPNG);

function resizeIframe(iframe)
{
    try
    {
        var innerDoc = (iframe.contentDocument) ? iframe.contentDocument : iframe.contentWindow.document;
        if (innerDoc.body.offsetHeight) //ns6 syntax
        {
            iframe.height = innerDoc.body.offsetHeight + 32; //Extra height FireFox
        }
        else if (iframe.Document && iframe.Document.body.scrollHeight) //ie5+ syntax
        {
            iframe.height = iframe.Document.body.scrollHeight;
        }
    }
    catch(err)
    {
    //     alert(err.message);
    }
}

function ShowPopup(hoveritem, hoverpopup)
{
    hp = document.getElementById(hoverpopup);
    if (hp==null) return;
    // Set position of hover-over popup
    h=hp.style.height;
  
    //hp.style.top = hoveritem.offsetTop;
    //hp.style.left = hoveritem.offsetLeft;
    if (hp.style.visibility=="visible")
    {
        return ;
    }
    // Set popup to visible
    hp.style.visibility = "visible";
}

function HidePopup(hoverpopup)
{
    hp = document.getElementById(hoverpopup);
    if (hp==null) return;
    if (hp.style.visibility=="hidden") return ;
    hp.style.visibility = "hidden";
}

function GrayScale ()
{
    tmp = document.getElementsByTagName("IMG");

    var i=0;
    var o;

    for (i=0;tmp.childNodes != false && i<tmp.length;i++)
    {

        tmp[i].style.filter="Gray";

    }


}

function addMSLink ()
{
    //   var link ="javascript:window.open('http://ms.pifpaf.pl','MojeSerwery','width=800,height=695,status=no,title=no,resize=no,toolbar=no,menubar=no,location=no');window.focus();";
    var link='http://ms.pifpaf.pl';
    var title = 'PIFPAF.pl - Moje Serwery';
    if(document.all) window.external.AddFavorite(link,title);
    else
    if(window.sidebar) window.sidebar.addPanel (title,link,'');
}

/*
 
Correctly handle PNG transparency in Win IE 5.5 & 6.
http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.

Use in <HEAD> with DEFER keyword wrapped in conditional comments:
<!--[if lt IE 7]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->

 */

function correctPNG ()
{
    var arVersion = navigator.appVersion.split("MSIE")
    var version = parseFloat(arVersion[1])

    if ((version >= 5.5) && (document.body.filters))
    {
        for(var i=0; i<document.images.length; i++)
        {
            var img = document.images[i]
            var imgName = img.src.toUpperCase()
            if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
            {
                var imgID = (img.id) ? "id='" + img.id + "' " : ""
                var imgClass = (img.className) ? "class='" + img.className + "' " : ""
                var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
                var imgStyle = "display:inline-block;" + img.style.cssText
                if (img.align == "left") imgStyle = "float:left;" + imgStyle
                if (img.align == "right") imgStyle = "float:right;" + imgStyle
                if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
                var strNewHTML = "<span " + imgID + imgClass + imgTitle
                + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
                + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
                img.outerHTML = strNewHTML
                i = i-1
            }
        }
    }

}
//-->