function input_value(cell, text){		
	if(cell.value==text){	
	cell.value='';	
	}else if(cell.value==''){
	cell.value=text;		
	}	
}  




function calculate_price(id,ap){
	
	var f=document.getElementById("cart_quantity");
	var at=document.getElementById("multi_atribute");
	var block_product_price=document.getElementById("complex_price");
	var product_price=document.getElementById("hide_product_price");
	var total_sum;
	var regex = new RegExp("[/|]");
	var product_qty=f.products_qty.value;	
	var count_input = f.attrib_count.value;	
	var price=0;
	var r;
	
	
	for (var i = 1; i <=count_input; i++) {		
	var qty = eval("f.attrib_qty_"+i+".value") ;		
		
		if(qty>0 || qty!='' & parseInt(qty)){
			
			sel_value=eval("f.attrib_qty_"+i+".className"); 
			
			price_value = sel_value.split(regex);			
			price = accAdd(price, (price_value[1]*qty));
			
			r='y';
		}
	}	
	

	
	
	if(r=='y'){		
		total_sum=accAdd(product_price.innerHTML*product_qty, price);	
		block_product_price.innerHTML=total_sum.toFixed(2)+' EUR';
	}else{
		block_product_price.innerHTML=product_price.innerHTML+' EUR';
		if(ap=='y'){f.products_qty.value='1';   }
		
	}
	
	option_images_selected();
	 
	
}

function this_attr_add(id){
	
	var f=document.getElementById("cart_quantity");
	 var q = 0;
	 
	if(eval("f.attrib_qty_"+id)){
		var qty = eval("f.attrib_qty_"+id);
		if(qty.value  == ''){			
			qty.value = '1';			
		}else{
			if(parseInt(qty.value)){
				q = parseInt(qty.value);
			}
			qty.value = q + 1;
		}
	}
	
	calculate_price();
}

function this_selected(input){
	var id = input.value; 
	var f=document.getElementById("cart_quantity");
	 
	if(eval("f.attrib_qty_"+id)){
		var qty = eval("f.attrib_qty_"+id);
		if(qty.value  == ''){			
			qty.value = '1';			
		}
	}
	
	calculate_price();
}

function onmouse_option(id, img_close){	
	
	var block_images=document.getElementById("cache_block");
	var regex = new RegExp("[/|]");
	
	val = id.id;
	img_value = val.split(regex);
	if(img_value[0]!=''){
		
	block_images.innerHTML='<span ><img src="images/product_images/info_images/'+img_value[0]+'"  /></span>';

	}else if(img_value[0]==''){
		
		block_images.innerHTML='<span >&nbsp;</span>';
	
	}
	if(img_close==true){
		block_images.innerHTML='<span >&nbsp;</span>';
	}
}

function option_images_selected(id){	
	var f=document.getElementById("cart_quantity");
	var at=document.getElementById("product_atributes");
	var block_images=document.getElementById("block_images_select");	
	
	var regex = new RegExp("[/|]");	
	var count_input = f.attrib_count.value;	
	
	var cache_block=document.getElementById("cache_block");
	cache_block.innerHTML='';
	
	block_images.innerHTML='';
	
	for (var i = 1; i <=count_input; i++) {
		
		var qty = eval("f.attrib_qty_" + i + ".value") ;		
		
		if(qty>0 || qty!=''){	
		
		var sel_value=eval("f.attrib_color_" + i);
		
		
		
		
		if(sel_value){
		
		var label = sel_value.options[sel_value.selectedIndex].getAttribute('rel');
			
			img_value = label.split(regex);
			
			
			
				if(img_value[0]!=''){
				
					var img='<a  class="productimage" title="'+img_value[1]+'" href="images/product_images/popup_images/'+img_value[0]+'" rel="lightbox['+eval("f.attrib_val_" + i+".value")+']"><img src="images/product_images/info_images/'+img_value[0]+'"   class="productimage" /><span ><b>'+zooming+'</b></span></a> ';
				
				block_images.innerHTML=block_images.innerHTML+img;
				
				}	
			}
		}
	}	
	
}




