var formblock;
var forminputs;

function prepare() {
if ( document.getElementById('form_id') ) {
formblock= document.getElementById('form_id');
forminputs = formblock.getElementsByTagName('input');
}

}

function select_all(name, value) {
for (i = 0; i < forminputs.length; i++) {
// regex here to check name attribute
var regex = new RegExp(name, "i");
if (regex.test(forminputs[i].getAttribute('name'))) {
if (value == '1') {
forminputs[i].checked = true;
} else {
forminputs[i].checked = false;
}
}
}
}

if (window.addEventListener) {
window.addEventListener("load", prepare, false);
} else if (window.attachEvent) {
window.attachEvent("onload", prepare)
} else if (document.getElementById) {
window.onload = prepare;
}


function hideshow(which){
if (!document.getElementById ) {
return;
}
if (which.style.display=="block") {
which.style.display="none";
}
else {
which.style.display="block";
}
}

iB = 1;
function updateBannerFlash(iB) {
				var iBanner = xajax.call('pobierzBanneryFlash', { parameters: [ iB ], mode: 'synchronous' });

				myCMD = "updateBannerFlash( " + ( iBanner++ ) + " );";
				setTimeout( myCMD, 15000 );
}

iReklamy = 0;
function updateReklamyPopup(iReklamy){

			var iPopupCount = xajax.call('pobierzReklamyPopup', { parameters: [ iReklamy ], mode: 'synchronous' });

				myCMD = "updateReklamyPopup( " + ( iPopupCount++ ) + " );";
				setTimeout( myCMD, 14000 );
}

$(document).ready(function()
{
$(window).scroll(function()
	{
  		$('#message_box').animate({top:$(window).scrollTop()+"px" },{queue: false, duration: 350});
	});

	$('#close_message').click(function()
	{
		$('#message_box').remove();

	});


    $("#windowPopup").dialog({
      bgiframe: true,
      autoOpen: false,
      height: 450,
      width: 620,
      modal: true
    });
});

function displayWindow(url, width, height) {
        var Win = window.open(url,"",'width=' + width + ',height=' + height + ',status=yes,resizable=0,scrollbars=yes,menubar=no' );
}

function tiny() {
tinyMCE.init({
		mode : "textareas",
		theme : "advanced",
		language : 'pl',
		plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager",
		width: 570,
		height: 560,
		theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect,|,forecolor,backcolor",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,link,unlink,anchor,image,cleanup,|,undo,redo,|,insertdate,inserttime,preview",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,fullscreen",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true
});
}