﻿// JavaScript Document
// IC WCMS JavaSricpt Functions Library
// IruCom WebCMS Version 4.0
// Copyright Pragash Irudayam ( IruCom systems )
// Licence only for one Domain. No changes or addons are allowed without prior permisssion from Pragash Irudayam (IruCom systems)

// Temporary Solution for a small cart price calculator

function IC_JS_Price_Cal(amount_id, price, item_total_id)
{
	if (typeof(document.getElementById) != 'undefined') 
	{
        item_ob = document.getElementById(item_total_id);
		amount_ob = document.getElementById(amount_id);
		// Static
		total_ob = document.getElementById('gesamt');
		order_ob = document.getElementById('order_form_255');
	}    
    else 
	{
        return false;		
    }
	
	var item_total =  price * (parseInt(amount_ob.value));	
	item_ob.value = item_total;
	 var tmp_total = 0 ;
	 for(i=1; i<=5; i++)
	 {
	 	var num_item_total_id = "gt_" + i + "b";
		
		if(document.getElementById(num_item_total_id) != null)
		{	num_item_ob = document.getElementById(num_item_total_id);		
			tmp_total = parseInt(tmp_total) + parseInt(num_item_ob.value);
			total_ob.value = tmp_total;
		}	
	 }
	
	total_ob.value = tmp_total;
	
	if(tmp_total != 0)
	{    
		order_ob.style.display = 'block';			
	}
	else
	{
		order_ob.style.display = 'none';	
	}
	
}
