function openWindow(url,szer,wys,tytul){
		
	var nowe;
	
	nowe = window.open('','nowe',' width='+szer+',height='+wys+',menubar=no, toolbar=no, status=no');
	nowe.document.open();
    	nowe.document.write("<HEAD><title>"+tytul+"</title><META HTTP-EQUIV=\"imagetoolbar\" CONTENT=\"no\"></head><BODY leftmargin=1 topmargin=1><IMG src="+url+" alt=\""+tytul+"\"></body>");
    	nowe.document.close();
    	nowe.focus();
	}

function checkQuestbook()
{

	if(frm.nick.value == "")
	{
		alert("Please enter your nickname.");
		frm.nick.focus();
		return false;
	}

	if(frm.tresc.value == "")
	{
		alert("Please enter content.");
		frm.tresc.focus();
		return false;
	}

	if(frm.token.value == "")
	{
		alert("Please enter token.");
		frm.token.focus();
		return false;
	}

	return true;
}

function logowanie(){
	var frm = document.frm
  
	if(frm.login.value == '')
	{
		frm.login.focus();
	}
}

/* funkcja do generowania flasha */
function getFlashObject(width, height, path)
{
	var str = "<object type=\"application/x-shockwave-flash\" data=\""+path+"\" width=\""+width+"\" height=\""+height+"\">";
	str += "<param name=\"wmode\" value=\"transparent\" />";
	str += "<param name=\"movie\" value=\""+path+"\" />";
	str += "</object>";
	document.write(str);
}

/* funkcja do podmiany obrazka przy wyborze template */
function changeImage(image,path){
        var objImg = document.images[image];
        objImg.src = path;
}


/* funkcja uruchamiajaca value pola select bez przycisku submit */
function nav()
{
   var w = document.myform.mylist.selectedIndex;
   var url_add = document.myform.mylist.options[w].value;
   window.location.href = url_add;
}

function nav2()
{
   var w = document.myform3.mylist2.selectedIndex;
   var url_add = document.myform3.mylist2.options[w].value;
   window.location.href = url_add;
}

function nav_uni(element)
{
   var w = document.getElementById(element).selectedIndex;
   var url_add = document.getElementById(element).options[w].value;
   window.location.href = url_add;
}

function contact_form()
{
	var flaga = true;

	if (parseInt(navigator.appVersion)>3) {

		if (navigator.appName.indexOf("Microsoft")!=-1) {
			flaga = false;
		}
	
	}


	if (document.contact.user_group.options[document.contact.user_group.selectedIndex].value=='all_users' || document.contact.user_group.options[document.contact.user_group.selectedIndex].value=='trial_users' || document.contact.user_group.options[document.contact.user_group.selectedIndex].value=='paid_users')
	{
		 document.getElementById('choose_user').style.display = 'none';
		 document.getElementById('some_users').style.display = 'none';
	}
	
	if (document.contact.user_group.options[document.contact.user_group.selectedIndex].value=='one_user')
	{	
		if(flaga) {
			document.getElementById('choose_user').style.display = 'table-row';
		} else {
			document.getElementById('choose_user').style.display = 'block';
		}

		document.getElementById('some_users').style.display = 'none';
	}
	
	if (document.contact.user_group.options[document.contact.user_group.selectedIndex].value=='some_users')
	{
		if(flaga) {
			document.getElementById('some_users').style.display = 'table-row';
		} else {
			document.getElementById('some_users').style.display = 'block';
		}	
		
		document.getElementById('choose_user').style.display = 'none';
	}
}

function BookmarkPage(url, title) {

var flaga = true;

	if (parseInt(navigator.appVersion)>3) {

		if (navigator.appName.indexOf("Microsoft")!=-1) {
			flaga = false;
		}
	
	}

	if (flaga==false)
	{
		window.external.AddFavorite( url, title);
	}
	else {
			if (windo.wsidebar) { // Mozilla Firefox Bookmark
				window.sidebar.addPanel(title, url,"");
			}
			else {
				if(window.opera && window.print) { // Opera Hotlist
				return true;
				}
			}
	}
 }
 
 function getUserList(show_group) {
	var element = document.getElementById('user_list');
	
	advAJAX.get({
		url: "user.php",
		mimeType : 'text/plain', 
		parameters : {
			  "action" : "getUserList",
			  "show_group" : show_group
		},
		onSuccess : function(obj) { 
				  element.innerHTML = obj.responseText; },
		onError : function(obj) { alert("Error: " + obj.status); }
		});
}

/**
 * marks all rows and selects its first checkbox inside the given element
 * the given element is usaly a table or a div containing the table or tables
 * @param    container    DOM element
 */
function markAllRows(container_id) {

    var rows = document.getElementById(container_id).getElementsByTagName('tr');
    var unique_id;
    var checkbox;

    for ( var i = 0; i < rows.length; i++ ) {

        checkbox = rows[i].getElementsByTagName( 'input' )[0];

        if ( checkbox && checkbox.type == 'checkbox' ) {
            unique_id = checkbox.name + checkbox.value;
            if ( checkbox.disabled == false ) {
                if ( checkbox.checked == true ) {
					checkbox.checked = false;
				}
				else
					checkbox.checked = true;
            }
        }
    }
    return true;
}
