// JavaScript Document
function openBrWindow(theURL,winName,features) { //v2.0
	//window.open(theURL,winName,features);
	window.open(theURL,'',features);
}

function fill(){
	if( document.usrList.todos.checked ){
	/*	document.ordform.shpfirstname.value= document.ordform.firstname.value;
		document.ordform.shplastname.value= document.ordform.lastname.value;
		document.ordform.shpaddress1.value= document.ordform.address1.value;
		document.ordform.shpaddress2.value= document.ordform.address2.value;
		document.ordform.shpcity.value= document.ordform.city.value;
		document.ordform.shpstate.value= document.ordform.state.value;
		document.ordform.shpzip.value= document.ordform.zip.value;	
		document.ordform.shpcountry.value= document.ordform.country.value; */
	}else{
	/*	document.ordform.shpfirstname.value= "";
		document.ordform.shplastname.value= "";
		document.ordform.shpaddress1.value= "";
		document.ordform.shpaddress2.value= "";
		document.ordform.shpcity.value= "";
		document.ordform.shpstate.value= "";
		document.ordform.shpzip.value= "";	
		document.ordform.shpcountry.value= ""; */
	}
}

function bill_add_fill(){
	if( document.order_warr.billing_add.checked ){
		document.order_warr.ord_bill_fname.value= document.order_warr.ord_fname.value;
		document.order_warr.ord_bill_lname.value= document.order_warr.ord_lname.value;;
		document.order_warr.ord_bill_st_num.value= document.order_warr.ord_st_num.value;
		document.order_warr.ord_bill_st_name.value= document.order_warr.ord_st_name.value;
		document.order_warr.ord_bill_add2.value= document.order_warr.ord_add2.value;
		document.order_warr.ord_bill_city.value= document.order_warr.ord_city.value;
		document.order_warr.ord_bill_state.value= document.order_warr.ord_state.value;
		document.order_warr.ord_bill_zip.value= document.order_warr.ord_zip.value;	
		document.order_warr.ord_bill_country.value= document.order_warr.ord_country.value;
	}else{
		document.order_warr.ord_bill_fname.value= "";
		document.order_warr.ord_bill_lname.value= "";
		document.order_warr.ord_bill_st_num.value= "";
		document.order_warr.ord_bill_st_name.value= "";
		document.order_warr.ord_bill_add2.value= "";
		document.order_warr.ord_bill_city.value= "";
		document.order_warr.ord_bill_state.value= "";
		document.order_warr.ord_bill_zip.value= "";	
		document.order_warr.ord_bill_country.value= ""; 
	}
}

//document.usrList.todos.onclick = un_check;
function un_check(){

  for (var i = 0; i < document.recList.elements.length; i++) {
    var e = document.recList.elements[i];
    if ((e.name != 'todos') && (e.type == 'checkbox')) {
e.checked = document.recList.todos.checked;
    }
  }
}

function get_file_name(){
counter = -1;
for (var i = 0; i < document.upload_file.elements.length; i++) {
	
    var e = document.upload_file.elements[i];
    if (e.type == 'file') {	
		counter++;
		var hid_val = counter + "[hiddenfilename]";
		var file_holder = document.upload_file.elements[hid_val];
		file_holder.value = e.value;
    }
  }
}

function submitForm() {
	//make sure hidden and iframe values are in sync before submitting form
	//to sync only 1 rte, use updateRTE(rte)
	//to sync all rtes, use updateRTEs
	updateRTE('rte1');
	//updateRTEs();
	
	//change the following line to true to submit form
	return true;
}
				
	//Usage: initRTE(imagesPath, includesPath, cssFile, genXHTML)
//	initRTE("rte/images/", "", "", true);
var count = 0;


function submit_form(submit_url){
if (!document.getElementById) return false;
var submit = document.getElementById("submit");
var form = document.getElementById("form");
submit.onclick = function(){
// Insert checks for proper form fields here
if (count == 0){
count++;
//var url = submit_url;
//form.setAttribute("action",url);
submit.setAttribute("value","Please Wait");
submit.style.backgroundColor = "red";
form.submit;
return true;
}
return false;
}
return true;
} 