function setValue(){
	var ss = document.getElementById('PolicyEffectiveDate').value="Policy Start Date";
	//alert(ss);
}
// store variables to control where the popup will appear relative to the cursor position
// positive numbers are below and to the right of the cursor, negative numbers are above and to the left
var xOffset = 20;
var yOffset = -15;

function showPopup (targetObjectId, eventObj) {
    if(eventObj) {
		// hide any currently-visible popups
		hideCurrentPopup();
		// stop event from bubbling up any farther
		eventObj.cancelBubble = true;
		// move popup div to current cursor position 
		// (add scrollTop to account for scrolling for IE)
		var newXCoordinate = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.x + xOffset + ((document.body.scrollLeft)?document.body.scrollLeft:10);
		var newYCoordinate = (eventObj.pageY)?eventObj.pageY + yOffset:eventObj.y + yOffset + ((document.body.scrollTop)?document.body.scrollTop:155);
		
		//alert( newXCoordinate );
		//alert( newYCoordinate );
		moveObject(targetObjectId, newXCoordinate, newYCoordinate);
		// and make it visible
		if( changeObjectVisibility(targetObjectId, 'visible') ) {
	    	// if we successfully showed the popup
	    	// store its Id on a globally-accessible object
	    	window.currentlyVisiblePopup = targetObjectId;
	    	return true;
		} else {
	   	 // we couldn't show the popup, boo hoo!
	   	 return false;
		}
    } else {
		// there was no event object, so we won't be able to position anything, so give up
		return false;
    }
} // showPopup

function hideCurrentPopup() {
    // note: we've stored the currently-visible popup on the global object window.currentlyVisiblePopup
    if(window.currentlyVisiblePopup) {
	changeObjectVisibility(window.currentlyVisiblePopup, 'hidden');
	window.currentlyVisiblePopup = false;
    }
} // hideCurrentPopup



// ***********************
// hacks and workarounds *
// ***********************

// initialize hacks whenever the page loads
window.onload = initializeHacks;

// setup an event handler to hide popups for generic clicks on the document
document.onclick = hideCurrentPopup;

function initializeHacks() {
    // this ugly little hack resizes a blank div to make sure you can click
    // anywhere in the window for Mac MSIE 5
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
	window.onresize = explorerMacResizeFix;
    }
    resizeBlankDiv();
    // this next function creates a placeholder object for older browsers
    createFakeEventObj();
}

function createFakeEventObj() {
    // create a fake event object for older browsers to avoid errors in function call
    // when we need to pass the event object to functions
    if (!window.event) {
	window.event = false;
    }
} // createFakeEventObj

function resizeBlankDiv() {
    // resize blank placeholder div so IE 5 on mac will get all clicks in window
    if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
	&& (navigator.platform.indexOf('Mac') != -1)
	&& getStyleObject('blankDiv')) {
	getStyleObject('blankDiv').width = document.body.clientWidth - 20;
	getStyleObject('blankDiv').height = document.body.clientHeight - 20;
    }
}

function explorerMacResizeFix () {
    location.reload(false);
}

function hideObj(obj){
	document.getElementById(obj).style.visibility ="hidden";
	//document.getElementById(obj).style.display ="none";
}
function showObj(obj){
	document.getElementById(obj).style.visibility ="visible";
}
//---------------------------------------------------new tooltip-----------------------------------------

var DH = 0;var an = 0;var al = 0;var ai = 0;if (document.getElementById) {ai = 1; DH = 1;}else {if (document.all) {al = 1; DH = 1;} else { browserVersion = parseInt(navigator.appVersion); if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {an = 1; DH = 1;}}} function fd(oi, wS) {if (ai) return wS ? document.getElementById(oi).style:document.getElementById(oi); if (al) return wS ? document.all[oi].style: document.all[oi]; if (an) return document.layers[oi];}
function pw() {return window.innerWidth != null? window.innerWidth: document.body.clientWidth != null? document.body.clientWidth:null;}
function mouseX(evt) {if (evt.pageX) return evt.pageX; else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); else return null;}
function mouseY(evt) {if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return null;}
function popUp(evt,oi) {if (DH) {var wp = pw(); ds = fd(oi,1); dm = fd(oi,0); st = ds.visibility; if (dm.offsetWidth) ew = dm.offsetWidth; else if (dm.clip.width) ew = dm.clip.width; if (st == "visible" || st == "show") { ds.visibility = "hidden"; } else {tv = mouseY(evt) + 20; lv = mouseX(evt) - (ew/4); if (lv < 2) lv = 2; else if (lv + ew > wp) lv -= ew/2; if (!an) {lv += 'px';tv += 'px';} ds.left = lv; ds.top = tv; ds.visibility = "visible";}}}
                  




// ***********************************Start javascript Menu********************************************************
var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;

function openSubMenu(id)
{	
	cancelSubMenu();
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

function cancelSubMenu()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}
document.onclick = mclose ;
// ***********************************Start javascript Menu********************************************************







//************************************ Google Analytics Script ******************************
//alert("Enter 'gaJsHost' var");
//var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
//var hostName = document.location.hostname;
//alert(gaJsHost);
//alert(hostName);
//if(hostName.toLowerCase().indexOf('rscube.com') == -1 && hostName.toLowerCase().indexOf('outlinesys.com') == -1){
//alert("enetred if");

      //document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

//      try {
//            var pageTracker = _gat._getTracker("UA-15588946-2");
            //alert("pageTracker");
//            pageTracker._setDomainName("none");
//            pageTracker._setAllowLinker(true);
//            pageTracker._trackPageview();
 //     } catch(err) {}
		//alert(err);
//}




//var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
//document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics/ga.js' type='text/javascript'%3E%3C/script%3E"));
//alert(gaJsHost);
//try {
//var pageTracker = _gat._getTracker("UA-15588946-2");
//pageTracker._setDomainName("none");
//pageTracker._setAllowLinker(true);
//pageTracker._trackPageview();
//} catch(err) {}

//**************************** Contact Us Validation Script **********************************



function MM_validateFormContact() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormContact.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.title; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } 
    
    if (errors) 
    	alert('The following error(s) occurred:\n'+errors);
    	
    //document.MM_returnValue = (errors == '');
    if(errors == ''){
       document.forms[0].submit();
    }
} 
}

//************************************* E-mail validation script ************************************************


function MM_validateFormEmail() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormEmail.arguments;
    for (i=0; i<(args.length-2); i+=3) 
    { 
    	test=args[i+2]; val=document.getElementById(args[i]);
      	if (val) { nm=val.title; if ((val=val.value)!="")
      	{
        	if (test.indexOf('isEmail')!=-1)
        	{
        		p=val.indexOf('@');
          		if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        	} 
        	else if (test!='R')
        	{ 
        		num = parseFloat(val);
          		if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';          
          		if (test.indexOf('inRange') != -1) 
          		{ 
          			p=test.indexOf(':');
            		min=test.substring(8,p); max=test.substring(p+1);
            		if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      			} 
      		} 
      	} 
      	else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; 
      }
    } 
    
    if (errors) 
    	alert('The following error(s) occurred:\n'+errors);
    	
    //document.MM_returnValue = (errors == '');
    if(errors == ''){
       document.forms[0].submit();
    }
} 
}




function loadEmail()
{
	mmddyyyyMask = new Mask("mm/dd/yyyy", "date");	
	var expirydate = document.getElementById("expirydate");
	if(expirydate != null)
	{	
		mmddyyyyMask.attach(expirydate);
	}
	
	phoneMask = new Mask("(###)###-####");
	
	var wrkphone = document.getElementById("phone");
	if(wrkphone != null)
	{	
		wrkphone.value=phoneMask.format(wrkphone.value);
		phoneMask.attach(wrkphone);						
	}
}

function loadIndex()
{
	
	phoneMask = new Mask("(###)###-####");
	
	var wrkphone = document.getElementById("phoneNo");
	if(wrkphone != null)
	{	
		phoneMask.attach(wrkphone);						
	}
	
}

function loadContactUs(){

	phoneMask = new Mask("(###)###-####");
	
	var wrkphone = document.getElementById("phone");
	if(wrkphone != null)
	{	
		wrkphone.value=phoneMask.format(wrkphone.value);
		phoneMask.attach(wrkphone);						
	}
	
	dateMask = new Mask("mm/dd/yyyy", "date");
	var date = document.getElementById("expirydate");
	if(date != null)
	{	
		date.value=phoneMask.format(date.value);
		dateMask.attach(date);						
	}

}



//******************************************* Email Validation ***********************************************************



function validateEmail(m) {
	var strValue = m.value;
	if(strValue=='')
		return;
	
	//var objRegExp  = /(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i;
	//var objRegExp = /b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4};	
	var objRegExp  = /(^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,3})+$)/;
	if(!strValue.match(objRegExp))
	{
		alert("Email is not valid");
		m.focus();
	}
	
}

//****************************************Masking******************************//

function _MaskAPI(){
	this.version = "0.4b";
	this.instances = 0;
	this.objects = {};
}
MaskAPI = new _MaskAPI();

function Mask(m, t){
	this.mask = m;
	this.type = (typeof t == "string") ? t : "string";
	this.error = [];
	this.errorCodes = [];
	this.value = "";
	this.strippedValue = "";
	this.allowPartial = false;
	this.id = MaskAPI.instances++;
	this.ref = "MaskAPI.objects['" + this.id + "']";
	MaskAPI.objects[this.id] = this;
}

// define the attach(oElement) function
Mask.prototype.attach = function (o){
	//$addEvent(o, "onkeydown", "return " + this.ref + ".isAllowKeyPress(event, this);", true);
	$addEvent(o, "onkeyup", "return " + this.ref + ".getKeyPress(event, this);", true);
	$addEvent(o, "onblur", "this.value = " + this.ref + ".format(this.value);", true);
}

Mask.prototype.isAllowKeyPress = function (e, o){
	if( this.type != "string" ) return true;
	var xe = new qEvent(e);

	if( ((xe.keyCode > 47) && (o.value.length >= this.mask.length)) && !xe.ctrlKey ) return false;
	return true;
}

Mask.prototype.getKeyPress = function (e, o, _u){
	this.allowPartial = true;
	var xe = new qEvent(e);

//	var k = String.fromCharCode(xe.keyCode);

	if( (xe.keyCode > 47) || (_u == true) || (xe.keyCode == 8 || xe.keyCode == 46) ){
		var v = o.value, d;
		if( xe.keyCode == 8 || xe.keyCode == 46 ) d = true;
		else d = false

		if( this.type == "number" ) this.value = this.setNumber(v, d);
		else if( this.type == "date" ) this.value = this.setDateKeyPress(v, d);
		else this.value = this.setGeneric(v, d);

		o.value = this.value;
	}
	/* */

	this.allowPartial = false;
	return true;
}

Mask.prototype.format = function (s){
	if( this.type == "number" ) this.value = this.setNumber(s);
	else if( this.type == "date" ) this.value = this.setDate(s);
	else this.value = this.setGeneric(s);
	return this.value;
}

Mask.prototype.throwError = function (c, e, v){
	this.error[this.error.length] = e;
	this.errorCodes[this.errorCodes.length] = c;
	if( typeof v == "string" ) return v;
	return true;
}

Mask.prototype.setGeneric = function (_v, _d){
	var v = _v, m = this.mask;
	var r = "x#*", rt = [], nv = "", t, x, a = [], j=0, rx = {"x": "A-Za-z", "#": "0-9", "*": "A-Za-z0-9" };

	// strip out invalid characters
	v = v.replace(new RegExp("[^" + rx["*"] + "]", "gi"), "");
	if( (_d == true) && (v.length == this.strippedValue.length) ) v = v.substring(0, v.length-1);
	this.strippedValue = v;
	var b=[];
	for( var i=0; i < m.length; i++ ){
		// grab the current character
		x = m.charAt(i);
		// check to see if current character is a mask, escape commands are not a mask character
		t = (r.indexOf(x) > -1);
		// if the current character is an escape command, then grab the next character
		if( x == "!" ) x = m.charAt(i++);
		// build a regex to test against
		if( (t && !this.allowPartial) || (t && this.allowPartial && (rt.length < v.length)) ) rt[rt.length] = "[" + rx[x] + "]";
		// build mask definition table
		a[a.length] = { "chr": x, "mask": t };
	}

	var hasOneValidChar = false;
	// if the regex fails, return an error
	if( !this.allowPartial && !(new RegExp(rt.join(""))).test(v) ) return this.throwError(1, "The value \"" + _v + "\" must be in the format " + this.mask + ".", _v);
	// loop through the mask definition, and build the formatted string
	else if( (this.allowPartial && (v.length > 0)) || !this.allowPartial ){
		for( i=0; i < a.length; i++ ){
			if( a[i].mask ){
				while( v.length > 0 && !(new RegExp(rt[j])).test(v.charAt(j)) ) v = (v.length == 1) ? "" : v.substring(1);
				if( v.length > 0 ){
					nv += v.charAt(j);
					hasOneValidChar = true;
				}
				j++;
			} else nv += a[i].chr;
			if( this.allowPartial && (j > v.length) ) break;
		}
	}
	
	if( this.allowPartial && !hasOneValidChar ) nv = "";
	if( this.allowPartial ){
		if( nv.length < a.length ) this.nextValidChar = rx[a[nv.length].chr];
		else this.nextValidChar = null;
	}

	return nv;
}

Mask.prototype.setNumber = function(_v, _d){
	var v = String(_v).replace(/[^\d.-]*/gi, ""), m = this.mask;
	// make sure there's only one decimal point
	v = v.replace(/\./, "d").replace(/\./g, "").replace(/d/, ".");

	// check to see if an invalid mask operation has been entered
	if( !/^[\$]?((\$?[\+]?([0#]{1,3},)?[0#]*(\.[0#]*)?)|([\+]?\([\+]?([0#]{1,3},)?[0#]*(\.[0#]*)?\)))$/.test(m) )
		return this.throwError(1, "An invalid mask was specified for the \nMask constructor.", _v);

	if( (_d == true) && (v.length == this.strippedValue.length) ) v = v.substring(0, v.length-1);

	if( this.allowPartial && (v.replace(/[^0-9]/, "").length == 0) ) return v;
	this.strippedValue = v;

	if( v.length == 0 ) v = NaN;
	var vn = Number(v);
	if( isNaN(vn) ) return this.throwError(2, "The value entered was not a number.", _v);

	// if no mask, stop processing
	if( m.length == 0 ) return v;

	// get the value before the decimal point
	var vi = String(Math.abs((v.indexOf(".") > -1 ) ? v.split(".")[0] : v));
	// get the value after the decimal point
	var vd = (v.indexOf(".") > -1) ? v.split(".")[1] : "";
	var _vd = vd;

	var isNegative = (vn != 0 && Math.abs(vn)*-1 == vn);

	// check for masking operations
	var show = {
		"$" : /^[\$]/.test(m),
		"(": (isNegative && (m.indexOf("(") > -1)),
		"+" : ( (m.indexOf("+") != -1) && !isNegative )
	}
	show["-"] = (isNegative && (!show["("] || (m.indexOf("-") != -1)));


	// replace all non-place holders from the mask
	m = m.replace(/[^#0.,]*/gi, "");

	/*
		make sure there are the correct number of decimal places
	*/
	// get number of digits after decimal point in mask
	var dm = (m.indexOf(".") > -1 ) ? m.split(".")[1] : "";
	if( dm.length == 0 ){
		vi = String(Math.round(Number(vi)));
		vd = "";
	} else {
		// find the last zero, which indicates the minimum number
		// of decimal places to show
		var md = dm.lastIndexOf("0")+1;
		// if the number of decimal places is greater than the mask, then round off
		if( vd.length > dm.length ) vd = String(Math.round(Number(vd.substring(0, dm.length + 1))/10));
		// otherwise, pad the string w/the required zeros
		else while( vd.length < md ) vd += "0";
	}

	/*
		pad the int with any necessary zeros
	*/
	// get number of digits before decimal point in mask
	var im = (m.indexOf(".") > -1 ) ? m.split(".")[0] : m;
	im = im.replace(/[^0#]+/gi, "");
	// find the first zero, which indicates the minimum length
	// that the value must be padded w/zeros
	var mv = im.indexOf("0")+1;
	// if there is a zero found, make sure it's padded
	if( mv > 0 ){
		mv = im.length - mv + 1;
		while( vi.length < mv ) vi = "0" + vi;
	}


	/*
		check to see if we need commas in the thousands place holder
	*/
	if( /[#0]+,[#0]{3}/.test(m) ){
		// add the commas as the place holder
		var x = [], i=0, n=Number(vi);
		while( n > 999 ){
			x[i] = "00" + String(n%1000);
			x[i] = x[i].substring(x[i].length - 3);
			n = Math.floor(n/1000);
			i++;
		}
		x[i] = String(n%1000);
		vi = x.reverse().join(",");
	}


	/*
		combine the new value together
	*/
	if( (vd.length > 0 && !this.allowPartial) || ((dm.length > 0) && this.allowPartial && (v.indexOf(".") > -1) && (_vd.length >= vd.length)) ){
		v = vi + "." + vd;
	} else if( (dm.length > 0) && this.allowPartial && (v.indexOf(".") > -1) && (_vd.length < vd.length) ){
		v = vi + "." + _vd;
	} else {
		v = vi;
	}

	if( show["$"] ) v = this.mask.replace(/(^[\$])(.+)/gi, "$") + v;
	if( show["+"] ) v = "+" + v;
	if( show["-"] ) v = "-" + v;
	if( show["("] ) v = "(" + v + ")";
	return v;
}

Mask.prototype.setDate = function (_v){
	var v = _v, m = this.mask;
	var a, e, mm, dd, yy, x, s;

	// split mask into array, to see position of each day, month & year
	a = m.split(/[^mdy]+/);
	// split mask into array, to get delimiters
	s = m.split(/[mdy]+/);
	// convert the string into an array in which digits are together
	e = v.split(/[^0-9]/);
	
	if( s[0].length == 0 ) s.splice(0, 1);

	for( var i=0; i < a.length; i++ ){
		x = a[i].charAt(0).toLowerCase();
		if( x == "m" ) mm = parseInt(e[i], 10)-1;
		else if( x == "d" ) dd = parseInt(e[i], 10);
		else if( x == "y" ) yy = parseInt(e[i], 10);
	}

	// if year is abbreviated, guess at the year
	if( String(yy).length < 3 ){
		yy = 2000 + yy;
		if( (new Date()).getFullYear()+5 < yy ) yy = yy - 100;
	}

	// create date object
	var d = new Date(yy, mm, dd);

	if( d.getDate() != dd ) return this.throwError(1, "An invalid day was entered.", _v);
	else if( d.getMonth() != mm ) return this.throwError(2, "An invalid month was entered.", _v);

	var nv = "";

	for( i=0; i < a.length; i++ ){
		x = a[i].charAt(0).toLowerCase();
		if( x == "m" ){
			mm++;
			if( a[i].length == 2 ){
				mm = "0" + mm;
				mm = mm.substring(mm.length-2);
			}
			nv += mm;
		} else if( x == "d" ){
			if( a[i].length == 2 ){
				dd = "0" + dd;
				dd = dd.substring(dd.length-2);
			}
			nv += dd;
		} else if( x == "y" ){
			if( a[i].length == 2 ) nv += d.getYear();
			else nv += d.getFullYear();
		}

		if( i < a.length-1 ) nv += s[i];
	}

	return nv;
}

Mask.prototype.setDateKeyPress = function (_v, _d){
	var v = _v, m = this.mask, k = v.charAt(v.length-1);
	var a, e, c, ml, vl, mm = "", dd = "", yy = "", x, p, z;

	if( _d == true ){
		while( (/[^0-9]/gi).test(v.charAt(v.length-1)) ) v = v.substring(0, v.length-1);
		if( (/[^0-9]/gi).test(this.strippedValue.charAt(this.strippedValue.length-1)) ) v = v.substring(0, v.length-1);
		if( v.length == 0 ) return "";
	}

	// split mask into array, to see position of each day, month & year
	a = m.split(/[^mdy]/);
	// split mask into array, to get delimiters
	s = m.split(/[mdy]+/);
	// mozilla wants to add an empty array element which needs removed
	if( s[0].length == 0 ) s.splice(0,1);
	// convert the string into an array in which digits are together
	e = v.split(/[^0-9]/);
	// position in mask
	p = (e.length > 0) ? e.length-1 : 0;
	// determine what mask value the user is currently entering
	c = a[p].charAt(0);
	// determine the length of the current mask value
	ml = a[p].length;

	for( var i=0; i < e.length; i++ ){
		x = a[i].charAt(0).toLowerCase();
		if( x == "m" ) mm = parseInt(e[i], 10)-1;
		else if( x == "d" ) dd = parseInt(e[i], 10);
		else if( x == "y" ) yy = parseInt(e[i], 10);
	}
	
	
	var nv = "";
	var j=0;

	for( i=0; i < e.length; i++ ){
		x = a[i].charAt(0).toLowerCase();
	
		if( x == "m" ){
			z = ((/[^0-9]/).test(k) && c == "m");
			mm++;
			if( (e[i].length == 2 && mm < 10) || (a[i].length == 2 && c != "m") || (mm > 1 && c == "m") || (z && a[i].length == 2) ){
				mm = "0" + mm;
				mm = mm.substring(mm.length-2);
			}
			vl = String(mm).length;
			ml = 2;
			nv += mm;
		} else if( x == "d" ){
			z = ((/[^0-9]/).test(k) && c == "d");
			if( (e[i].length == 2 && dd < 10) || (a[i].length == 2 && c != "d") || (dd > 3 && c == "d") || (z && a[i].length == 2) ){
				dd = "0" + dd;
				dd = dd.substring(dd.length-2);
			}
			vl = String(dd).length;
			ml = 2;
			nv += dd;
		} else if( x == "y" ){
			z = ((/[^0-9]/).test(k) && c == "y");
			if( c == "y" ) yy = String(yy);
			else {
				if( a[i].length == 2 ) yy = d.getYear();
				else yy = d.getFullYear();
			}
			if( (e[i].length == 2 && yy < 10) || (a[i].length == 2 && c != "y") || (z && a[i].length == 2) ){
				yy = "0" + yy;
				yy = yy.substring(yy.length-2);
			}
			ml = a[i].length;
			vl = String(yy).length;
			nv += yy;
		}

		if( ((ml == vl || z) && (x == c) && (i < s.length)) || (i < s.length && x != c ) ) nv += s[i];
	}

	if( nv.length > m.length ) nv = nv.substring(0, m.length);

	this.strippedValue = (nv == "NaN") ? "" : nv;

	return this.strippedValue;
}

function qEvent(e){
	// routine for NS, Opera, etc DOM browsers
	if( window.Event ){
		var isKeyPress = (e.type.substring(0,3) == "key");

		this.keyCode = (isKeyPress) ? parseInt(e.which, 10) : 0;
		this.button = (!isKeyPress) ? parseInt(e.which, 10) : 0;
		this.srcElement = e.target;
		this.type = e.type;
		this.x = e.pageX;
		this.y = e.pageY;
		this.screenX = e.screenX;
		this.screenY = e.screenY;
		if( document.layers ){
			this.altKey = ((e.modifiers & Event.ALT_MASK) > 0);
			this.ctrlKey = ((e.modifiers & Event.CONTROL_MASK) > 0);
			this.shiftKey = ((e.modifiers & Event.SHIFT_MASK) > 0);
			this.keyCode = this.translateKeyCode(this.keyCode);
		} else {
			this.altKey = e.altKey;
			this.ctrlKey = e.ctrlKey;
			this.shiftKey = e.shiftKey;
		}
	// routine for Internet Explorer DOM browsers
	} else {
		e = window.event;
		this.keyCode = parseInt(e.keyCode, 10);
		this.button = e.button;
		this.srcElement = e.srcElement;
		this.type = e.type;
		if( document.all ){
			this.x = e.clientX + document.body.scrollLeft;
			this.y = e.clientY + document.body.scrollTop;
		} else {
			this.x = e.clientX;
			this.y = e.clientY;
		}
		this.screenX = e.screenX;
		this.screenY = e.screenY;
		this.altKey = e.altKey;
		this.ctrlKey = e.ctrlKey;
		this.shiftKey = e.shiftKey;
	}
	if( this.button == 0 ){
		this.setKeyPressed(this.keyCode);
		this.keyChar = String.fromCharCode(this.keyCode);
	}
}

// this method will try to remap the keycodes so the keycode value
// returned will be consistent. this doesn't work for all cases,
// since some browsers don't always return a unique value for a
// key press.
qEvent.prototype.translateKeyCode = function (i){
	var l = {};
	// remap NS4 keycodes to IE/W3C keycodes
	if( !!document.layers ){
		if( this.keyCode > 96 && this.keyCode < 123 ) return this.keyCode - 32;
		l = {
			96:192,126:192,33:49,64:50,35:51,36:52,37:53,94:54,38:55,42:56,40:57,41:48,92:220,124:220,125:221,
			93:221,91:219,123:219,39:222,34:222,47:191,63:191,46:190,62:190,44:188,60:188,45:189,95:189,43:187,
			61:187,59:186,58:186,
			"null": null
		}
	}
	return (!!l[i]) ? l[i] : i;
}

// try to determine the actual value of the key pressed
qEvent.prototype.setKP = function (i, s){
	this.keyPressedCode = i;
	this.keyNonChar = (typeof s == "string");
	this.keyPressed = (this.keyNonChar) ? s : String.fromCharCode(i);
	this.isNumeric = (parseInt(this.keyPressed, 10) == this.keyPressed);
	this.isAlpha = ((this.keyCode > 64 && this.keyCode < 91) && !this.altKey && !this.ctrlKey);
	return true;
}

// try to determine the actual value of the key pressed
qEvent.prototype.setKeyPressed = function (i){
	var b = this.shiftKey;
	if( !b && (i > 64 && i < 91) ) return this.setKP(i + 32);
	if( i > 95 && i < 106 ) return this.setKP(i - 48);
	
	switch( i ){
		case 49: case 51: case 52: case 53: if( b ) i = i - 16; break;
		case 50: if( b ) i = 64; break;
		case 54: if( b ) i = 94; break;
		case 55: if( b ) i = 38; break;
		case 56: if( b ) i = 42; break;
		case 57: if( b ) i = 40; break;
		case 48: if( b ) i = 41; break;
		case 192: if( b ) i = 126; else i = 96; break;
		case 189: if( b ) i = 95; else i = 45; break;
		case 187: if( b ) i = 43; else i = 61; break;
		case 220: if( b ) i = 124; else i = 92; break;
		case 221: if( b ) i = 125; else i = 93; break;
		case 219: if( b ) i = 123; else i = 91; break;
		case 222: if( b ) i = 34; else i = 39; break;
		case 186: if( b ) i = 58; else i = 59; break;
		case 191: if( b ) i = 63; else i = 47; break;
		case 190: if( b ) i = 62; else i = 46; break;
		case 188: if( b ) i = 60; else i = 44; break;

		case 106: case 57379: i = 42; break;
		case 107: case 57380: i = 43; break;
		case 109: case 57381: i = 45; break;
		case 110: i = 46; break;
		case 111: case 57378: i = 47; break;

		case 8: return this.setKP(i, "[backspace]");
		case 9: return this.setKP(i, "[tab]");
		case 13: return this.setKP(i, "[enter]");
		case 16: case 57389: return this.setKP(i, "[shift]");
		case 17: case 57390: return this.setKP(i, "[ctrl]");
		case 18: case 57388: return this.setKP(i, "[alt]");
		case 19: case 57402: return this.setKP(i, "[break]");
		case 20: return this.setKP(i, "[capslock]");
		case 32: return this.setKP(i, "[space]");
		case 91: return this.setKP(i, "[windows]");
		case 93: return this.setKP(i, "[properties]");

		case 33: case 57371: return this.setKP(i*-1, "[pgup]");
		case 34: case 57372: return this.setKP(i*-1, "[pgdown]");
		case 35: case 57370: return this.setKP(i*-1, "[end]");
		case 36: case 57369: return this.setKP(i*-1, "[home]");
		case 37: case 57375: return this.setKP(i*-1, "[left]");
		case 38: case 57373: return this.setKP(i*-1, "[up]");
		case 39: case 57376: return this.setKP(i*-1, "[right]");
		case 40: case 57374: return this.setKP(i*-1, "[down]");
		case 45: case 57382: return this.setKP(i*-1, "[insert]");
		case 46: case 57383: return this.setKP(i*-1, "[delete]");
		case 144: case 57400: return this.setKP(i*-1, "[numlock]");
	}
	
	if( i > 111 && i < 124 ) return this.setKP(i*-1, "[f" + (i-111) + "]");

	return this.setKP(i);
}

// define the addEvent(oElement, sEvent, sCmd, bAppend) function
function $addEvent(o, _e, c, _b){
	var e = _e.toLowerCase(), b = (typeof _b == "boolean") ? _b : true, x = (o[e]) ? o[e].toString() : "";
	// strip out the body of the function
	x = x.substring(x.indexOf("{")+1, x.lastIndexOf("}"));
	x = ((b) ? (x + c) : (c + x)) + "\n";
	return o[e] = (!!window.Event) ? new Function("event", x) : new Function(x);
}

// ###############    SHOW POPUP    #################################

function sPopUp(el, wdth, hght) {
	window.scrollTo(0,0);
	//document.location.href = '#logo'; 
   document.documentElement.style.overflow=document.body.style.overflow='hidden';
	var w = (screen.width-wdth)/2 +'px';
    var t = (screen.height-hght)/2 +'px';
    var cvr = document.getElementById("cover");
    var dlg = document.getElementById(el);
    var ss = document.getElementById("StateCode");
    cvr.style.display = "block";
    dlg.style.display = "block";
    dlg.style.left =w;
    dlg.style.top =t;
	
    document.getElementById("cover").style.height =document.body.scrollHeight;
	document.getElementById("cover").focus();
}


function cPopUp(el) {
          document.documentElement.style.overflow=document.body.style.overflow='auto';
var cvr = document.getElementById("cover")
var dlg = document.getElementById(el)
cvr.style.display = "none"
dlg.style.display = "none"
document.body.style.overflowY = "scroll"
}



/* ######################  images rotate ##################################### */

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


  /*  #############################    Change Images    #################################*/
function RotateImages(Start) 
  {
      var a = new Array("img/quoteImg_1.jpg","img/quoteImg_2.jpg","img/quoteImg_3.jpg","img/quoteImg_4.jpg");
      //var c = new Array("bgImg1","bgImg2","bgImg3","bgImg4");
      var b = document.getElementById('Rotating1');
      //var d = document.getElementById('bgClass');
      if(Start>=a.length)
          Start=0;
      b.src = a[Start];
      //d.className = c[Start];
	 
      window.setTimeout("RotateImages(" + (Start+1) + ")",10000);
  }
  
  
  /*  #############################    Send Value in URL    #################################*/
function validateQQIndex(){
	
	var state=document.myForm.StateCode.value;
	var date=document.myForm.PolicyEffectiveDate.value;
	var errors = '';
	
	
	if (state == '')
	{
		errors += '- State is required.\n'; 
	}
	if (date == '')
	{
		errors += '- Policy effective date is required.\n'; 
	}
	if(date != '' && !validateMMYYYYDatePortal('PolicyEffectiveDate'))
	{
		errors += '- Policy effective date is not valid.\n'; 
	}    
    
    if (errors) 
    	alert('The following error(s) occurred:\n'+errors);
    	
    if(errors == ''){      	
    	
    	var url = '';
    	var hostName = document.location.hostname;
    	
    	if(hostName.toLowerCase().indexOf('protexure.com') != -1)
		{
			url = "http://www.protexure.com/AccountantIns/qqinsured.jsp?StateCode="+state+"&PolicyEffectiveDate="+date;
		} else{
			url = "../AccountantIns/qqinsured.jsp?StateCode="+state+"&PolicyEffectiveDate="+date;
		}
		
		//var url="../AccountantIns/qqinsured.jsp?StateCode="+state+"&PolicyEffectiveDate="+date;
		//alert(url);		
		//self.location.href=url;
		
		var newWindow = window.open(url, '_parent');
		newWindow.focus();
		return false;
    }	
}


/* $$$$$$$$$$$$$$$$$$$$$$$ date picker $$$$$$$$$$$$$$$$$$$$$$$$$*/
function findPos(obj) {
  var pos = new Object;
  pos.left = 0;
  pos.top = 0;
	if (obj.offsetParent)	{
		while (obj.offsetParent) {
		  pos.left += obj.offsetLeft;
			pos.top  += obj.offsetTop;
			obj = obj.offsetParent;
		};
	}	else if (obj.x) {
	  pos.left = obj.x;
	  pos.top = obj.y;
	};
	return pos;
};

function parent(widget) {
  if (widget.parentElement) { return widget.parentElement };
  if (widget.parentNode) { return widget.parentNode };
  if (widget.parent) { return widget.parent };
  return;
};


function show_calendar_widget(widget)
	
{
	
  if (! document.getElementsByTagName) { return; };
  // find edit widget
  var edits = parent(widget).getElementsByTagName("input");
  if (edits.length > 1) {
    alert("More than one date edit field found within the enclosing element");
    return 0;
  } else if (edits.length == 0) {
    alert("No date edit field found within the enclosing element");
    return 0;
  };
  //alert("show calendar");
  var date_edit = edits[0];

  // load date from edit widget
  var date = date_edit.value;
	
  // find/create calendar widget
  var calendar_widget = document.getElementById("calendar_widget");
  if (! calendar_widget) {
    calendar_widget = document.createElement("div");
    calendar_widget.id = "calendar_widget";
    calendar_widget.className = "calendar_widget";
    document.body.appendChild(calendar_widget);
    var iframe = document.createElement("iframe");
    // <iframe id='calendar_widget_iframe' name='calendar_widget_iframe' style="border: none;" width=100% height=100% src="calendar_widget.html" />
    iframe.id = "calendar_widget_iframe";
    iframe.name = iframe.id;
    iframe.style.border = "none";
    iframe.width = "100%";
    iframe.height = "100%";
    iframe.src = "calendar_widget.html";

    calendar_widget.appendChild( iframe );
  };
	
  // find lower edge of edit widget:
  pos = findPos(date_edit);
  if (date_edit.offsetHeight) {
    pos.top += date_edit.offsetHeight;
  } else {
    pos.top += date_edit.clientHeight;
  };

  // move calendar widget
  if (document.all) {
    // IE
    calendar_widget.style.posTop = pos.top;
    calendar_widget.style.posLeft = pos.left;
    calendar_widget.style.display = "block";
  // } else if (document.layers) {
  //  alert((pos.top + date_edit.clientHeight) + "px");
  //  calendar_widget.top = (pos.top + date_edit.clientHeight) + "px";
  //  calendar_widget.left = pos.left + "px";
  } else {
    // Mozilla
    calendar_widget.style.position = "absolute";
    calendar_widget.style.top = pos.top + "px";
    calendar_widget.style.left = pos.left + "px";
    calendar_widget.style.display = "block";
  };

  // Now connect the current edit to the iframe:
  var iframe = window.frames["calendar_widget_iframe"];
  iframe.set_edit(date_edit);
}

function applyDateFormat(d,e){
      var val = d.value;
      var flag = false;
      var len = d.value.length;
      if(len != 10){
            for(var i=0; i<len;i++){
                  var c = d.value.charAt(i);
                  if(c=='/'){
                        d.value = d.value.replace(c,"");
                        //alert(i);
                        flag = true;      
                  }     
            }
      }
      if(flag){
            return;
      }
      //alert(val);
      var str = "0123456789";
      var ch = val.charAt(len-1);
      //alert(val + ' ' + len + ' ' + ch + str.indexOf(ch));
      if(str.indexOf(ch)>=0){
            if(len == 2 || len == 5){
            //    d.value = d.value + '/';
            }
            //return true;
      }else{
            d.value = d.value.replace(ch,"");
            return;
      }
      //alert(len);
      if(len==8 && val.indexOf("/")<0){
            var mm = d.value.substr(0,2);
            var dd = d.value.substr(2,2);
            var yy = d.value.substr(4,4);
            //alert(mm + ' ' + dd + ' ' + yy);
            d.value = mm + '/' + dd + '/' + yy;
            //alert(d.value);
      }
}

function validateMMYYYYDatePortal(dateField)
{
		//alert(dateField);
		var date= '';
		var returnval=false;	
	
 		if(document.getElementById(dateField) != null)
 		{
 			date = document.getElementById(dateField).value;
 		}
   		
   		if(date == '')
  			return returnval;	  	
  			
  		if(parseInt(date.indexOf("/")) < 0)  		
  		{
  			return returnval;	
  		}
		
		var monthfield = date.substring(0,date.indexOf("/"));	
		//alert('monthfield--'+monthfield);
		var dayfield = date.substring(date.indexOf("/")+1,5);
		//alert('dayfield---'+dayfield);
		var yearfield = date.substring(date.indexOf("/")+4,date.length);
		//alert('yearfield'+yearfield);
		var dayobj = new Date(yearfield, monthfield-1, dayfield)
	
		if( (monthfield >12) || (dayfield >31) )			
			returnval= false;
		else if( (monthfield == 2) && (dayfield > 29) )			
			returnval= false;
		else
			returnval=true;
						
		return returnval
	}
	  
	 
	  



function validateSocialPDF(){	
	
	var fname=document.myForm.fname.value;
	var lname=document.myForm.lname.value;
	var phone=document.myForm.phoneNo.value;
	var email=document.myForm.email.value;
	var date=document.myForm.date.value;
		
	var errors = '';
	if (fname == '')
	{
		errors += '- First name is required.\n'; 
	}
	if (lname == '')
	{
		errors += '- Last name is required.\n'; 
	}
	if (phone == '')
	{
		errors += '- Phone is required.\n'; 
	}
	if (email == '')
	{
		errors += '- Email is required.\n'; 
	}	
	if(date != '' && !validateMMYYYYDatePortal('date'))
	{
		errors += '- Expiration date is not valid.\n'; 
	}
	
    if (errors) 
    	alert('The following error(s) occurred:\n'+errors);
    	
    if(errors == ''){   
     
     	document.myForm.submit();        	
    	cPopUp('popupSocialMedia');
    	
    	var hostName = document.location.hostname;
		//alert("hostName...." + hostName);
		if(hostName.toLowerCase().indexOf('protexure.com') != -1)
		{
			var newWindow = window.open("http://www.protexure.com/download/ProtexureAccountants_SocialMediaPolicy.pdf", '_blank');	
		} else{
			var newWindow = window.open("../AccountantPortal/download/ProtexureAccountants_SocialMediaPolicy.pdf", '_blank');		
		}						
    }	
}









/*********************
//* jQuery Multi Level CSS Menu #2- By Dynamic Drive: http://www.dynamicdrive.com/
//* Last update: Nov 7th, 08': Limit # of queued animations to minmize animation stuttering
//* Menu avaiable at DD CSS Library: http://www.dynamicdrive.com/style/
*********************/

//Specify full URL to down and right arrow images (23 is padding-right to add to top level LIs with drop downs):
var arrowimages={down:['downarrowclass', 'img/down.gif', 23], right:['rightarrowclass', 'right.gif']}

var jqueryslidemenu={

animateduration: {over: 200, out: 300}, //duration of slide in/ out animation, in milliseconds

buildmenu:function(menuid, arrowsvar){
	jQuery(document).ready(function($){
		var $mainmenu=$("#"+menuid+">ul")
		var $headers=$mainmenu.find("ul").parent()
		$headers.each(function(i){
			var $curobj=$(this)
			var $subul=$(this).find('ul:eq(0)')
			this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}
			this.istopheader=$curobj.parents("ul").length==1? true : false
			$subul.css({top:this.istopheader? this._dimensions.h+"px" : 0})
			$curobj.children("a:eq(0)").css(this.istopheader? {paddingRight: arrowsvar.down[2]} : {}).append(
				'<img src="'+ (this.istopheader? arrowsvar.down[1] : arrowsvar.right[1])
				+'" class="' + (this.istopheader? arrowsvar.down[0] : arrowsvar.right[0])
				+ '" style="border:0;" />'
			)
			$curobj.hover(
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					this._offsets={left:$(this).offset().left, top:$(this).offset().top}
					var menuleft=this.istopheader? 0 : this._dimensions.w
					menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())? (this.istopheader? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) : menuleft
					if ($targetul.queue().length<=1) //if 1 or less queued animations
						$targetul.css({left:menuleft+"px", width:this._dimensions.subulw+'px'}).slideDown(jqueryslidemenu.animateduration.over)
				},
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					$targetul.slideUp(jqueryslidemenu.animateduration.out)
				}
			) //end hover
		}) //end $headers.each()
		$mainmenu.find("ul").css({display:'none', visibility:'visible'})
	}) //end document.ready
}
}

//build menu with ID="myslidemenu" on page:
jqueryslidemenu.buildmenu("myslidemenu", arrowimages)


function gotoFQInsuredAccountant()
{
	var hostName = document.location.hostname;
	//alert("hostName...." + hostName);
	if(hostName.toLowerCase().indexOf('protexure.com') != -1)
	{
		var url = "http://www.protexure.com/AccountantIns/newqoute_insured.jsp";
		var newWindow = window.open(url, '_blank');
		newWindow.focus();
		return false;
	} else{
		var url = "../AccountantIns/newqoute_insured.jsp";
		var newWindow = window.open(url, '_blank');
		newWindow.focus();
		return false;
	}
}

function gotoQQInsuredAccountant()
{
	var hostName = document.location.hostname;
	//alert("hostName...." + hostName);
	if(hostName.toLowerCase().indexOf('protexure.com') != -1)
	{
		var url = "http://www.protexure.com/AccountantIns/qqinsured.jsp";
		var newWindow = window.open(url, '_parent');
		newWindow.focus();
		return false;
	} else{
		var url = "../AccountantIns/qqinsured.jsp";
		var newWindow = window.open(url, '_parent');
		newWindow.focus();
		return false;
	}
}

function loginAccountant()
{	
	var hostName = document.location.hostname;
	//alert("hostName...." + hostName);
	if(hostName.toLowerCase().indexOf('protexure.com') != -1)
	{
		var url = "http://www.protexure.com/AccountantIns/accountrep.jsp";
		var newWindow = window.open(url,'_blank');
		newWindow.focus();
		return false;	
	} else{
		var url = "../AccountantIns/accountrep.jsp";
		var newWindow = window.open(url, '_blank');
		newWindow.focus();
		return false;		
	}
}

















