<!--

function PopupPicker(ctl,w,h)
{

      var PopupWindow=null;

      settings='width='+ w + ',height='+ h + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=no';

      PopupWindow=window.open('/gicmsweb/templates/DatePickerPopup.aspx?Ctl=' + ctl,'DatePicker',settings);

      PopupWindow.focus();

}
 
// HTML Place Holder Control name e.g. NCPHRICH_Address
function GetCursorPosition(controlName)                                           
{ 

	var pos = 0;
	
	// HTML Place Holder Control name e.g. NCPHRICH_Address
	if (controlName != null && controlName.length > 0)
	{
		var control = document.all[controlName];
		
		if (control != null)
		{
			// Get selected text
			var oRange = control.dom.selection.createRange().duplicate();
			var currentSelectedValue = oRange.text;
			
			// Add bookmark (Used for finding cursor position)
			var bookmark = String.fromCharCode(1); 
			oRange.text = bookmark + oRange.text;
			
			// Get temp text range
			var newRange = control.dom.body.createTextRange();
			newRange.findText(bookmark);                                         
			newRange.select();    	

			// Get cursor position
			pos = control.dom.documentElement.children[1].innerHTML.indexOf(bookmark);

			// Reset cursor position
			control.dom.selection.clear();
			if (currentSelectedValue.length > 0)
			{
				newRange.findText(currentSelectedValue);                                         
				newRange.select();    	
			}
		}
	}
	return pos;
}

		
function ShowCalendar(calendarControl, buttonControl, visible)
{
	var cal = document.all[calendarControl];
	var button = document.all[buttonControl];
	var style = cal.style;

	if (visible == 'true')
	{
		style.visibility = 'visible';
		style.display = '';
		style.top = getOffsetTop(button) + button.clientHeight + 2;
		style.left = (getOffsetLeft(button) - cal.clientWidth) + button.clientWidth + 2;
	}
	else
	{
		style.visibility = 'hidden';
		style.display = 'none';
	}
}

function getOffsetLeft(control)
{
	var offsetLeft = control.offsetLeft;
	while ((control = control.offsetParent) != null) {offsetLeft += control.offsetLeft;}
	return offsetLeft;
}

function getOffsetTop(control)
{
	var offsetTop = control.offsetTop;
	while ((control = control.offsetParent) != null) {offsetTop += control.offsetTop;}
	return offsetTop;
}
		
function OnCalendarButtonClick(calendarControl, buttonControl, toggleControl) 
{
	var isCalendarVisible = document.all[toggleControl];

	if(isCalendarVisible.value == 'false' || isCalendarVisible.value == '')
		isCalendarVisible.value = 'true';
	else 
		isCalendarVisible.value = 'false'; 

	ShowCalendar(calendarControl, buttonControl, isCalendarVisible.value);
}

// --- Begin Blue I JavaScript --

function getRealLeft(el)
{
	xPos = el.offsetLeft;
	tempEl = el.offsetParent;
	while (tempEl != null) {
		xPos += tempEl.offsetLeft;
		tempEl = tempEl.offsetParent;
	}
	return xPos;
}

function getRealTop(el)
{
	yPos = el.offsetTop;
	tempEl = el.offsetParent;
	while (tempEl != null) {
		yPos += tempEl.offsetTop;
		tempEl = tempEl.offsetParent;
	}
	return yPos;
}


isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
  topDog=isIE ? "BODY" : "HTML";
  whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");  
  hotDog=isIE ? event.srcElement : e.target;  
  while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
    hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
  }  
  if (hotDog.id=="titleBar"){
    offsetx=isIE ? event.clientX : e.clientX;
    offsety=isIE ? event.clientY : e.clientY;
    nowX=parseInt(whichDog.style.left);
    nowY=parseInt(whichDog.style.top);
    ddEnabled=true;
    document.onmousemove=dd;
  }
}

function dd(e){
	if (!ddEnabled) return;
	whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
	whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  
	if(whichDog)
	{
		var trueX = getRealLeft(whichDog);
		var trueY = getRealTop(whichDog);
		var bStr = 'Absolute X: ' + trueX + 'px\nAbsolute Y: '+ trueY + 'px\n';
		bStr += 'Absolute Right: ' + (trueX + whichDog.offsetWidth) + 'px\n';
		bStr += 'Absolute Bottom: ' + (trueY + whichDog.offsetHeight) + 'px';
		//alert(bStr);	
		//alert('in dd');
		switchselbluei(trueX, trueY, whichDog.offsetWidth, whichDog.offsetHeight);
	}
  
	return false;  
}

function ddN4(whatDog){
  if (!isN4) return;
  N4=eval(whatDog);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
    N4.captureEvents(Event.MOUSEMOVE);
    N4x=e.x;
    N4y=e.y;
  }
  N4.onmousemove=function(e){
    if (isHot){
      N4.moveBy(e.x-N4x,e.y-N4y);
      return false;
    }
  }
  N4.onmouseup=function(){
    N4.releaseEvents(Event.MOUSEMOVE);
  }
}

function hideMe(){
  if (isIE||isNN) whichDog.style.visibility="hidden";
  else if (isN4) document.theLayer.visibility="hide";
}

function showMe(){
  if (isIE||isNN) whichDog.style.visibility="visible";
  else if (isN4) document.theLayer.visibility="show";
}

function switchVis(x,y,w,h) {		
	if (isIE||isNN) {
		if (whichDog.style.visibility=="visible") {
			if(!this.sel)
			{
				this.sel=document.getElementsByTagName("SELECT");
				this.sel.level=0;
			}
			var sel=this.sel;
			for(i=0;i<sel.length;i++)
			{	
				if(sel[i].name.indexOf("cmbCurrentLanguage") != -1)
				{				
					sel[i].style.visibility="hidden"; 
				}
			}
			hideMe();
			switchselbluei(3000,3000,0,0)
		}
		else {
			if(!this.sel)
			{
				this.sel=document.getElementsByTagName("SELECT");
				this.sel.level=0;
			}
			var sel=this.sel;
			for(i=0;i<sel.length;i++)
			{	
				if(sel[i].name.indexOf("cmbCurrentLanguage") != -1)
				{				
					sel[i].style.visibility="visible"; 					
				}
			}	
			showMe();
			switchselbluei(x,y,w,h);
		}		
	}
  else if (isN4) {  		
		if (document.theLayer.visibility=="show") {
			hideMe();
		}
		else {
			showMe();
		}
	}
}

function displayAbsPos(id) {
	
	whichDog= document.getElementById(id);  	
	// whichDog=isIE ? document.all.theLayer : document.getElementById(id);  		
	//var el = document.all ? document.all(id) : document.getElementById ? document.getElementById(id) : null;
	//if (el) {
	//	var trueX = getRealLeft(el);
	//	var trueY = getRealTop(el);
	//	var aStr = 'Absolute X: ' + trueX + 'px\nAbsolute Y: '+ trueY + 'px\n';
	//	aStr += 'Absolute Right: ' + (trueX + el.offsetWidth) + 'px\n';
	//	aStr += 'Absolute Bottom: ' + (trueY + el.offsetHeight) + 'px';
		//alert(aStr);		
	//	theLayer.style.top = trueY + 20;
	//	theLayer.style.left = trueX - 411;
	//}
	if(whichDog)
	{
		var trueX = getRealLeft(whichDog);
		var trueY = getRealTop(whichDog);
		var bStr = 'Absolute X: ' + trueX + 'px\nAbsolute Y: '+ trueY + 'px\n';
		bStr += 'Absolute Right: ' + (trueX + whichDog.offsetWidth) + 'px\n';
		bStr += 'Absolute Bottom: ' + (trueY + whichDog.offsetHeight) + 'px';
		//alert(bStr);	
		switchVis(trueX, trueY, whichDog.offsetWidth, whichDog.offsetHeight);
	}
}

function switchselbluei(x,y,w,h)
{		
    var selx,sely,selw,selh,i
    if(!this.sel)
    {
		this.sel=document.getElementsByTagName("SELECT");
		this.sel.level=0;
    }
    var sel=this.sel;
    for(i=0;i<sel.length;i++)
    {		
		selx=0;
		sely=0;
		var selp;
		if(sel[i].offsetParent)
		{
			selp=sel[i]; 
			while(selp.offsetParent)
			{
				selp=selp.offsetParent; 
				selx+=selp.offsetLeft; 
				sely+=selp.offsetTop;
			}
		}
		selx+=sel[i].offsetLeft; 
		sely+=sel[i].offsetTop;
		selw=sel[i].offsetWidth; 
		selh=sel[i].offsetHeight;
		
		//alert(selx + ' ' + sely + ' ' + selw + ' ' + selh);
		//alert(x + ' ' + y + ' ' + w + ' ' + h);	
		var xhit, yhit;
		xhit = (((selw +selx) > x) && ((selw+selx) < (x+w))) || ((selx > x) && (selx < (x+w))) || ((selx <x) && ((selx + selw) > (x+w)));
		yhit = ((sely > y) && (sely < (y+h))) || (((sely+selh) < (y+h)) && ((sely + selh) > y));
		//alert(sel[i].name + ': ' + xhit + ' ' + yhit + ' goodstuff: ' + sel[i].name.indexOf("cmbCurrentLanguage"));
		if(xhit && yhit)
		{
			if(sel[i].name.indexOf("cmbCurrentLanguage") == -1)
			{				
				if(sel[i].style.visibility!="hidden")
				{
					sel[i].style.visibility="hidden"; 
				}
			}
		}
		else
		{ 
			if(sel[i].name.indexOf("cmbCurrentLanguage") == -1)
			{
				sel[i].style.visibility="visible";
			}
		}
    }
}

function ConfirmAMBest(link)
	{
		if(confirm("The Best's Rating Report(s) reproduced on this site appear under license from A.M. Best and do not constitute, either expressly or implied, an endorsement of (Licensee)'s products or services. A.M. Best is not responsible for transcription errors made in presenting Best's Rating Reports. Best's Rating Reports are copyright A.M. Best Company and may not be reproduced or distributed without the express written permission of A.M. Best Company. Visitors to this web site are authorized to print a single copy of the Best's Rating Report(s) displayed here for their own personal use. Any other printing, copying or distribution is strictly prohibited.\n\nBest's Ratings are under continuous review and subject to change and/or affirmation. To confirm the current rating, please visit the A.M. Best web site, www.ambest.com."))
			msg=open(link)
	}
	
document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");

// -- End of the Blue I Javascript --
//-->

