function gebi(x){return document.getElementById(x);}
function scol(x,y){gebi(x).style.color=y}
function siH(x,y){gebi(x).innerHTML=y}
function testTitle(cel,what){
if(what>55){
siH(cel," Za długi tytuł!");
scol(cel,'red');
}else{
if(what==0){
siH(cel,'');
} else {
siH(cel," Zostało " + (55 - what) + " znaków");
scol(cel,'green');
}
}
}
function testSpr(cel,value,what){
if(what != value){
if(what != ''){
siH(cel,"");
scol(cel,'red');
} else{
gebi(cel).innerHTML='';
}
} else{
siH(cel,"");
scol(cel,'green');
}
}
function isAllFill(cel,w1,w2,w3){
if(gebi(w1))w1=typeof(w1)!='undefined'?gebi(w1).value:1;else w1=1;
if(gebi(w2))w2=typeof(w2)!='undefined'?gebi(w2).value:1;else w2=1;
if(gebi(w3))w3=typeof(w3)!='undefined'?gebi(w3).value:1;else w3=1;
if(w1 && w2 && w3){
siH(cel,"");
gebi(cel).style.display = "none";
} else {
if(gebi(cel).innerHTML == ""){
siH(cel," Uzupełnij proszę wszystkie pola.");
gebi(cel).style.display = "block";
}
}
}
function BBcodetest(){
message = gebi('message').value;
zamE = message.match(/\[\/(.*?)\]/gi);
if(!zamE) zamE = 0;
else zamE = zamE.length;
otwE = message.match(/\[(.*?)\]/gi);
if(!otwE) otwE = 0;
else otwE = otwE.length - zamE;
if(otwE != zamE){
gebi('bbCodeTestResult').innerHTML = "Chyba nie wszystkie znaczniki zostały domknięte...";
gebi('bbCodeTestResult').style.display ="block";
} else {
gebi('bbCodeTestResult').innerHTML ="";
gebi('bbCodeTestResult').style.display ="none";
}
}
function getStyle(oElm, strCssRule){
var strValue = "";
if(document.defaultView && document.defaultView.getComputedStyle){
strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
}
else if(oElm.currentStyle){
strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
return p1.toUpperCase();
});
strValue = oElm.currentStyle[strCssRule];
}if(!strValue)strValue = 0;return strValue;}
cen_wid = parseInt(getStyle(gebi("center"),"width"));
cmr = parseInt(getStyle(gebi("center"),"margin-right"));
cml = parseInt(getStyle(gebi("center"),"margin-left"));
if(gebi("menu")){
mw=gebi("menu").offsetWidth;
if(!mw)mw = parseInt(getStyle(gebi("menu"),"width"));
ml = parseInt(getStyle(gebi("menu"),"margin-left"));
mr = parseInt(getStyle(gebi("menu"),"margin-right"));
del = ml + mr + mw + cml + cmr;
} else {
del = cml + cmr;
}
if(!cen_wid){cen_wid = gebi("center").offsetWidth - 100 - del;}else{ cen_wid -= (del);}
gebi("form").style.pixelWidth = cen_wid - 50;
gebi("form").style.width = cen_wid - 50 + "px";