// JavaScript Document
function gettotalcost_printing() 
{
var sizeobj = document.getElementById('id_dwfsize');
var sizeindex = sizeobj.selectedIndex;

var styleobj = document.getElementById('style');
var styleindex = styleobj.selectedIndex;

var positionobj = document.getElementById('position');
var positionindex = positionobj.selectedIndex;

var systemobj = document.getElementById('id_dwfsystem');
var systemindex = systemobj.selectedIndex;

var setsobj = document.getElementById('num_sets');
var setsindex = setsobj.selectedIndex;

var lineobj = document.getElementById('txtline');
var lineindex = lineobj.selectedIndex;

var effobj = document.getElementById('xfacefront');
var effindex = effobj.selectedIndex;

var polishedobj = document.getElementById('polished');
var polishedindex = polishedobj.selectedIndex;

var qtyobj = document.getElementById('quantity_itemsordertmp');
var qtyindex = qtyobj.selectedIndex;

var sizeval = sizeobj.options[sizeindex].value;
var styleval = styleobj.options[styleindex].value;
var positionval = positionobj.options[positionindex].value;
var systemval = systemobj.options[systemindex].value;
var setsval = setsobj.options[setsindex].value;
var lineval = lineobj.options[lineindex].value;
var effval = effobj.options[effindex].value;
var polishedval = polishedobj.options[polishedindex].value;
var qtyval = qtyobj.options[qtyindex].value;

var sizespl = sizeval.split("-");
var sizeprice = parseFloat(sizespl[1]);
var stylespl = styleval.split("-");
var styleprice = parseFloat(stylespl[1]);
var systemspl = systemval.split("-");
var systemprice = parseFloat(systemspl[1]);
var linespl = lineval.split("-");
var lineprice = parseFloat(linespl[1]);
var effspl = effval.split("-");
var effprice = parseFloat(effspl[1]);
var polishedspl = polishedval.split("-");
var polishedprice = parseFloat(polishedspl[1]);

var systemset = parseFloat((systemprice*setsval));
var tot = sizeprice+styleprice+systemset+lineprice+effprice+polishedprice;
var total = parseFloat((tot*qtyval));

var totalformat = total.toFixed(2);

document.getElementById("calc").innerHTML = totalformat;
}

function gettotalcost_letter() 
{
var lnobj = document.getElementById('letter_name');

var lsobj = document.getElementById('id_lettersize');
var lsindex = lsobj.selectedIndex;

var cpobj = document.getElementById('capitals');
var cpindex = cpobj.selectedIndex;

var lcobj = document.getElementById('id_letterchain');
var lcindex = lcobj.selectedIndex;

var qtyobj = document.getElementById('quantity_itemsordertmp');
var qtyindex = qtyobj.selectedIndex;

var lnval = lnobj.value;
var lsval = lsobj.options[lsindex].value;
var cpval = cpobj.options[cpindex].value;
var lcval = lcobj.options[lcindex].value;
var qtyval = qtyobj.options[qtyindex].value;

var lnnumut = lnval.replace(/\s/g,'');
var lnnum = lnnumut.length;
var lsspl = lsval.split("-");
var lsprice = lsspl[1];
var cpspl = cpval.split("-");
var cpprice = cpspl[1];
var lcspl = lcval.split("-");
var lcprice = lcspl[1];

var lstot = lnnum*lsprice;
var cptot = lnnum*cpprice;
var tot = parseFloat(lstot)+parseFloat(cptot)+parseFloat(lcprice);
var total = tot*qtyval;

var totalformat = total.toFixed(2);

document.getElementById("calc").innerHTML = totalformat;
}

function gettotalcost(eff,bs,efb,et,price) 
{
var effobj = document.getElementById('xfacefront');
var effindex = effobj.selectedIndex;

var bsobj = document.getElementById('backside');
var bsindex = bsobj.selectedIndex;

var efbobj = document.getElementById('xfaceback');
var efbindex = efbobj.selectedIndex;

var etobj = document.getElementById('txtline');
var etindex = etobj.selectedIndex;

var qtyobj = document.getElementById('quantity_itemsordertmp');
var qtyindex = qtyobj.selectedIndex;

var effval = effobj.options[effindex].value;
var bsfval = bsobj.options[bsindex].value;
var efbval = efbobj.options[efbindex].value;
var etval = etobj.options[etindex].value;
var qtyval = qtyobj.options[qtyindex].value;

var efftot = effval*eff*qtyval;
if(bsfval=="yes")
	{
	var bsftot = bs*qtyval;
	var efbtot = efbval*efb*qtyval;
	}
else
	{
	var bsftot = 0;
	var efbtot = 0;
	}
var ettot = etval*et*qtyval;
price = price*qtyval;

var total = efftot+bsftot+efbtot+ettot+price;

var totalformat = total.toFixed(2);;

document.getElementById("calc").innerHTML = totalformat;
}

function itemChanged2(menu,eff,bs,efb,et,price) 
{
if (menu.options[menu.selectedIndex].value=="yes") 
	{ 
	document.getElementById('tbxfb').style.display = ''; 
	}   
else 
	{
	document.getElementById('tbxfb').style.display = 'none'; 
	}
gettotalcost(eff,bs,efb,et,price);
}

function itemChanged(menu) 
{
	if (menu.options[menu.selectedIndex].value=="yes") 
	{ 
	document.getElementById('tbxfb').style.display = ''; 
	}   
	else 
	{
	document.getElementById('tbxfb').style.display = 'none'; 
	}
}
function move_in(img_index,img_id) {
	img_name="Image"+img_index;
	img_src="../images/icon_productlist_on"+img_index+".jpg";
	b_array = document.getElementById("imgcontent").getElementsByTagName("div");
	//document[img_name].src=img_src;
	for (var i=0; i<b_array.length; i++) {
	k=i+1;
	b_array[i].className='product-img hidden';
	if(img_id==k)
		{b_array[i].className='product-img'; }
	}
}

function move_out(img_index) {
	j=0;
	imgtabs_class = new Array();
	img_name="Image"+img_index;
	img_class=document[img_name].className;
	img_src="../images/icon_productlist_off"+img_index+".jpg";
	if(img_class=='productlistoff')
	{
	//document[img_name].src=img_src;
	}
	c_array = document.getElementById("imgtabs").getElementsByTagName("img");
	for (var i=0; i<c_array.length; i++) {
	imgtabs_class[i]=c_array[i].className;
	if(imgtabs_class[i]=='productliston')
		{j=i;}
	}
	b_array = document.getElementById("imgcontent").getElementsByTagName("div");
	for (var i=0; i<b_array.length; i++) {
	b_array[i].className='product-img hidden';
	if(j==i)
		{b_array[i].className='product-img'; }
	}
	
}

function showtab(a) {

	var a_array = document.getElementById("tabs").getElementsByTagName("a");
	var j=0;
	for (var i=0; i<a_array.length; i++) {
		a_array[i].className='';
		if(a==a_array[i])
		{ j=i;}
	}
	if(a!=null){
		a.className="active";
	}
	var b_array = new Array();
	var c_array = document.getElementById("tabscontent").getElementsByTagName("div");
	for (var i=0; i<c_array.length; i++){
	  if (c_array[i].className=='tabcontent' || c_array[i].className=='tabcontent hidden'){
	    b_array.push(c_array[i]);
	  }
	}
	for (var i=0; i<b_array.length; i++) {
		b_array[i].className='tabcontent hidden';
		if(j==i)
			{b_array[i].className='tabcontent'; }
	}
}

function showtab2(a) {

	var a_array = document.getElementById("tabs").getElementsByTagName("a");
	var j=0;
	for (var i=0; i<a_array.length; i++) {
		a_array[i].className='';
		if(a==a_array[i])
		{ j=i;}
	}
	if(a!=null){
		a.className="active";
	}
	var b_array = new Array();
	var c_array = document.getElementById("tabscontent2").getElementsByTagName("div");
	for (var i=0; i<c_array.length; i++){
	  if (c_array[i].className=='tabcontent' || c_array[i].className=='tabcontent hidden'){
	    b_array.push(c_array[i]);
	  }
	}
	for (var i=0; i<b_array.length; i++) {
		b_array[i].className='tabcontent hidden';
		if(j==i)
			{b_array[i].className='tabcontent'; }
	}
}

function showimg(a) {

	var a_array = document.getElementById("imgtabs").getElementsByTagName("img");
	var j=0;
	var k=0;
	for (var i=0; i<a_array.length; i++) {
		k=i+1;
		l=a_array[i].name;
		m=l.substring(5);
		a_array[i].className='productlistoff';
		//a_array[i].src="../images/icon_productlist_off" + m + ".jpg";
		if(a==a_array[i])
		{ 
		j=i;
		a_array[i].className='productliston';
		//a_array[i].src="../images/icon_productlist_on" + m + ".jpg";
		}
	}
	var b_array = new Array();
	var c_array = document.getElementById("imgcontent").getElementsByTagName("div");
	for (var i=0; i<c_array.length; i++){
	  if (c_array[i].className=='product-img' || c_array[i].className=='product-img hidden'){
	    b_array.push(c_array[i]);
	  }
	}
	for (var i=0; i<b_array.length; i++) {
		b_array[i].className='product-img hidden';
		if(j==i)
			{b_array[i].className='product-img'; }
	}
}

function move_in2(img_index,img_id) {
	img_name="Image"+img_index;
	img_src="../images/icon_productcrt_on"+img_index+".jpg";
	b_array = document.getElementById("imgcontent").getElementsByTagName("div");
	//document[img_name].src=img_src;
	for (var i=0; i<b_array.length; i++) {
	k=i+1;
	b_array[i].className='product-img hidden';
	if(img_id==k)
		{b_array[i].className='product-img'; }
	}
}

function move_out2(img_index) {
	j=0;
	imgtabs_class = new Array();
	img_name="Image"+img_index;
	img_class=document[img_name].className;
	img_src="../images/icon_productcrt_off"+img_index+".jpg";
	if(img_class=='productlistoff')
	{
	//document[img_name].src=img_src;
	}
	c_array = document.getElementById("imgtabs").getElementsByTagName("img");
	for (var i=0; i<c_array.length; i++) {
	imgtabs_class[i]=c_array[i].className;
	if(imgtabs_class[i]=='productliston')
		{j=i;}
	}
	b_array = document.getElementById("imgcontent").getElementsByTagName("div");
	for (var i=0; i<b_array.length; i++) {
	b_array[i].className='product-img hidden';
	if(j==i)
		{b_array[i].className='product-img'; }
	}
	
}

function showimg2(a) {

	var a_array = document.getElementById("imgtabs").getElementsByTagName("img");
	var j=0;
	var k=0;
	for (var i=0; i<a_array.length; i++) {
		k=i+1;
		l=a_array[i].name;
		m=l.substring(5);
		a_array[i].className='productlistoff';
		//a_array[i].src="../images/icon_productcrt_off" + m + ".jpg";
		if(a==a_array[i])
		{ 
		j=i;
		a_array[i].className='productliston';
		//a_array[i].src="../images/icon_productcrt_on" + m + ".jpg";
		}
	}
	var b_array = new Array();
	var c_array = document.getElementById("imgcontent").getElementsByTagName("div");
	for (var i=0; i<c_array.length; i++){
	  if (c_array[i].className=='product-img' || c_array[i].className=='product-img hidden'){
	    b_array.push(c_array[i]);
	  }
	}
	for (var i=0; i<b_array.length; i++) {
		b_array[i].className='product-img hidden';
		if(j==i)
			{b_array[i].className='product-img'; }
	}
}
