<?xml version="1.0"?>
<?xml-stylesheet href="../website.xsl" type="text/xsl"?>
<!DOCTYPE body SYSTEM "../common.dtd" [
<!ENTITY countries SYSTEM "countries.inc">
]>
<body>
<div id="BANNER">
&mdibanner;
</div>
<style>
input { font-weight:bold;   }
.form { background-color:rgb(222,238,254); }
.total { font-weight:bold;  }
.smallprint { font-size:8pt; }
</style>
<SCRIPT language="JavaScript">
	var timerid     = null;
	var matchString = "";
	var mseconds    = 1000;	// Length of time before search string is reset

	function shiftHighlight(keyCode,targ)
	{
		keyVal      = String.fromCharCode(keyCode); // Convert ASCII Code to a string
		matchString = matchString + keyVal; // Add to previously typed characters
		elementCnt  = targ.length - 1;	// Calculate length of array -1
		for (i = elementCnt; i > 0; i--)
		{
			selectText = targ.options[i].text.toLowerCase(); // convert text in SELECT to lower case
			if (selectText.substr(0,matchString.length) == 	matchString.toLowerCase())
			{
				targ.options[i].selected = true; // Make the relevant OPTION selected
			}
		}
		clearTimeout(timerid); // Clear the timeout
		timerid = setTimeout('matchString = ""',mseconds); // Set a new timeout to reset the key press string
	
		return false; // to prevent IE from doing its own highlight switching
	}
</SCRIPT>
<form method="POST" action="form.asp">
<h1>Messianic Dance International - Order Form</h1>
<div id="AD">
<center>
<font size="4"><img src="/images/discount.jpg" width="76" height="42"/> discount if you buy 3 or more complete sets.</font>
</center>
</div>
<div id="OPENING">
<p>
You may order these materials by adding selected items in the form below
and printing it, then mailing it along with your check
to <font face="courier">Messianic Dance International 7935 136th Avenue SE, Newcastle, WA 98059.</font> 
</p><p>
This form is designed to work in Microsoft Internet Explorer and should
calculate the totals for you.  If you experience problems with this
form please goto our <a href="/catalog/form.xml">Original Order Form</a> and 
fill it out manually, thanks.
If you have any questions, please 
call MDI at (425) 793-3004. 
</p>
</div>

<table border="2" cellpadding="3" cellspacing="0" class="form" align="right">
<tr>
<th class="liteback" align="left">Ship To:</th></tr>
<tr>
<td>
Name <input type="text" name="Name" size="70"/>
</td></tr><tr><td>
Address <input type="text" name="Address" size="70"/>
</td></tr><tr><td>
City <input type="text"  name="City" size="20"/>
State <input type="text" name="State"  size="15"/>
Zip <input type="text" name="Zip"  size="15" />
</td></tr><tr><td>
Country 
<select name="Country" id="country" onblur="CalcTotal()" accesskey='s' label='Select a country' size="1" onKeyPress = 'return shiftHighlight(event.keyCode, this);'>'
<option>Select a Country</option>
&countries;
</select>
Phone <input type="text" name="Phone" size="20" />
</td></tr>
</table>
<br clear="all"/>
<br/>

<table border="2" cellpadding="3" cellspacing="0" class="form" align="right">
<tr>
<th class="liteback" align="left">Payment By:</th></tr>
<tr>
<tr><td>
Payment must accompany order.  Sorry, our discount prices don’t permit billing or COD.  
We cannot accept payment by stamps.  Overseas customers, your payment must be in U.S. 
funds from a U.S. bank.  
<!-- Canadian customers, please add 40% exchange if you pay in Canadian dollars.  -->
If you pay with a credit card, your bank will calculate the amount based on the 
current exchange rate for you. 
</td>
</tr>
<td>
<input type="checkbox" name="Check"/> Check/money order
<input type="checkbox" name="MasterCard"/> MasterCard
<input type="checkbox" name="VISA"/> VISA
<input type="checkbox" name="Discover"/> Discover
<input type="checkbox" name="Gift certificate"/> Novus
</td></tr><tr><td>
Credit Card Number
 <input type="text" name="CCard" size="30"/> &nbsp;
Expiration Date (mm/yy)
<input type="text" name="exp" size="10"/><br/>
<i>Please be sure to include the digits in the metallic portion of your card.</i>
</td></tr><tr><td>
<br/>
Signature of Authorized Buyer: _______________________________________
 
</td></tr>
</table>
<br clear="all"/>
<br/>

<table id="ITEMS" border="2" cellpadding="3" cellspacing="0" class="form" width="100%">
<tr><th class="liteback">Quantity</th><th class="liteback">Item</th><th class="liteback">Media</th><th class="liteback">Total</th></tr>
<tr id="INPUTROW" ><td><input type='text' id="QUANTITY"  size="5"/></td>
<td><select id="ITEM" onchange="OnItemSelected()">
<option value="Beginner 1">Beginner 1</option>
<option value="Beginner 2">Beginner 2</option>
<option value="Beginner 3">Beginner 3</option>
<option value="Interconnections">Interconnections</option>
<option value="Intermediate 1">Intermediate 1</option>
<option value="Intermediate 2">Intermediate 2</option>
<option value="Intermediate 3">Intermediate 3</option>
<option value="Advanced 1">Advanced 1</option>
<option value="Advanced 2">Advanced 2</option>
<option value="Advanced 3">Advanced 3</option>
</select></td>
<td><select id="MEDIA">
<option value="Book">Book ($8.00)</option>
<option value="Audio Tape">Audio Cassette Tape ($12.00)</option>
<option value="Audio CD">Audio CD ($12.00)</option>
<option value="Video">Video ($25.00)</option>
<option value="DVD">DVD ($30.00)</option>
<option value="Book/Audio CD/Video">Set A: Book/Audio CD/Video ($45.00)</option>
<option value="Book/Audio CD/DVD">Set B: Book/Audio CD/DVD ($50.00)</option>
</select>

<select id="MEDIA2" style="display:none">
<option value="Book">Book ($8.00)</option>
<option value="Audio Tape">Audio Cassette Tape ($12.00)</option>
<option value="CD">Audio CD ($12.00)</option>
</select>

</td>
<td><input type="button" value="ADD" onclick="AddRow()" id="ADD"/></td>
</tr>
<tr><th colspan="3" align="right">Subtotal</th><th align="right"><span id="SUBTOTAL">&#160;</span></th></tr>
<tr id="DISCOUNTROW"><th colspan="3" align="right">Discount</th><th align="right"><span id="DISCOUNT">&#160;</span></th></tr>
<tr><th colspan="3" align="right">Weight</th><th align="right"><span id="WEIGHT">&#160;</span></th></tr>
<tr><th colspan="3" align="right">Postage</th><th align="right"><span id="POSTAGE">&#160;</span></th></tr>
<tr><th colspan="3" align="right">Total</th><th align="right"><span id="TOTAL">&#160;</span></th></tr>
</table>

<br clear="all"/>
<br/>
<p class="smallprint">
MDI is obligated by law to track and report the duplication of any video 
recordings, sound recordings and study guides to the entities who gave us 
permission to use them.  These materials cannot be copied or duplicated by 
any means for any purpose.  To receive your order, sign the statement below 
that acknowledges to us and to these entities your agreement to uphold the 
integrity of the copyright law that secures these materials.
</p>
<p class="smallprint">
I will not copy or duplicate the tapes or study guides produced 
by Messianic Dance International for any purpose.
</p>
<p class="smallprint">
Signed______________________________
</p>
<div id="TRAILER">
<center><font size="-1">
<a href="http://www.messianicdance.org">Messianic Dance International</a><br/>
7935 136th Avenue SE, Newcastle, WA 98059<br/>
Phone (425) 793-3004, Fax (425) 793-3003<br/>
Email: <a href='mailto:mdi@BeitTikvah.com'>mdi@BeitTikvah.com</a><br/>
</font></center>
</div>
</form>

<script>
<![CDATA[
var PostageTable1 = new Array(10,20,30,50,100,200,   300, 100000);
var PostageTable2 = new Array( 4, 5, 6, 8,  10, 16, 20,  28);
var ItemPrices = new Array(8,8,12,25,30,45,50);

// book, tape, cd, video, book-cassette-video, book-cd-video
var ItemWeights = new Array(4.8, 2.3, 2.3, 9.5, 16.6, 16.6);

function GetValue(cell)
{
	var v = document.all(cell).value;
	if (v == "") return 0;
	var value = parseInt(v);
	if ("x" + value == "xNaN")
	{
		alert("Must enter a valid number");
		document.all(cell).select();
		return -1;
	}
	return value;
}

function OnItemSelected() {
   var v = document.all("ITEM").value;
   var m = document.all("MEDIA");
   var n = document.all("MEDIA2");
   if (v == "Intermediate 3" || v == "Advanced 3"){
      var o = m;
      m = n;
      n = o;
   }  
   m.style.display = "";
   n.style.display = "none";  
}

function AddRow()
{		
	var rowindex = document.all("QUANTITY").parentElement.parentElement.rowIndex;
	var row = ITEMS.insertRow(rowindex);
	var cell = row.insertCell();
	var qty = parseInt(document.all("QUANTITY").value);
	if (isNaN(qty)) qty = 1;
	cell.innerHTML = "<input type='text' value='"+qty+"' onblur='CalcRowTotal()'  size='5' />";
	cell = row.insertCell();
	cell.innerText = document.all("ITEM").value;
	cell = row.insertCell();
	var m = document.all("MEDIA");
	if (m.style.display == "none") {
	  m = document.all("MEDIA2");
	}
	cell.innerText = m.value;
	cell = row.insertCell();
	cell.id = "row"+rowindex+"total";
	cell.align="right";
	cell.media = m.selectedIndex;
	cell.innerText = Dollar(qty*ItemPrices[cell.media]);
	cell.weight = qty * ItemWeights[cell.media];
	CalcSubTotal();	
}	
function CalcRowTotal()
{
	var qty = parseInt(event.srcElement.value);	
	var row = event.srcElement.parentElement.parentElement;
	var index = row.rowIndex;
	var id = "row"+row.rowIndex+"total";
	if (qty == 0) {
		var table = row.parentElement;
		while (table.tagName != "TABLE") {
			table = table.parentElement;
		}
		table.deleteRow(index);
		// re-number following row ids.
		while (index++) {
			var cell = document.all("row"+index+"total");
			if (cell) {
				cell.id = "row"+(index-1)+"total"
			} else {
				break;
			}
		}
	} else {		
		var cell = document.all(id);
		cell.innerText = Dollar(qty*ItemPrices[cell.media]);
		cell.weight = qty * ItemWeights[cell.media];
	}
	CalcSubTotal();
}

function GetInt(e) {
	var v = e.innerText;
	var value = parseInt(v);
	if ("x" + value != "xNaN")
	{
		return value;
	}
	return 0;
}

function CalcSubTotal()
{
	var total = 0;
	var i = 1;
	var totalweight = 0;
	var totalsets = 0;
	while (1)
	{
	    var cell = document.all("row" + i + "total");
	    if (! cell) break;

        var row = cell.parentElement;
	    var media = row.cells[2].innerText;
	    if (media == "Book/Tape/Video" || media == "Book/CD/Video") {
	        var input = row.cells[0].firstChild;
    	    totalsets += parseInt(input.value)
		}
	    total += GetInt(cell);
		totalweight += cell.weight;
		i++;
	}	
	document.all("subtotal").innerHTML = Dollar(total);	
	if (totalsets >= 3) {
	    document.all("DISCOUNT").innerHTML = Dollar(-1*(total*0.1));
	} else {
	    document.all("DISCOUNT").innerHTML = "&#160;";
	}
	document.all("weight").innerHTML = Pounds(totalweight);		
	CalcTotal();
}
function Trim(s)
{
    s = s.replace(/^\s*/g, "");
    s = s.replace(/\s*$/g, "");
    return s;
}
function GetCountry()
{
  var countries = document.all("country");
	var c = Trim(countries.value);
	if (c == ""){
	    c = "United States of America";
	    countries.value = c;
	}
	return c;
}
function Dollar(n)
{
    var s = ""+parseInt(n*100)/100;
    var p = s.lastIndexOf(".");
    if (p<0) 
		return s + ".00";
    else (p > 0 && p >= s.length-1) 
        s = s + "0";
    return s;
}
function Pounds(w)
{
	var lbs = parseInt(w/16);
	var oz = Math.ceil(w - (lbs*16));
	if (oz == 16) {
		lbs++;  // rounding brought it up to 1lb.
		oz = 0;
	}
	var result = "";
	if (lbs>0) {
		result = lbs + " lbs ";
	}
	if (oz>0) {
		result += oz + " oz";
	}
	return result;		
}
function CalcTotal()
{
	var subtotal = GetInt(document.all("SUBTOTAL"));
	if (subtotal == 0)
	{
		document.all("POSTAGE").innerHTML = 0;
		document.all("TOTAL").innerHTML = 0;
	}
	for (i = 0; i < 7; i++)
	{
		if (subtotal < PostageTable1[i])
		{
			break;
		}
	}
	var x = 1;
	var country = GetCountry().toUpperCase();

	if (country == "CANADA" || country == "MEXICO") {
		x = 2;
	} else if (country != "UNITED STATES OF AMERICA") {
		x = 3;
  }
	var discount = GetInt(document.all("DISCOUNT"));
	var postage = PostageTable2[i] * x;
	document.all("POSTAGE").innerHTML = Dollar(postage);
	document.all("TOTAL").innerHTML = "$"+Dollar(subtotal + discount + postage);
}

var printing = 0;

function HideNonPrintElements()
{
    Toggle('BANNER','none');
    Toggle('OPENING','none');
    Toggle('TOCTABLE','none');
    Toggle('INPUTROW','none');
    Toggle('TRAILER','none');
    Toggle('AD', 'none');
    if (document.all("DISCOUNT").innerHTML == "&#160;") {
        Toggle('DISCOUNTROW', 'none');
    }
	printing++;
}
function ShowNonPrintElements()
{
	printing = printing - 1;
	if (printing == 0) {
        Toggle('BANNER','');
        Toggle('OPENING','');
        Toggle('TOCTABLE','');
        Toggle('INPUTROW','');
        Toggle('TRAILER','');
        Toggle('AD','');
        Toggle('DISCOUNTROW', '');
	}
}

]]>
</script>

</body>

