	//global variables that can be used by ALL the function son this page.
var inputs;
var imgFalse = 'http://www.silverdollardesign.com/images/unchecked.gif';
var imgTrue = 'http://www.silverdollardesign.com/images/checked.gif';

//this function runs when the page is loaded, put all your other onload stuff in here too.
function init(num) {
    replaceChecks(num);
}	

function replaceChecks(num) {
    
    //get all the input fields on the page
    inputs = document.getElementsByTagName('input');

    //cycle trough the input fields
    for(var i=0; i < inputs.length; i++) {

        //check if the input is a checkbox
        if(inputs[i].getAttribute('type') == 'checkbox') {
            
            //create a new image
            var img = document.createElement('img');
            
            //check if the checkbox is checked
            if(inputs[i].checked) {
                img.src = imgTrue;
            } else {
                img.src = imgFalse;
            }

            //set image ID and onclick action
            img.id = 'checkImage'+i;
            //set image
            img.onclick = new Function('checkChange('+i+');updateTotal('+num+');');
            //place image in front of the checkbox
            inputs[i].parentNode.insertBefore(img, inputs[i]);
            
            //hide the checkbox
            inputs[i].style.display='none';
        }
    }
}

//change the checkbox status and the replacement image
function checkChange(i) {

    if(inputs[i].checked) {
        inputs[i].checked = '';
        document.getElementById('checkImage'+i).src=imgFalse;
    } else {
        inputs[i].checked = 'checked';
        document.getElementById('checkImage'+i).src=imgTrue;
    }
}

function updateTotal(number)
{
	var d = document;
	var x = 0;
	var i = 0;
	for(i = 0; i < number; i++)
	{
		box = "box_" + i;
		var cur=d.getElementById?d.getElementById(box):d.all?d.all[box]:d.layers[box];
		if(cur.checked)
		{
			x = x + parseInt(cur.value);
		}
	}
	
	
	totalBox = "total";
	var tot=d.getElementById?d.getElementById(totalBox):d.all?d.all[totalBox]:d.layers[totalBox];
	x = x.toFixed(2);
	inp = "<a class='redNav' href='javascript:document.form1.submit()'>Request Official Quote</a>";
	tot.innerHTML = "<table width='191' cellspacing='0' cellpadding='0' border='0'><tr height='11'><td style=background-image:url('images/totaltop.jpg')></td></tr><tr height='139'><td bgcolor='white' align='center'><span style='font:bold 12px Arial, Helvetica, sans-serif;'>Approximate Cost</span><BR><BR><span style='color:000000;font:bold 16px Arial, Helvetica, sans-serif;'>$" + x + "</span><BR><BR><BR><BR>" + inp + "</td></tr><tr height='11'><td style=background-image:url('images/totalbottom.jpg')></tr></table>";
}

function setNoPrice()
{
	d = document;
	totalBox = "total";
	var tot=d.getElementById?d.getElementById(totalBox):d.all?d.all[totalBox]:d.layers[totalBox];
	tot.innerHTML = "Please Contact for Hourly Rates";
}


function changeTopBoxes(num)
{
	for(i = 1; i < 5; i++)
	{
		if (i == num)
		{
			document.getElementById('topbox_'+i).src=imgTrue;
		}
		else
		{
			document.getElementById('topbox_'+i).src=imgFalse;	
		}
	}
	
	if(num == 1)
	{
		items = 6;
		checks =  "<center><table border='0' cellspacing='0' cellpadding='0' width='700'>";
		checks += "<tr height='10'>";
		checks += "<td width='475' class='pricingCheckHeading'><BR><BR>Package Ideas:<BR><BR></td>";
		checks += "<td width='225' class='pricingCheckHeading'><BR><BR>Extras:<BR><BR></td>";
		checks += "</tr><tr>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_The_Basics' id='box_0' onclick='updateTotal("+items+")' value='500'><span class='pricingDescriptionRed'>The Basics: </span>logo, business card, envelope, and stationery design</td>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Add_3' id='box_1' onclick='updateTotal("+items+")' value='500'><span class='pricingDescriptionRed'>Add On: </span>3 collateral pieces</td>";
		checks += "</tr><tr>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Basics_Plus_Web_site' id='box_2' onclick='updateTotal("+items+")' value='1600'><span class='pricingDescriptionRed'>The Basics Plus Simple Web site:</span> informational site, up to 6 pages</td>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Add_6' id='box_3' onclick='updateTotal("+items+")' value='900'><span class='pricingDescriptionRed'>Add On:</span> 6 collateral pieces</td>";
		checks += "</tr><tr>";
		checks += "<td colspan='2' class='pricingDescription'><input type='checkbox' name='item_Basics_Plus_Dynamic_site' id='box_4' onclick='updateTotal("+items+")' value='3200'><span class='pricingDescriptionRed'>The Basics Plus Complex Web site:</span> dynamic site, more than 6 pages</td>";
		checks += "</tr><tr>";
		checks += "<td colspan='2' class='pricingDescription'><input type='checkbox' name='item_All_Inclusive' id='box_5' onclick='updateTotal("+items+")' value='5000'><span class='pricingDescriptionRed'>The All-Inclusive:</span> the basics, complex website, 8 collateral pieces</td>";
		checks += "</tr>";
		checks += "</table></center>";
		document.getElementById('checkSection').innerHTML = checks;
	}
	if(num == 2)
	{
		items = 5;
		checks =  "<center><table border='0' cellspacing='0' cellpadding='0' width='700'>";
		checks += "<tr>";
		checks += "<td width='475' class='pricingCheckHeading'><BR><BR>Redesign Ideas:<BR><BR></td>";
		checks += "<td width='225' class='pricingCheckHeading'><BR><BR>Extras:<BR><BR></td>";
		checks += "</tr><tr>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Logo_+_Graphic_Identity' id='box_0' onclick='updateTotal("+items+")' value='300'>Logo B&W and Color</td>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Add_3' id='box_1' onclick='updateTotal("+items+")' value='500'><span class='pricingDescriptionRed'>Add On:</span> 3 Collateral Pieces</td>";
		checks += "</tr><tr>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Simple_Web_site' id='box_2' onclick='updateTotal("+items+")' value='1200'>Simple Web site (up to 6 pages)</td>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Add_6' id='box_3' onclick='updateTotal("+items+")' value='900'><span class='pricingDescriptionRed'>Add On:</span> 6 Collateral Pieces</td>";
		checks += "</tr><tr>";
		checks += "<td colspan='2' class='pricingDescription'><input type='checkbox' name='item_Logo' id='box_4' onclick='updateTotal("+items+")' value='3000'>Dynamic Web site (major programming revisions, more than 6 pages)</td>";
		checks += "</tr>";
		checks += "</table></center>";
		document.getElementById('checkSection').innerHTML = checks;
}
	if(num == 3)
	{
		items = 16;
		checks =  "<center><table border='0' cellspacing='0' cellpadding='0' width='700'>";
		checks += "<tr>";
		checks += "<td colspan='3' class='pricingCheckHeading'><BR>Select any of the following ideas:<BR><BR></td>";
		checks += "</tr><tr>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Logo_BW_+_Color' id='box_0' onclick='updateTotal("+items+")' value='300'>Logo B&W and Color</td>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Simple_Web_site' id='box_1' onclick='updateTotal("+items+")' value='1200'>Simple Web site (up to 6 pages)</td>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Poster' id='box_2' onclick='updateTotal("+items+")' value='200'>Poster</td>";
		checks += "</tr><tr>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Letterhead' id='box_3' onclick='updateTotal("+items+")' value='100'>Letterhead</td>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Dynamic_Web_site' id='box_4' onclick='updateTotal("+items+")' value='3000'>Dynamic Web site</td>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Flyer' id='box_5' onclick='updateTotal("+items+")' value='200'>Flyer</td>";
		checks += "</tr><tr>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Business_Card' id='box_6' onclick='updateTotal("+items+")' value='100'>Business Card</td>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Product_List' id='box_7' onclick='updateTotal("+items+")' value='400'>Product List</td>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Slide_Template' id='box_8' onclick='updateTotal("+items+")' value='200'>Sales Presentation / Template</td>";
		checks += "</tr><tr>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Tri-fold_Brochure' id='box_9' onclick='updateTotal("+items+")' value='400'>Tri-Fold Brochure</td>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Catalog' id='box_10' onclick='updateTotal("+items+")' value='400'>Catalog</td>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Newsletter' id='box_11' onclick='updateTotal("+items+")' value='400'>Newsletter</td>";
		checks += "</tr><tr>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Direct_Mail_Piece' id='box_12' onclick='updateTotal("+items+")' value='200'>Direct Mail Piece</td>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Restaurant_Menu' id='box_13' onclick='updateTotal("+items+")' value='300'>Restaurant Menu</td>";
		checks += "</tr><tr>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Print_Advertisement' id='box_14' onclick='updateTotal("+items+")' value='200'>Print Advertisement</td>";
		checks += "<td class='pricingDescription'><input type='checkbox' name='item_Media_Cover_Design' id='box_15' onclick='updateTotal("+items+")' value='200'>Media Cover Design</td>";
		checks += "</tr>";
		checks += "</table></center>";
		document.getElementById('checkSection').innerHTML = checks;
	}
	if(num == 4)
	{
		checks =  "<center><table border='0' cellspacing='0' cellpadding='0' width='700'>";
		checks += "<tr>";
		checks += "<td width='700' class='pricingCheckHeading'><BR><BR>Select A Consulting Option:<BR><BR></td>";
		checks += "</tr><tr>";
		checks += "<td class='pricingDescription'>Web site Consulting - <span class='pricingDescriptionRed'>$100/hr</span></td>";
		checks += "</tr><tr>";
		checks += "<td class='pricingDescription'>Marketing Collateral Consulting - <span class='pricingDescriptionRed'>$100/hr</span></td>";
		checks += "</tr><tr>";
		checks += "<td class='pricingDescription'>Learn to Update Your Marketing Collateral - <span class='pricingDescriptionRed'>$75/hr</span></td>";
		checks += "</tr><tr>";
		checks += "<td class='pricingDescription'>Learn to Update Your Web site - <span class='pricingDescriptionRed'>$75/hr</span></td>";
		checks += "</tr>";
		checks += "</table></center>";
		document.getElementById('checkSection').innerHTML = checks;
	}
}
