function ChangeCustomer(callerid){
	window.open("http://www.palmsinc.com/palms/changeCaller.php?callerid="+callerid+"", "_blank", 'width=400,height=300,scrollbars=no');
}

function removeText(id){
	document.getElementById(id).value = "";
}

function callBack(callerid){
	window.open("http://www.palmsinc.com/palms/callBack.php?callerid="+callerid+"", "_blank", 'width=400,height=450,scrollbars=no'); 
}

function removeCaller(callerid){
	window.open("http://www.palmsinc.com/palms/removeCaller.php?callerid="+callerid+"", "_blank", 'width=400,height=300,scrollbars=no'); 
}

function leaveNotes(callerid){
	window.open("http://www.palmsinc.com/palms/leaveNotes.php?callerid="+callerid+"", "_blank", 'width=400,height=300,scrollbars=no'); 
}

function openAvail(propertyid){
	window.open("http://www.palmsinc.com/palms/avail.php?propertyid="+propertyid+"", "avail", 'width=800,height=500,scrollbars=yes'); 
}

function changePassword(){
	window.open("http://www.palmsinc.com/palms/changePassword.php", "pass", 'width=400,height=300,scrollbars=no'); 
}

function doNavigate(start){

	document.getElementById('start').value = start;
	document.getElementById('form').submit();

}

function updateTotal(){

	var total = 0.00;
	var tax_total = 0.00;
	
	tax = document.getElementById('occupancy_rate').options[document.getElementById('occupancy_rate').selectedIndex].value;

	for(i=0; i<rates.length; i++){
		var tot = 0.00;
		if(document.getElementById(rates[i]+"_tax").checked == true){
			tax_total += (tax * 0.01) * (document.getElementById(rates[i]).value * 1.00);
			
		}

		total += document.getElementById(rates[i]).value * 1.00;
		tot = document.getElementById(rates[i]).value * 1.00;
		document.getElementById(rates[i]).value = tot.toFixed(2);		
	}

	
	
	var over_total = tax_total + total;

	document.getElementById('tot').innerHTML = "$"+over_total.toFixed(2)+"";
}

function removeSelected(){

	var fields_available = document.getElementById('fields_available[]');
	var fields_used = document.getElementById('fields_used[]');

	var a_l = fields_available.length;

	
	fields_available[a_l] = new Option(fields_used.options[fields_used.selectedIndex].text, fields_used.options[fields_used.selectedIndex].value);
	fields_used.remove(fields_used.selectedIndex);
}

function addSelected(){

	var fields_available = document.getElementById('fields_available[]');
	var fields_used = document.getElementById('fields_used[]');

	var u_l = fields_used.length;

	
	fields_used[u_l] = new Option(fields_available.options[fields_available.selectedIndex].text, fields_available.options[fields_available.selectedIndex].value);
	fields_available.remove(fields_available.selectedIndex);

}

function selectOption(){
	var fields_used = document.getElementById('fields_used[]');
	for(i=0; i<fields_used.length; i++){
		fields_used.options[i].selected = true;
	}
}

function printInvoice(formid, invoiceid){

	//txtFile = fso.OpenTextFile("http://www.palmsinc.com/palms/view_template.php?invoiceid="+invoiceid+"", 1); // mode 1 = Read
	
	//var xmlhttp=false;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	// JScript gives us Conditional compilation, we can cope with old IE versions.
	// and security blocked creation of the objects.
	 try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   xmlhttp = false;
	  }
	 }
	@end @*/
	/*if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	  xmlhttp = new XMLHttpRequest();
	}

	string = "";

	xmlhttp.open("GET", "./view_template.php?invoiceid="+invoiceid+"",true);
 	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4) {
	   		string = xmlhttp.responseText;
			print(string);
		}
	}
	xmlhttp.send(null)*/

	//if(string == ""){
	//	alert("There was a problem getting your template to print.  To print your template, simply click on the view icon and print strait from your browser.");
	//}

	window.open("http://www.palmsinc.com/palms/print_template.php?formid="+formid+"&invoiceid="+invoiceid+"", "pass", 'width=725,height=800,scrollbars=yes'); 

}

function saveWord(formid, invoiceid){

	window.open("http://www.palmsinc.com/palms/word_template.php?formid="+formid+"&invoiceid="+invoiceid+"", "pass", 'width=725,height=800,scrollbars=yes'); 

}

function palmsHelp(helpid){
	window.open("http://www.palmsinc.com/palms/palmshelp.php?helpid="+helpid+"", "help", 'width=550,height=350,scrollbars=yes'); 	
}