function clearContainer() {

document.getElementById('equipInput').innerHTML = "<tr><td>&nbsp;</td></tr>";

      showHideLoad();
}

function selectThis() {
  var Content;
  if (document.getElementById('Attach').checked == true) {
	  Content = '<p class="BlueStrmStyles"><b>Instructions - Attachment</b><br />';
		Content += '1. Complete upper section.<br />';
    Content += '2. Attach a file containing your inventory (.doc, .xls, .pdf, etc.).<br />';
    Content += '3. Click "Submit Attachment".</p>';
    Content += '<span align="right" class="BlueStrmStyles"> ';
    Content += 'Attachments (5mb max.):</span>';
		Content += '<input type="hidden" name="MAX_FILE_SIZE" value=6024000 />';
		Content += " <input type='file' name='attachment' class='FormFields' size='40' /><br /><br />";
		Content += "<input type='submit' name='submit' class='FormFields' value='Submit Attachment' onClick=\"MM_validateForm('Company Name','','R','First Name','','R','Last Name','','R','Phone','','R','Email','','RisEmail','Own equipment?','','R', 'Brokering for third party?', '', 'R','Equipment availability','','R', 'Quantity0', '', 'R', 'Item0', '', 'R', 'Condition0', '', 'R');return document.MM_returnValue;\" />";
		Content += "&nbsp;&nbsp;&nbsp;<input type='button' name='return' class='FormFields' value='Cancel' onclick='clearContainer()' />";
	document.getElementById('showHide').innerHTML = Content;
	} 
	if (document.getElementById('List').checked == true) {
		Content = '<p class="BlueStrmStyles"><b>Instructions - Build List:</b><br />';
    Content += '1. Complete upper section.<br />';
    Content += '2. Enter number of items in list (Max = 99).<br />';
    Content += '3. Click "Build List".<br />';
    Content += '4. Enter Quantity, Item, & Condition for each item.<br />';
    Content += '5. Click "Submit List".</p>';
    Content += '<span class="List" align="right">How many items would ';
    Content += 'you like to enter?&nbsp;';
    Content += '</span>';
    Content += '<span class="BlueStrmStyles">';
    Content += "<input type='text' name='Num Items' id='Num Items' size='3' maxlength='2' class='FormFields' />";
    Content += "&nbsp;";
    Content += "<input name='Num Button' type='button' class='FormFields' id='Num Button' onClick='updateFields();' value='Build List' />";
		Content += "&nbsp;&nbsp;&nbsp;<input type='button' name='return' class='FormFields' value='Cancel' onclick='clearContainer()' />";
    Content += "<br /><span id='complete' class='asterisk'>&nbsp;</span></span>";
	  document.getElementById('showHide').innerHTML = Content;
	}
  
}


function updateFields() {

	var ceiling = document.getElementById('Num Items').value;
	var i = 0;
	document.getElementById('complete').innerHTML = 'Now please complete the grid below.';
	document.getElementById('equipInput').innerHTML = "<tr><td colspan=\'3\' bgcolor=\'#EDEDED\'><span class=\'List\'>Please enter your equipment information below.</span><br /><br /></td></tr>";
	document.getElementById('equipInput').innerHTML += "<tr><td bgcolor=\'#EDEDED\'><span bgcolor=\'#EDEDED\' class=\'List\'>Quantity&nbsp;&nbsp;&nbsp;&nbsp;</span></td><td bgcolor=\'#EDEDED\'><span bgcolor=\'#EDEDED\' class=\'List\'>Item&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></td><td bgcolor=\'#EDEDED\'><span bgcolor=\'#EDEDED\' class=\'List\'>Condition</span><br /></td></tr>";
	for(i = 0; i < ceiling; i++) {
		document.getElementById('equipInput').innerHTML += "<tr><td bgcolor=\'#E9F0F4\'><input name = \'Quantity" + i + "\' type = \'text\' size=\'10\' class=\'FormFields\' maxlength=\'4\' /></td><td bgcolor=\'#E9F0F4\'><input name = \'Item" + i + "\' type = \'text\' size=\'37\' class=\'FormFields\' /></td><td bgcolor=\'#E9F0F4\'><select name = \'Condition" + i + "\' class=\'FormFields\'><option value=\'New                \'>New</option><option value=\'Used (Excellent)\'>Used (Excellent)</option><option value=\'Used (Good)     \'>Used (Good)</option><option value=\'Used (Fair)     \'>Used (Fair)</option><option value=\'Defective         \'>Defective</option></select><br /></td></tr>";
	}
	document.getElementById('equipInput').innerHTML += "<tr><td><input class=\'FormFields\' type=\'submit\' value=\'Submit List\' onClick=\"MM_validateForm('Company Name','','R','First Name','','R','Last Name','','R','Phone','','R','Email','','RisEmail','Own equipment?','','R', 'Brokering for third party?', '', 'R','Equipment availability','','R', 'Quantity0', '', 'R', 'Item0', '', 'R', 'Condition0', '', 'R');return document.MM_returnValue;\"/></<td></tr><br />";
}

function validateForm() {
	document.getElementById('Quantity0').value = p;
	document.getElementById('Item0').value = q;
	document.getElementById('Condition0').value = r;
	if(!p || !q || !r)
		alert("At least one complete item field is required.");
	return;
	
	
}

function openWin(url, width, height)
{
 window.open(url,'pt_win','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + width + ', height=' + height)
};

// Track referrer
function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name)
{
	createCookie(name,"",-1);
}

var referrer = readCookie('referrer')
if (!referrer) {
	createCookie('referrer', document.referrer, 7);
}