function set_cookie(cookie_name, cookie_value, cookie_life, cookie_path) {
  var today = new Date()
  var expiry = new Date(today.getTime() + cookie_life * 60*60*1000)
  if (cookie_value != null && cookie_value != ""){
    var cookie_string =cookie_name + "=" + escape(cookie_value)
    if(cookie_life){ cookie_string += "; expires=" + expiry.toGMTString()}
    if(cookie_path){ cookie_string += "; path=" + cookie_path}
 	document.cookie = cookie_string
  }
}

function open_all(ids, folder, reload) {
	if (ids.length >= 20) {
		alert("Diese Funktion ist ab 20 Links deaktivert.")
	} else {
		for each (var id in ids) {
			document.getElementById('download_'+id).click();
			set_cookie('frame_'+folder, 'hide', reload);
		}
	}
}
