function getObject(objectId) {
        if (document.getElementById && document.getElementById(objectId)) {
                return document.getElementById(objectId);
        } else if (document.all && document.all(objectId)) {
                return document.all(objectId);
        } else {
                return false;
        }
}

function getObjectStyle(objectId) {
        var obj = getObject(objectId);
        if (obj) {
                return obj.style;
        } else {
                return false;
        }
}
function getStyle(el,styleProp)
{
        var x = document.getElementById(el);
        if (x.currentStyle)
                var y = x.currentStyle[styleProp];
        else if (window.getComputedStyle)
                var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
        return y;
}


function hideRow(rowId) {
	hideDiv(rowId);
}

function showRow(rowId) {
	var rowStyle = getObjectStyle(rowId);
	//For IE compatibility: IE (incorrectly) uses the 'block' style for visible rows instead of 'table-row'
	rowStyle.display = getStyle('visibleRow','display');
}

function hideDiv(divId) {
	var divStyle = getObjectStyle(divId);
	divStyle.display = "none";
}

function showDiv(divId) {
	var divStyle = getObjectStyle(divId);
	divStyle.display = "block";
}

function showInline(divId) {
	var divStyle = getObjectStyle(divId);
	divStyle.display = "inline";
}

function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=600');");
}
function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}

if (defaultEmptyOk == undefined) var defaultEmptyOk = true;

function isEmpty(strSource)
{ return ((strSource == null) || (strSource.length == 0));}

function isUSPhone(strSource)
{ if (isEmpty(strSource))
return ((isUSPhone.arguments.length == 1) ? defaultEmptyOk : (isUSPhone.arguments[1] == true)); return (strSource.search(/^(1[\-\.\s]?)?(\(\d{3}\)[\s\-\.]?|\d{3}[\s\-\.]?)?\d{3}[\-\.\s]?\d{4}(\s?x\d+)?$/) != -1);}

function isEmail(strSource)
{ if (isEmpty(strSource))
return ((isEmail.arguments.length == 1) ? defaultEmptyOk : (isEmail.arguments[1] == true)); return (strSource.search(/^[a-z\d][\w\-\.]*\@([a-z\d][\w\-]*\.)+[a-z]{2,4}$/i) != -1);}

function ValidateForm(objForm)
		{
			var bValid = true;
			var strError = "The following fields require entries:\n";

			if (isEmpty(objForm.firstName.value))
			{
				strError += "- First Name\n";
				bValid = false;
			}

			if (isEmpty(objForm.lastName.value))
			{
				strError += "- Last Name\n";
				bValid = false;
			}
			

			if (isEmpty(objForm.telephone.value))
			{
				strError += "- Telephone Number\n";
				bValid = false;
			}
				
			if (isEmpty(objForm.email.value))
			{
				strError += "- Email\n";
				bValid = false;
			}

			if (!isUSPhone(objForm.telephone.value))
			{
				strError += "- Telephone number must be a valid phone number in the format \'(ddd) ddd-dddd\'\n";
				bValid = false;
			}


			if (!isEmail(objForm.email.value))
			{
				strError += "- Email Address must be a valid email address in the format \'name@domain.com\'\n";
				bValid = false;
			}
			

			if (!bValid)
				alert(strError);

			return bValid;
		}
function ValidateForm2(objForm)
		{
			var bValid = true;
			var strError = "The following fields require entries:\n";

			if (isEmpty(objForm.firstName.value))
			{
				strError += "- First Name\n";
				bValid = false;
			}

			if (isEmpty(objForm.lastName.value))
			{
				strError += "- Last Name\n";
				bValid = false;
			}
			

			if (isEmpty(objForm.phoneHome.value) && isEmpty(objForm.phoneWork.value) && isEmpty(objForm.phoneCell.value))
			{
				strError += "- A Telephone Number\n";
				bValid = false;
			}
				
			if (isEmpty(objForm.email.value))
			{
				strError += "- Email\n";
				bValid = false;
			}
			
			if (!isEmpty(objForm.phoneHome.value)) {
				if (!isUSPhone(objForm.phoneHome.value))
				{
					strError += "- Telephone number must be a valid phone number in the format \'(ddd) ddd-dddd\'\n";
					bValid = false;
				}
			}
			if (!isEmpty(objForm.phoneWork.value)) {
				if (!isUSPhone(objForm.phoneWork.value))
				{
					strError += "- Telephone number must be a valid phone number in the format \'(ddd) ddd-dddd\'\n";
					bValid = false;
				}
			}
			if (!isEmpty(objForm.phoneCell.value)) {
				if (!isUSPhone(objForm.phoneCell.value))
				{
					strError += "- Telephone number must be a valid phone number in the format \'(ddd) ddd-dddd\'\n";
					bValid = false;
				}
			}

			if (!isEmail(objForm.email.value))
			{
				strError += "- Email Address must be a valid email address in the format \'name@domain.com\'\n";
				bValid = false;
			}
			

			if (!bValid)
				alert(strError);

			return bValid;
		}
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=600');");
}

$(document).ready(function() {
  $.viewMap = {
    '0' : $([]),
    'al' : $('#al'),
    'ca' : $('#ca'),
    'ct' : $('#ct'),
    'fl' : $('#fl'),
    'ga' : $('#ga'),
    'il' : $('#il'),
    'md' : $('#md'),
    'ma' : $('#ma'),
    'mi' : $('#mi'),
    'mo' : $('#mo'),
    'ne' : $('#ne'),
    'nv' : $('#nv'),
	'nj' : $('#nj'),
    'nm' : $('#nm'),
    'ny' : $('#ny'),
    'nc' : $('#nc'),
    'oh' : $('#oh'),
    'or' : $('#or'),
    'pa' : $('#pa'),
    'ri' : $('#ri'),
    'tx' : $('#tx'),
    'tn' : $('#tn'),
    'wa' : $('#wa'),
    'wi' : $('#wi'),
	'dc' : $('#dc'),
    'int' : $('#int'),
  };

  $('#viewSelector').change(function() {
    // hide all
    $.each($.viewMap, function() { this.hide(); });
    // show current
    $.viewMap[$(this).val()].show();
  });
});


$(document).ready(function()
{

    // hide all dropdown
    $("#mesosublist").hide();
    $("#treatmentsublist").hide();
    $("#doctorssublist").hide();
    $("#clinicssublist").hide();
    $("#asbestossublist").hide();
    $("#exposuresublist").hide();
    $("#veteranssublist").hide();
    $("#legalsublist").hide();

    //hover show dropdown
	
	$(".meso, .mesoactive").hover(function () {$("#mesosublist").show();});
    $("#mesosublist, .mesoexpanded").mouseleave(function(){var postTimer1 = setTimeout(function(){ $("#mesosublist").hide(); }, 0);});
	$(".treatment, .treatmentactive").hover(function () {$("#treatmentsublist").show();});
    $("#treatmentsublist, .treatmentexpanded").mouseleave(function(){var postTimer1 = setTimeout(function(){ $("#treatmentsublist").hide(); }, 0);});
    $(".doctors, .doctorsactive").hover(function () {$("#doctorssublist").show();});
    $("#doctoressublist, .doctorsexpanded").mouseleave(function(){var postTimer1 = setTimeout(function(){ $("#doctorssublist").hide(); }, 0);});
    $(".clinics, .clinicsactive").hover(function () {$("#clinicssublist").show();});
    $("#clinicssublist, .clinicsexpanded").mouseleave(function(){var postTimer1 = setTimeout(function(){ $("#clinicssublist").hide(); }, 0);});
    $(".asbestos, .asbestosactive").hover(function () {$("#asbestossublist").show();});
    $("#asbestossublist, .asbestosexpanded").mouseleave(function(){var postTimer1 = setTimeout(function(){ $("#asbestossublist").hide(); }, 0);});
    $(".exposure, .exposureactive").hover(function () {$("#exposuresublist").show();});
    $("#exposuresublist, .exposureexpanded").mouseleave(function(){var postTimer1 = setTimeout(function(){ $("#exposuresublist").hide(); }, 0);});
    $(".veterans, .veteransactive").hover(function () {$("#veteranssublist").show();});
    $("#veteranssublist, .veteransexpanded").mouseleave(function(){var postTimer1 = setTimeout(function(){ $("#veteranssublist").hide(); }, 0);});
    $(".legal, .legalactive").hover(function () {$("#legalsublist").show();});
    $(".legalexpanded, #legalsublist").mouseleave(function(){var postTimer1 = setTimeout(function(){ $("#legalsublist").hide(); }, 0);});
    
    
});


$(document).ready(function() {
			$("a.zoom").fancybox();

			$("a.zoom1").fancybox({
				'overlayOpacity'	:	0.7,
				'overlayColor'		:	'#FFF'
			});

			$("a.zoom2").fancybox({
				'zoomSpeedIn'		:	500,
				'zoomSpeedOut'		:	500
			});
		});

