
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

try {
var pageTracker = _gat._getTracker("UA-568194-29");
pageTracker._trackPageview();
} catch(err) {}

function OASCommonCommentHeader() {
// ******************************************************************
// 09/30/2009 - KWEBER                                             **
// Amstrust Online Issue #69 - Allow Quoting Effective Year 2009   **
// ******************************************************************

}
function isBlank(s){

	//this was added because sometimes control names are numbers and this would 
	//not work properly before...
	var str = String(s);

	if ((str == null) || (str == '')) return true;
	for (var i = 0; i < str.length; i++){
		var c = str.charAt(i);
		if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
	}
	
	s = ''
	return true;
}
//////////////////////////////////////////////////////////////////////////////////////
// -- kb 8/16/2005 --																//
// -- returns false if radio button in a group is not selected --					//
// -- returns true if it is selected --												//
function isRadioSelected(radio)
{
	var isOneChecked = false;
	
	// use a loop to check each radio button in the group							//
    for (var i=0; i < radio.length; i++)
    	{
         if(radio[i].checked)
		 	{
            isOneChecked = true;
            break;
         	}
   		}

	// set the value to return, based on whether or not a button is selected		//
    if (!isOneChecked) 
		{
        return(false);
    	}
	else
		{
		return(true);
		}
}

//////////////////////////////////////////////////////////////////////////////////////
// -- kb 8/18/2005 --																//
// -- returns the value of of the radio button selected --							//
// -- if nothing selected, returns -1 --											//
function getSelectedRadio(radio)
{
	var WhichOne = -1

	if (isRadioSelected(radio))
	{				
		// find the selected radio button value										//		
		for (var i=0; i < radio.length; i++)
		{
			if(radio[i].checked)
		 	{
				// set the value of WhichOne to the selected radio button's value	//
				WhichOne = radio[i].value
				break;
			}
		}			
	}
	
	return WhichOne
}

//////////////////////////////////////////////////////////////////////////////////////
// -- kb 8/16/2005 -- 																//
// -- returns true if the string is numeric --										//
// -- returns false if the string is not numeric --									//
function isNumeric(s)
{ 
	var numcheck = /[0-9]/
	
	var thischaracter

	// use a loop to check each character in the string								//
	for (i = 0; i < s.length; i++)
	{ 
		thischaracter = s.charAt(i); 
		
		// make sure the character is a number										//
		if (numcheck.test(thischaracter))
		{ 
			return true;
		} 
		else 
		{
			return false; 
		}
	} 
	
	return false; 
} 

//////////////////////////////////////////////////////////////////////////////////////
// -- kb 8/17/2005 --																//
// -- returns false if mod is in wrong format -- 									//
// -- returns true if mod is in correct format --									//
// s is a string value to see if it is a decimal, t is the number of places to the	//
// right of the decimal...															//
// t=2 -- checks for 2 places; t=3 -- checks for 3 places;							//
// t=0 -- checks for 2 or 3 places 													//
//////////////////////////////////////////////////////////////////////////////////////
function isModDecimal(s, t)
{

	// check that the value sent in for Mod matches one of the following formats: 	//
	// 1.) either a decimal with 2 digits to the right								//
	var checkdec2places = /\d?\.\d{2}/;
	// or 2.) a decimal with 3 digits to the right									//
	var checkdec3places = /\d?\.\d{3}/;
		
	if (t=2)
	{
		// test for 2 decimal places to the right									//
		if (checkdec2places.test(s))
		{
			return true;
		}	
		else
		{
			return false;
		}
			
	}
	else if (t=3)
	{
		// test for 3 decimal places to the right									//
		if (checkdec3places.test(s))
		{
			return true;
		}	
		else
		{
			return false;
		}
			
	}
	else if (t=0)
	{
		// test for 2 decimal places to the right									//
		if (checkdec2places.test(s))
		{
			return true;
		}
		// or 3 places to the right													//	
		else if (checkdec3places.test(s))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
}
//////////////////////////////////////////////////////////////////////////////////////

function notDate(dt){
// ******************************************************************
// 09/30/2009 - KWEBER                                             **
// Amstrust Online Issue #69 - Allow Quoting Effective Year 2009   **
// ******************************************************************
	var vdt = /^\d{1,2}\/\d{1,2}\/\d{2,4}/;
	
	if (!vdt.test(dt)) return true;
	if ((dt.length < 6) || (dt.length > 10)) return true;
	dt = dt.split("/");
	
	if ((dt[0] < 1) || (dt[0] > 12)) return true;
	if ((dt[1] < 1) || (dt[1] > 31)) return true;
	if ((dt[0] == 2) && (dt[1] > 28)) return true;
	if (((dt[0] == 4) || (dt[0] == 6) || (dt[0] == 9) || (dt[0] == 11)) && (dt[1] > 30)) return true;
	if ((dt[2].length == 2) && (dt[2] > 50)) dt[2] = 19 + dt[2];
	if ((dt[2].length == 2) && (dt[2] < 50)) dt[2] = 20 + dt[2];

	// mg and jks - 7/13/09 changed from hardcoded > '09
	var today = new Date();
	if(dt[2] < 1950 || dt[2] > (today.getFullYear() + 1)) return true;
		
	return false;
}
//////////////////////////////////////////////////////////////////////////////////////
// -- kb 8/24/2005 --																//
// -- returns true if dob in wrong format -- 										//
// -- returns false if dob is in correct format --									//
// -- fundtion notDate was modified to work for DOB									//
//////////////////////////////////////////////////////////////////////////////////////
function notDOB(dt){

	var vdt = /^\d{1,2}\/\d{1,2}\/\d{2,4}/;
	
	if (!vdt.test(dt)) return true;
	if ((dt.length < 6) || (dt.length > 10)) return true;
	dt = dt.split("/");
	
	if ((dt[0] < 1) || (dt[0] > 12)) return true;
	if ((dt[1] < 1) || (dt[1] > 31)) return true;
	if ((dt[0] == 2) && (dt[1] > 28)) return true;
	if (((dt[0] == 4) || (dt[0] == 6) || (dt[0] == 9) || (dt[0] == 11)) && (dt[1] > 30)) return true;
	if ((dt[2].length == 2) && (dt[2] > 50)) dt[2] = 19 + dt[2];
	if ((dt[2].length == 2) && (dt[2] < 50)) dt[2] = 20 + dt[2];
	
	return false;
}
//////////////////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////////////////
// -- kb 9/02/2005 --																//
// -- returns true if input is a year --	 										//
// -- returns false if input is not a year --										//
//////////////////////////////////////////////////////////////////////////////////////
function isYear(dt, form, name){

	var year2 = /^\d{2}/;
	var year4 = /^\d{4}/;
	var temp = dt
	
	// if date is not 2 or 4 digits it returns false
	if (!year2.test(dt) && !year4.test(dt)) return false;
	
	// if date is 2 digits, it converts it to 4
	if ((dt.length == 2) && (dt > 50)) temp = 19 + dt;
	if ((dt.length == 2) && (dt < 50)) temp = 20 + dt;
	
	// if date is 4 digits assign its value to temp
	if (dt.length == 4) temp = dt;
	
	// this is what assigns the value of the new date back to the form
	document.forms[form].elements[name].value = temp

	return true;
}
//////////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////////
// -- kb 9/02/2005 --																//
// -- returns true if input is a valid phone --										//
// -- returns false if input is not a valid phone --								//
//////////////////////////////////////////////////////////////////////////////////////
function isValidPhone(i)
{		
	// if the phone number is not numeric, warn the user
	if(isNumeric(i) == false) 
		{
		return false;
		}
	// if the phone number is not 10 digits alert the user
	else
	{
		if(i.length != 10)
			{
			return false;
			}
		else
			{
			// this is a valid phone number
			return true;
			}
	}
}
//////////////////////////////////////////////////////////////////////////////////////

function notFein(fn){

	var vf = /^(\d{9})/;
	var vfn = /^(\d{2})-(\d{7})/;
	var vfnss = /^(\d{3})-(\d{2})-(\d{4})/;
	
	if ((!vfn.test(fn)) && (!vfnss.test(fn)) && (!vf.test(fn))) return true;
	if ((vfn.test(fn)) && (fn.length == 10) && (!vfnss.test(fn)) && (!vf.test(fn))) return false;
	if ((!vfn.test(fn)) && (vfnss.test(fn)) && (fn.length == 11) && (!vf.test(fn))) return false;
	if ((!vfn.test(fn)) && (!vfnss.test(fn)) && (vf.test(fn)) && (fn.length == 9)) return false;
	return true;
}	

function NotActive () {

	alert('This feature has been disabled temporarily for re-engineering');
	
}

function stripLineBreaks(ta){
	ta.value = escape(ta.value);
	
	if (ta.value.indexOf("%OD%OA") > -1){
		ta.value = ta.value.replace("%OD%OA","%20");
	} else if (ta.value.indexOf("%OA") > -1){
		ta.value = ta.value.replace("%OA","%20");
	} else if (ta.value.indexOf("%OD") > -1){
		ta.value = ta.value.replace("%OD","%20");
	}
	
	ta.value = unescape(ta.value);
}


function PopOpen(target,width,height) {
		testWindow = window.open(target,"OAS_Help","toolbar=no,scrollbars=yes,width=" + width + ",height=" + height)
}

function PopOpenWithBars(target,width,height) {
		testWindow = window.open(target,"OAS_Help","toolbar=yes,scrollbars=yes,width=" + width + ",height=" + height)
}

function OpenWindow(target) {
		testWindow = window.open(target,"OAS_Help","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes")
}

function OpenAcordApp(target,width,height) {

		testWindow = window.open(target,"ACORD_130","toolbar=yes,scrollbars=yes,width=" + width + ",height=" + height + ",resizable=yes")
}

	
	

		