
function copyContactInfo(type){
	var f=document.f;
if (type=="1"){    	
	var fromFields=["name",
	"shipping_address_street_address",
	"shipping_address_city",
	"shipping_address_state",
	"shipping_address_zip"];
} else {
	var fromFields=["Business_Card_Information_name",
	"Business_Card_Information_street_address",
	"Business_Card_Information_city",
	"Business_Card_Information_state",
	"Business_Card_Information_zip"];
	
}	    

	var toFields=["brochure_worksheet_contact_agents_name",
	"brochure_worksheet_contact_street_address",
	"brochure_worksheet_contact_city",
	"brochure_worksheet_contact_state",
	"brochure_worksheet_contact_zip"];

	for (r=0;r<fromFields.length;r++){
		if (!f[fromFields[r]]) alert("not found: "+fromFields[r]);
		f[toFields[r]].value=f[fromFields[r]].value;
	}
}

function checkForm(f){
var reqArr=['agency', 'name', 'brochure_worksheet_contact_agents_name', 'brochure_worksheet_contact_street_address', 'brochure_worksheet_contact_city', 'brochure_worksheet_contact_state', 'brochure_worksheet_contact_zip'];
var err='';
	//if (window.extraValidation) err+=extraValidation(f);
	//alert(reqArr);
	for (t=0;t<reqArr.length;t++){
	if (!f[reqArr[t]]) alert("no field: "+reqArr[t]);
		if (f[reqArr[t]].type=="text" || f[reqArr[t]].type=="file"){
			if (f[reqArr[t]].value=="") err+="\t - "+reqArr[t].replace(/_/g," ")+"\n";
		} else if (f[reqArr[t]].type=="select-one"){
			var selchk=false; 
			for (var o = 0; o < f[reqArr[t]].length; o++) { 
				if (f[reqArr[t]].options[o].value!="" && f[reqArr[t]].options[o].selected) { 
					//alert(f[reqArr[t]].options[o].text);
					selchk=true;
				}
			}
			if (!selchk) err+="\t - "+reqArr[t].replace(/_/g," ")+"\n";
		} 
		
		else if (f[reqArr[t]].toString().indexOf("NodeList")!=-1){
			var rchk=false; 
			for (var r = 0; r < f[reqArr[t]].length; r++) { 
				if (f[reqArr[t]][r].checked) rchk=true;
			}
			if (!rchk) err+="\t - "+reqArr[t].replace(/_/g," ")+"\n";
		} 
	//	else alert(f[reqArr[t]]+"  - "+t);
	}
	
	
	//return true;
	if (err!=''){
		alert("All required fields must be completed. You missed:\n"+err.toTitleCase());
		return false;
	} else {
	 return true;
	 }


}



var mousec;
	function showImage(img){
		i = new Image() 
		var the_img = "/documents/images/order_form/"+img;
		var w = window.open("/detail.asp?img="+the_img,"Detail");
		if (w) w.focus();
		return;
		i.src = the_img
		var vc = document.getElementById('view_c');
		var v = document.getElementById('view');
		v.innerHTML="<B>Loading Image...</b>";
		vc.style.top=mousec[0]+"px";

		vc.style.display="block";
		finishImage(i);
	}
	
	function finishImage(i){
		if (!i.complete) setTimeout("finishImage",20,i);
		var v = document.getElementById('view');
		var vc = document.getElementById('view_c');
		v.innerHTML="<img src='"+i.src+"' width='500' />";
		//alert(mousec[0]+"px");
		vc.style.top=mousec[0]+"px";
		//alert(vc.style.top)

	}
	
	// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousedown = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

// Main function to retrieve mouse x-y pos.s

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  mousec = [tempX,tempY];
//  document.Show.MouseY.value = tempY
  return true
}
function writeDate(){
// Array of day names
var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

// Array of month Names
var monthNames = new Array(
"January","February","March","April","May","June","July","August","September","October","November","December");

var now = new Date();
document.f.date.value =dayNames[now.getDay()] + ", " + 
monthNames[now.getMonth()] + " " + 
now.getDate() + ", " + now.getFullYear();
}
