<!--
function checkEmail (address) {
	var msg = '';
	var emailPattern = /^\w+\.*\-?\w*\'?\w*\@(\w+\-?\w*\.{1}){1,3}\D{2,4}$/;
	if (address.match(emailPattern) == null)
		return false;
	else
		return true;
}
function checkEmail2(address) {
	if (!checkEmail(address)) {
		alert("Invalid E-mail Address! Please re-enter.")
		return (false)
	}
}
/* 
function checkEmail(form) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form.EmailAddress.value)){
		if (form.EmailAddress.value == form.EmailAddressVerify.value) {
			return (true);
		}
		alert("Invalid E-mail Address or E-mail Addresses don't match! Please re-enter.");
		return (false);
	}
	else {
		alert("Invalid E-mail Address or E-mail Addresses don't match! Please re-enter.");
		return (false);
	}
}
*/

var nPattern = /^\d+/;											// number pattern
var dPattern = /^\d{2}(\/)\d{2}(\/)\d{4}/;	// date pattern
var aPattern = /^[a-zA-Z]/;									// alpha pattern
function checkField (type, field) {
	var err = ''
	switch (type) {
		case 'n' : 
			if (field.value.match(nPattern) == null) err = 'The ' + field.name + ' field requires a Numeric Value.\n\n';
			break;
		case 'd' :
			if (field.value.match(dPattern) == null) err = 'The ' + field.name + ' field requires a Date Value (mm/dd/yyyy).\n\n'
			break;
		case 'a' :
			if (field.value.match(aPattern) == null) err = 'The ' + field.name + ' field requires an Alpha Value.\n\n'
			break;
	}
	return err;
}

var winWhatsThis = null;
function whatsThis (name, def) {
	var windowWidth = 400;
	var windowHeight = 400;
	var locX = (screen.width - windowWidth) / 2;
	var locY = (screen.height - windowHeight) / 2;
	var windowFeatures = 'width='+ windowWidth
										 + ',height=' + windowHeight
										 + ',screenX=' + locX
										 + ',screenY=' + locY
										 + ',left=' + locX
										 + ',top=' + locY
										 + ',scrollbars=1';
	var referrer = document.location.href;
	
	if ((winWhatsThis != null) && !winWhatsThis.closed) {
		winWhatsThis.close();
	};
	
	winWhatsThis = open('whatsthis.asp?name=' + name + '&def=' + def, 'winWhatsThis', windowFeatures);
	winWhatsThis.focus();
}

function checkMsg (msg, focusField) {
	if (msg == '')
		return true;
	else {
		msg = 'There Has Been An Error Processing Your Request.\nPlease Try Again!\n\n' + msg;
		alert (msg);
		focusField.focus();
		return false;
	}
}

var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }

var config = new Object();   					// create new config object
function htmlarea (textareaname) {
	
	config.width = "90%";
	config.height = "200px";
	config.bodyStyle = 'background-color: white; font-family: "Verdana"; font-size: x-small;';
	config.debug = 0;
	
	// NOTE:  You can remove any of these blocks and use the default config!
	
	config.toolbar = [
			['fontname'],
			['fontsize'],
			['fontstyle'],
			['linebreak'],
			['bold','italic','underline','separator'],
	//  ['strikethrough','subscript','superscript','separator'],
			['justifyleft','justifycenter','justifyright','separator'],
			['OrderedList','UnOrderedList','Outdent','Indent','separator'],
			['forecolor','backcolor','separator'],
			['HorizontalRule','Createlink','InsertImage','htmlmode','separator'],
	//	['about','help','popupeditor'],
	];
	
	config.fontnames = {
			"Arial":           "arial, helvetica, sans-serif",
			"Courier New":     "courier new, courier, mono",
			"Georgia":         "Georgia, Times New Roman, Times, Serif",
			"Tahoma":          "Tahoma, Arial, Helvetica, sans-serif",
			"Times New Roman": "times new roman, times, serif",
			"Verdana":         "Verdana, Arial, Helvetica, sans-serif",
			"impact":          "impact",
			"WingDings":       "WingDings"
	};
	config.fontsizes = {
			"1 (8 pt)":  "1",
			"2 (10 pt)": "2",
			"3 (12 pt)": "3",
			"4 (14 pt)": "4",
			"5 (18 pt)": "5",
			"6 (24 pt)": "6",
			"7 (36 pt)": "7"
		};
	
	//config.stylesheet = "http://www.domain.com/sample.css";
		
	config.fontstyles = [   // make sure classNames are defined in the page the content is being display as well in or they won't work!
		{ name: "headline",     className: "headline",  classStyle: "font-family: arial black, arial; font-size: 28px; letter-spacing: -2px;" },
		{ name: "arial red",    className: "headline2", classStyle: "font-family: arial black, arial; font-size: 12px; letter-spacing: -2px; color:red" },
		{ name: "verdana blue", className: "headline4", classStyle: "font-family: verdana; font-size: 18px; letter-spacing: -2px; color:blue" }
	
	// leave classStyle blank if it's defined in config.stylesheet (above), like this:
	//  { name: "verdana blue", className: "headline4", classStyle: "" }  
	];

	editor_generate(textareaname);
}

function printScreen() {
	var agt = navigator.userAgent.toLowerCase();
	if (window.print) {
		window.print();
	}
	else if (agt.indexOf("mac") != -1) {
		alert("Press 'Cmd+p' on your keyboard to print.");
	}
	else {
		alert("Press 'Ctrl+p' on your keyboard to print.")
	}
}

function showClock(type) {
	var dt = new Date();
	var da = dt.getDate();
	var mo = dt.getMonth()+1;
	var yr = dt.getYear();
	var hr = dt.getHours();
	var mi = dt.getMinutes();
	var se = dt.getSeconds();
	var dn = "PM";
	var datetime;
	var months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

	if (hr<12)
		dn="AM";

	if (hr>12)
		hr=hr-12;
	if (hr==0)
		hr=12;

	if (mi<=9)
		mi="0"+mi;

	if (se<=9)
		se="0"+se;

	switch (type) {
		case "datetimefull"	: datetime = months[mo-1] + " " + da + ", " + yr + "<br>" +hr + ":" + mi + ":" + se + " " + dn; break;
		case "datetime"			: datetime = mo + "/" + da + "/" + yr + "<br>" +hr + ":" + mi + ":" + se + " " + dn; break;
		case "datefull"			: datetime = months[mo-1] + " " + da + ", " + yr; break;
		case "date"					: datetime = mo + "/" + da + "/" + yr; break;
		case "time"					: datetime = hr + ":" + mi + ":" + se + " " + dn; break;
	}
	document.write ('<span class="datetime">' + datetime + '</span>');
	//datetime = mo + "/" + da + "/" + yr + "<br>" +hr + ":" + mi + ":" + se + " " + dn;
	//self.status=datetime;
	//date.innerHTML=datetime;
	//setTimeout("showClock()", 1000);
}

var popUpSurvey = null;
function goPopUpSurvey () {
	//if (confirm ('You Have Been Selected To Participate In A Survey!\n\nWould You Please Participate?')) {
	//	document.location = "survey.asp?name=" + ct
	//}

	var windowWidth = 300;
	var windowHeight = 200;
	var locX = (screen.width - windowWidth) / 2;
	var locY = (screen.height - windowHeight) / 2;
	var windowFeatures = 'width='+ windowWidth
										 + ',height=' + windowHeight
										 + ',screenX=' + locX
										 + ',screenY=' + locY
										 + ',left=' + locX
										 + ',top=' + locY
										 + ',scrollbars=1';
	var referrer = document.location.href;
	
	if ((popUpSurvey != null) && !popUpSurvey.closed) {
		popUpSurvey.close();
	};
	popUpSurvey = open('popup.asp?name=survey', 'popUpSurvey', windowFeatures);
	popUpSurvey.focus();
}
function goSurvey(formname) {
	popUpSurvey.close();
	document.location.href = 'surveyform.asp?name=' + escape(formname)
}
function noSurvey() {
	popUpSurvey.close();
}
var popUpVCheckForm = null;
function goVCheckForm(formtype, queryString, agencyID) {
	var vcheckURL;
	var windowWidth = 850;
	var windowHeight = 500;

	vcheckURL = 'https://www.securevcheck.com/insurance?'
	//if (agencyID == 307) {
	//	windowWidth = 850;
	//} else {
	//	vcheckURL = 'https://www.securedgateway.net/' + formtype + '/vcheckform.php?'
	//}

	var locX = (screen.width - windowWidth) / 2;
	var locY = (screen.height - windowHeight) / 2;
	var windowFeatures = 'width='+ windowWidth
										 + ',height=' + windowHeight
										 + ',screenX=' + locX
										 + ',screenY=' + locY
										 + ',left=' + locX
										 + ',top=' + locY
										 + ',menubar=0'
										 + ',toolbar=0'
										 + ',location=0'
										 + ',resizable=0'
										 + ',scrollbars=1'
										 + ',status=0';

	if ((popUpVCheckForm != null) && !popUpVCheckForm.closed) {
		popUpVCheckForm.close();
	};
	popUpVCheckForm = open(vcheckURL + queryString, 'popUpVCheckForm', windowFeatures)
	popUpVCheckForm.focus();
}
var popUpVCheckAdmin = null;
function goVCheckAdmin(queryString) {
	var vcheckURL;
	var windowWidth = 850;
	var windowHeight = 400;

	vcheckURL = "https://www.securevcheck.com/admin/index.php?"
	//if (agencyID == 307) {
	//	windowWidth = 850;
	//} else {
	//	vcheckURL = "https://www.securedgateway.net/vcheckpdf/retrieve.php?"
	//}

	var locX = (screen.width - windowWidth) / 2;
	var locY = (screen.height - windowHeight) / 2;
	var windowFeatures = 'width='+ windowWidth
										 + ',height=' + windowHeight
										 + ',screenX=' + locX
										 + ',screenY=' + locY
										 + ',left=' + locX
										 + ',top=' + locY
										 + ',menubar=0'
										 + ',toolbar=0'
										 + ',location=0'
										 + ',resizeable=0'
										 + ',scrollbars=1'
										 + ',status=0';

	if ((popUpVCheckAdmin != null) && !popUpVCheckAdmin.closed) {
		popUpVCheckAdmin.close();
	};
	popUpVCheckAdmin = open(vcheckURL + queryString, 'popUpVCheckAdmin', windowFeatures)
	popUpVCheckAdmin.focus();
}
var winForm = null;
function goShowForm(id) {
	if ((winForm != null) && !winForm.closed) {
		winForm.close();
	};
	
	winForm= open('clientviewrequest.asp?id=' + id + '&l=0', 'form', 'scrollbars=yes');
	winForm.focus();
}
//-->