    function SetAllCheckBoxes(FormName, FieldName, HeadCheckBox){
    	if(!document.forms[FormName])
    		return;
    	var objCheckBoxes = document.forms[FormName].elements[FieldName];
    	var objHeadCheckBox = document.forms[FormName].elements[HeadCheckBox];
    	if(!objCheckBoxes)
    		return;
    		
        var CheckValue = true;
        if(objHeadCheckBox.checked == false)
            CheckValue = false;
        
    	var countCheckBoxes = objCheckBoxes.length;
    	if(!countCheckBoxes)
    		objCheckBoxes.checked = CheckValue;
    	else
    		// set the check value for all check boxes
    		for(var i = 0; i < countCheckBoxes; i++)
    			objCheckBoxes[i].checked = CheckValue;
    }

    function open_win(what_link){
        var the_url = "http://localhost"
        var the_x =780;
        var the_y = 520;
        the_x -= 0;
        the_y -= 0;
        var how_wide = screen.availWidth;
        var how_high = screen.availHeight;
        if(what_link != ""){the_url=what_link;}
        var the_toolbar = "no";
        var the_addressbar = "no";
        var the_directories = "no";
        var the_statusbar = "no";
        var the_menubar = "no";
        var the_scrollbars = "yes";
        var the_do_resize =  "no";
        var the_copy_history = "no";
        top_pos = 0;
        left_pos = 0;
        if (window.outerWidth ){
            var option = "toolbar="+the_toolbar+",location="+the_addressbar+",directories="+the_directories+",status="+the_statusbar+",menubar="+the_menubar+",scrollbars="+the_scrollbars+",resizable="+the_do_resize+",outerWidth="+the_x+",outerHeight="+the_y+",copyhistory="+the_copy_history+",left="+left_pos+",top="+top_pos;
            site=open(the_url, "DisplayWindow", option);
            var Opera = (navigator.userAgent.indexOf('Opera') != -1);
            if(Opera){
                site.resizeTo(the_x,the_y);
                site.moveTo(0,0);
            }
        }
        else{
            var option = "toolbar="+the_toolbar+",location="+the_addressbar+",directories="+the_directories+",status="+the_statusbar+",menubar="+the_menubar+",scrollbars="+the_scrollbars+",resizable="+the_do_resize+",Width="+the_x+",Height="+the_y+",copyhistory="+the_copy_history+",left="+left_pos+",top="+top_pos;
            site=open('', "DisplayWindow", option);
            site.location=the_url;
            if(site.open){site.focus();return false;}
            site.resizeTo(the_x,the_y);
        }
    }

    function open_winu(what_link, x, y){
        var the_url = "http://localhost"
        var the_x =x;
        var the_y = y;
        the_x -= 0;
        the_y -= 0;
        var how_wide = screen.availWidth;
        var how_high = screen.availHeight;
        if(what_link != ""){the_url=what_link;}
        var the_toolbar = "no";
        var the_addressbar = "no";
        var the_directories = "no";
        var the_statusbar = "no";
        var the_menubar = "no";
        var the_scrollbars = "yes";
        var the_do_resize =  "no";
        var the_copy_history = "no";
        top_pos = 0;
        left_pos = 0;
        if (window.outerWidth ){
            var option = "toolbar="+the_toolbar+",location="+the_addressbar+",directories="+the_directories+",status="+the_statusbar+",menubar="+the_menubar+",scrollbars="+the_scrollbars+",resizable="+the_do_resize+",outerWidth="+the_x+",outerHeight="+the_y+",copyhistory="+the_copy_history+",left="+left_pos+",top="+top_pos;
            site=open(the_url, "DisplayWindow", option);
            var Opera = (navigator.userAgent.indexOf('Opera') != -1);
            if(Opera){
                site.resizeTo(the_x,the_y);
                site.moveTo(0,0);
            }
        }
        else{
            var option = "toolbar="+the_toolbar+",location="+the_addressbar+",directories="+the_directories+",status="+the_statusbar+",menubar="+the_menubar+",scrollbars="+the_scrollbars+",resizable="+the_do_resize+",Width="+the_x+",Height="+the_y+",copyhistory="+the_copy_history+",left="+left_pos+",top="+top_pos;
            site=open('', "DisplayWindow", option);
            site.location=the_url;
            if(site.open){site.focus();return false;}
            site.resizeTo(the_x,the_y);
        }
    }

    function open_pics(what_link){
        var the_url = "http://localhost"
        var the_x = 420;
        var the_y = 420;
        the_x -= 0;
        the_y -= 0;
        var how_wide = screen.availWidth;
        var how_high = screen.availHeight;
        if(what_link != ""){the_url=what_link;}
        var the_toolbar = "no";
        var the_addressbar = "no";
        var the_directories = "no";
        var the_statusbar = "no";
        var the_menubar = "no";
        var the_scrollbars = "yes";
        var the_do_resize =  "no";
        var the_copy_history = "no";
        top_pos = 0;
        left_pos = 0;
        if (window.outerWidth ){
            var option = "toolbar="+the_toolbar+",location="+the_addressbar+",directories="+the_directories+",status="+the_statusbar+",menubar="+the_menubar+",scrollbars="+the_scrollbars+",resizable="+the_do_resize+",outerWidth="+the_x+",outerHeight="+the_y+",copyhistory="+the_copy_history+",left="+left_pos+",top="+top_pos;
            site=open(the_url, "DisplayWindow", option);
            var Opera = (navigator.userAgent.indexOf('Opera') != -1);
            if(Opera){
                site.resizeTo(the_x,the_y);
                site.moveTo(0,0);
            }
        }
        else{
            var option = "toolbar="+the_toolbar+",location="+the_addressbar+",directories="+the_directories+",status="+the_statusbar+",menubar="+the_menubar+",scrollbars="+the_scrollbars+",resizable="+the_do_resize+",Width="+the_x+",Height="+the_y+",copyhistory="+the_copy_history+",left="+left_pos+",top="+top_pos;
            site=open('', "DisplayWindow", option);
            site.location=the_url;
            if(site.open){site.focus();return false;}
            site.resizeTo(the_x,the_y);
        }
    }
    
    function confirmSubmit(){
        var agree = confirm("Oletko varma?");
        if(agree)
	       return true;
        else
	       return false;
    }

function movr(k) {
 if (document.images) 
  eval('document.img'+k+'.src=img'+k+'_on.src');
}
function mout(k) {
 if (document.images) 
  eval('document.img'+k+'.src=img'+k+'_off.src');
}


