function popup_window(page, width, height) {
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	winprops = 'top='+wint+',left='+winl
	window.open(page,'scrollbars=no,resizable=no,width=' + width + ',height=' + height + ',' + winprops);
}

function formatPhone(which, display_error) {
			var doFormat = false;
			
			if (document.f.country.value == 'USA') {
				doFormat = true;
			} else if (document.f.country.value == 'CA') {
				doFormat = true;
				
			} else if (document.f.country.value == '') {
				doFormat = false;
			} else {
				doFormat = false;
			}
			if (doFormat) {
				var re = /\D/;
				var re2 = /^\({1}\d{3}\)\d{3}-\d{4}/;
				form_field = (document.register?eval('document.register.' + which):eval('document.f.' + which));
				number = form_field.value;
				error_message = '';
				if (number != '' && re2.test(number) != true) {
					if (number != '') {
						while (re.test(number)) {
							number = number.replace(re, "");
						}
					}
					if (number.length != 10 ) {
						error_message = 'Please enter a 10 digit phone number.';
						if (display_error) {
							alert(error_message);
						} else {
							return false;
						}
						form_field.select();
						form_field.focus();
					} else {
						new_number = '(' + number.substring(0,3) + ') ' + number.substring(3,6) + '-' + number.substring(6,10);
						form_field.value = new_number
						if (display_error != true) {
							return true;
						}
					}
				} else {
					if (display_error != true) {
						return true;
					}
				}
			} else {
				
					return true;
				
			}
		}
		function formatPhoneSubmit() {
			if (formatPhone('phone_1', false) != true) {
				return false;
			} else if (formatPhone('phone_2', false) != true) {
				return false;
			} else {
				return true;
			}
		}
		
		function resume_preview(tab) {
			var winl = (screen.width - 600) / 2;
			var wint = (screen.height - 400) / 2;
			winprops = 'top='+wint+',left='+winl
			window.open('/extra/preview/actor_details.cfm?tab=' + tab, 'extra_details', 'scrollbars,resizable,width=600,height=400,' + winprops);
			return false;
		}
		
		function cellphoneEmail() {
		var winl = (screen.width - 600) / 2;
		var wint = (screen.height - 400) / 2;
		winprops = 'top='+wint+',left='+winl
		window.open('/media/docs/doc.cfm?title=Get Interview Notifications from your Agent or Casting via Text Messaging off your phone.&file=/media/docs/cellphone_email_text.html', 'cellphone_email', 'scrollbars,resizable,width=600,height=400,' + winprops);
	}
