function popUp(url, title, additional, w, h)
{
	var width = 100;
	var height = 100;
	
	if (typeof(w) != 'undefined' && typeof(h) != 'undefined')
	{
		width = w;
		height = h;
	}
	else
	{
		width = screen.width - 20;
		height = screen.height - 30;
		if (typeof(screen.availHeight) != 'undefined')
		{
			height = screen.availHeight;
			width = screen.availWidth - 10;
		}
		
		if (typeof(additional) == 'undefined')
		{
			additional = '';
		}
		else
		{
			additional = ',' + additional;
		}
	}
	
	additional += ",width=" + width + ",height=" + height;
	
	if (typeof(transfer) != "undefined" && transfer && !title.match("print"))
	{
		self.location.href = url;
	}
	else
	{	
		if (document.location.toString().match("menu.aspx") || typeof(title) == "undefined")
		{
			title = parseInt((Math.random() * 1000000000000)).toString();
			var win = window.open(url, title, 'toolbar=yes,scrollbars=yes,resizable=yes,maximize=1'+additional);
			if (!url.toString().match("http:"))
			{
				// we cant move the window if we are cross domains...
				win.moveTo(0,0);
			}
			return false;
		}
		
		var win = window.open(url, title, 'toolbar=yes,scrollbars=yes,resizable=yes,maximize=1'+ additional);
		return false;
	}
}

function popupPrint(url)
{
	return popUp(url, 'print', '', 740, 600);
}

function getAttribute(obj, name)
{
	if (typeof(obj[name]) != "undefined")
	{
		return obj[name];
	}
    else if (typeof(obj.attributes[name]) != "undefined")
    {
        return obj.attributes[name].value;
    }
}

function StartDateAnnualBlur()
{
	var obj1 = document.getElementById('cPeriod_txtFirstDayCover');
	var obj2 = document.getElementById('cPeriod_txtDate3');
	if (obj1.value.length > 0)
	{
		var d1 = new Date();
		d1.setYear(2003);
		
	}
}

function hName(field, obj)
{
	var objName = document.getElementById(field);
	if (objName != null)
	{
		objName.value = obj.value;
	}
}

function chkHolderPaxChange()
{
	var obj = document.getElementById('PolHolder_cbHolderInsured');
	if (obj)
	{
		return obj.checked;
	}
	return false;
}

function chkHolderFirstName(obj)
{
	if (chkHolderPaxChange())
	{
		hName("_ctl0_txtFirstName", obj);
	}
}

function chkHolderLastName(obj)
{
	if (chkHolderPaxChange())
	{
		hName("_ctl0_txtLastName", obj);
	}
}

function chkHolderGender(obj)
{
	if (chkHolderPaxChange())
	{
		var objGender = document.getElementById("_ctl0_ddlGender");
		if (objGender != null)
		{
			objGender.selectedIndex = obj.selectedIndex;
		}
	}
}

function ModalDialog()
{
	this.resizable = 'no';
	this.scroll = 'yes';
	this.width = '400';
	this.height = '500';
	this.url = '';
	
	this.Open = function()
	{
		var options = "";
		if (this.Returnable())
		{
			options += "resizable:" + this.resizable + ";";
			options += "scroll:" + this.scroll + ";"
			options += "status:yes;center:yes;help:no;"
			options += "dialogWidth:" + this.width + "px;"
			options += "dialogHeight:" + this.height + "px;"
			return window.showModalDialog(this.url, window, options);
		}
		else
		{
			options += "scrollbars=" + this.scroll + ",";
			options += "dialog=yes,minimizable=no,modal=yes,";
			options += "width=" + this.width + ","
			options += "height=" + this.height + ",";
			options += "resizable=" + this.resizable;
			return window.open(this.url, "RumPop", options);
		}
	}
	
	this.Returnable = function()
	{
		return (typeof(window.showModalDialog) != 'undefined');
	}
}

function checkNumeric(obj)
{
	obj.value = obj.value.replace(',', '');
	obj.value = obj.value.replace('.', '');
}

function applyNumeric(obj)
{
	
}

