function open_img_big(img, pic_width, pic_height, pic_path){
	//var pic_id = $(img).getProperty('id');	
	//var pic_height = parseInt($(pic_id+'_height').getProperty('value')) + 0;
	//var pic_width = parseInt($(pic_id+'_width').getProperty('value')) + 0;
//	var pic_path = $(pic_id+'_path').getProperty('value'); 
	//alert(pic_path);
	var wraper = new Element('div', {id:'img_wraper', styles:{width:pic_width+'px', 'overflow':'hidden'}});
	var bilde = new Element('img', {src: pic_path, styles: { width:pic_width+"px"}});	
	//var text_dic = new Element('div', {html:$(img).get('bilde_text'), styles:{height:'20px', 'overflow':'hidden'}});
	bilde.inject(wraper);	
	//text_dic.inject(wraper);	
	SqueezeBox.fromParams({handler:'div', size:{x:pic_width+0,y:pic_height}, div_cont:wraper, divOptions:{styles:{overflow:'hidden'}}, onClose:function(){
		var bilde_f = bilde;
		var wraper_f = wraper;
		delete bilde_f;
		delete wraper_f;		
	}});	
}
var current_JS_img_ind = -1;
function picture_changed(ind){
	current_JS_img_ind = ind;
}
function flash_img_clicked(img_ind){		
	var img_flash = $(flash_fade_id);
	current_img_ind = img_ind;
	img_flash.stop_auto_play();
	var pic_width = parseInt(img_flash.get_tag_property(img_ind, 'big_img', 'width'));	
	var pic_height = parseInt(img_flash.get_tag_property(img_ind, 'big_img', 'height'));	
	//var total_pic = parseInt(img_flash.get_tag_property(img_ind, 'big_img', 'total_pic'));	
	var pic_src = img_flash.get_tag_value(img_ind, 'big_img');
	var wraper = new Element('div', {id:'img_wraper', styles:{width:pic_width+'px', 'overflow':'hidden'}});
	var bilde = new Element('img', {src: pic_src, 'class':'hand_hover', styles: { width:pic_width+"px"}});	
	//var text_dic = new Element('div', {html:$(img).get('bilde_text'), styles:{height:'20px', 'overflow':'hidden'}});
	bilde.inject(wraper);	
	
	var priev_pic = new Element('div', {id:'pr_img', 'class':"hand_hover text", styles:{'background-color':'#7bc6e2', 'float':'left', 'width': '70', 'line-height':'16px', 'padding':'2px 4px'}});	
	priev_pic.set('html', 'Forrige');
	var next_pic = new Element('div', {id:'next_img', 'class':"hand_hover text", styles:{'background-color':'#7bc6e2', 'float':'right', 'width': '70', 'line-height':'16px', 'padding':'2px 4px'}});
	next_pic.set('html', 'Neste');  	
	current_JS_img_ind = img_ind;
	var next_click = function(e){	
		var img_flash = $(flash_fade_id);	
		if (current_JS_img_ind != img_flash.get_currrent_img_ind()) return;
		var img_ind = img_flash.get_priev_img_ind();
		//current_JS_img_ind = img_ind;
		img_flash.pr_image();//next_image(); 
		var pic_width = parseInt(img_flash.get_tag_property(img_ind, 'big_img', 'width'));	
		var pic_height = parseInt(img_flash.get_tag_property(img_ind, 'big_img', 'height'));	
		//var total_pic = parseInt(img_flash.get_tag_property(img_ind, 'big_img', 'total_pic'));	
		var pic_src = img_flash.get_tag_value(img_ind, 'big_img');
		var img_wraper = wraper;
		var img_hold = bilde;
		img_hold.setStyle('width', pic_width);
		img_hold.setStyle('height', pic_height);
		img_hold.setProperty('src', pic_src);		
		img_wraper.setStyle('width', pic_width);
		SqueezeBox.resize({'x':pic_width + 0, 'y':pic_height + 24});		
	};
	bilde.addEvent('click', next_click);
	priev_pic.addEvent('click', next_click);
	
	next_pic.addEvent('click', function(e){	
		var img_flash = $(flash_fade_id);	
		//alert(current_JS_img_ind + ' ' +img_flash.get_currrent_img_ind());
		if (current_JS_img_ind != img_flash.get_currrent_img_ind()) return;
		var img_ind = img_flash.get_next_img_ind();
		//current_JS_img_ind = img_ind;
		img_flash.next_image();
		var pic_width = parseInt(img_flash.get_tag_property(img_ind, 'big_img', 'width'));	
		var pic_height = parseInt(img_flash.get_tag_property(img_ind, 'big_img', 'height'));	
		
		//var total_pic = parseInt(img_flash.get_tag_property(img_ind, 'big_img', 'total_pic'));	
		var pic_src = img_flash.get_tag_value(img_ind, 'big_img');
		var img_hold = bilde;		
		var img_wraper = wraper;
		img_hold.setStyle('width', pic_width);
		img_hold.setStyle('height', pic_height);
		img_hold.setProperty('src', pic_src);		
		img_wraper.setStyle('width', pic_width);
		SqueezeBox.resize({'x':pic_width + 0, 'y':pic_height + 24});
	});
	
	//var total_pic_text = new Element('span', {id:'total_img', styles:{'background-color':'#7bc6e2'}});
	//total_pic_text.set('html', '/'+total_pic);
	//var current_pic_text = new Element('span', {id:'current_img', styles:{'background-color':'#7bc6e2'}});
	//current_pic_text.set('html', (img_ind + 1)); 
	// assembling
	var controls_cont = new Element('div', {id:'controls_cont', styles:{'background-color':'#acdef0', 'text-align': 'center', 'height': '20', 'margin-top': '3', 'line-height':'20px'}});	
	priev_pic.inject(controls_cont);	
	//current_pic_text.inject(controls_cont);
	//total_pic_text.inject(controls_cont);       
	next_pic.inject(controls_cont);       
	
	controls_cont.inject(wraper);		
	SqueezeBox.fromParams({handler:'div', size:{x:pic_width + 0,y:pic_height + 24}, div_cont:wraper, divOptions:{styles:{overflow:'hidden'}}, onClose:function(){
		var bilde_f = bilde;
		var wraper_f = wraper;
		var c_img_flash = img_flash;
		delete bilde_f;
		delete wraper_f;		
		c_img_flash.start_auto_play();
	}});
}
