 var LOCATION = new Class({
 
 
 		initialize: function(){
		
		  var url = self.location.toString();
		
		
		this.params = new Object();
		
		
		    try{
			var p = url.split('?')[1].split('&');
			
			p.each(function(el){
			
		        str = el.split('=');
				this.params[str[0].trim()] = str[1].trim();
		
			}.bind(this));
	        }catch(e){this.params = null;}
			
		},
		
		getParams: function(){
		
		     return this.params;
		}
		
 
 });        
		 



var OpenPackage = new Class({


	initialize: function(id){
	
	      this.error = true;
		  this.el = null;
		  url = new LOCATION();
		  if(url.getParams())
		  {
		        
				
		  		if(url.getParams()['produkt'] != null && $(url.getParams()['produkt'])){
				    this.el = $(url.getParams()['produkt']);
				    this.error = false;
					this.el.checked = true;
					this.el.fireEvent('click');
				}
				else
				this.error = true;
		  }
		  this.id = id;
		  
	},
	
	openentry: function(){
	    
	    if(this.error) return false;
		$$('div.element').each(function(obj,nr){
		
		      
		        obj.getElements('input[type=checkbox],input[type=radio]').each(function(obj2,nr2){
				
				        
						if(obj2.get('id') == this.el.get('id') && nr > 0){
						$$('h3.toggler')[nr].fireEvent('click');}
						
						
				}.bind(this));
				
		
		}.bind(this));
	}


});


var op = function(){
a =  new OpenPackage();
a.openentry();
}
