

// ACE UI and UI Objects...

//A set of object which controls the navigation.
nav = {


business: {


 
 


 
    
    
    
    business_aceL_1: {name:"Property & Casualty Insurance", href: "/For-Businesses/Property-Casualty-Insurance/Property-Casualty-Insurance.html"},
    
 
    
    
    
    business_aceL_2: {name:"Accident & Health Insurance", href: "/For-Businesses/Accident-Health-Insurance.html"},
    
 
    
    
    
    business_aceL_3: {name:"Life Insurance", href: "/For-Businesses/Life-Insurance.html"},
    
 
    
    
    
    business_aceL_4: {name:"Reinsurance", href: "/For-Businesses/Reinsurance/Reinsurance.html"},
    
 
    
    
    
    business_aceL_5: {name:"Small & Mid-sized Enterprises", href: "/For-Businesses/Solutions-for-Small-Mid-sized-Enterprises.html"}
    
 


 


 


 


 


 



},



families: {


 
 


 


 
    
    
    
    families_aceL_1: {name:"Life Insurance", href: "/For-Individuals-Families/Life-Insurance.html"},
    
 
    
    
    
    families_aceL_2: {name:"Accident & Health Insurance", href: "/For-Individuals-Families/Accident-Health-Insurance.html"},
    
 
    
    
    
    families_aceL_3: {name:"Home/Auto/Personal Property", href: "/For-Individuals-Families/Home-Auto-Personal-Property-Insurance.html"}
    
 


 


 


 


 




},





media: {


 
 


 


 


 


 
    
    
    
    media_aceL_1: {name:"News Releases", href: "http://news.acegroup.com"},
    
 
    
    
    
    media_aceL_2: {name:"Media Contacts", href: "/Media-Center/Media-Contacts.html"},
    
 
    
    
    
    media_aceL_3: {name:"ACE Perspectives", href: "/Media-Center/ACE-Perspectives/ACE-Perspectives.html"},
    
 
    
    
    
    media_aceL_4: {name:"ACE in the News", href: "/Media-Center/ACE-in-the-News/ACE-in-the-News.html"},
    
 
    
    
    
    media_aceL_5: {name:"Image Library", href: "/Media-Center/Image-Library.html"}
    
 


 


 



},





about: {


 
 


 


 


 


 


 


 
    
    
    
    about_aceL_1: {name:"Business Structure", href: "/About-ACE/Business-Structure.html"},
    
 
    
    
    
    about_aceL_2: {name:"Our History", href: "/About-ACE/Our-History/Our-History.html"},
    
 
    
    
    
    about_aceL_3: {name:"Corporate Advertising", href: "/About-ACE/Corporate-Advertising.html"},
    
 
    
    
    
    about_aceL_4: {name:"Executive Team", href: "/About-ACE/Executive-Team/Executive-Team.html"},
    
 
    
    
    
    about_aceL_5: {name:"Claims", href: "/About-ACE/Claims.html"},
    
 
    
    
    
    about_aceL_6: {name:"ACE and the Environment", href: "/About-ACE/ACE-the-Environment/ACE-the-Environment.html"},
    
 
    
    
    
    about_aceL_7: {name:"Philanthropy", href: "/About-ACE/Philanthropy/Philanthropy.html"}
    
 



}


}

secondaryNav = {
wholeLife: {
death: {name:"Accidental Death", href:"http://"},
premium: {name:"Waiver of Premium", href:"http://"},
benefit: {name:"Payer Benefit", href:"http://"}
}
}

lifeInsuranceContacts = { 
china: {region:"China", html: "<dl class='contactFull clearLeft'>\n\t<dt>Huatai Life PRC</dt>\n\t<dd>26th Floor, Office Bldg of Oriental Kenzo Plaza</dd>\n\t<dd>No. 48 Dong Zhi Men Wai Avenue</dd>\n\t<dd>Dongcheng District, 100027</dd>\n\t<dd class='com'>Beijing, People's Republic of China</dd>\n\t<dd>Tel: +86-10-5860-1818</dd>\n\t<dd>Fax: +86-10-5817-3600</dd>\n\t<dd><a href='www.huatailife.com'>www.huatailife.com</a></dd>\n</dl>"
},

europe: {region:"Europe", html: "<dl class='contactFull clearLeft'>\n\t<dt>ACE Europe Life</dt>\n\t<dd>The ACE Building</dd>\n\t<dd>100 Leadenhall Street</dd>\n\t<dd>London EC3A 3BP</dd>\n\t<dd class='com'>United Kingdom</dd>\n\t<dd>Tel: +44 20-7173-7000</dd>\n\t<dd>Fax: +44 20-7173-7800</dd>\n\t<dd><a href='lee.faulkner@ace-ina.com'></a></dd>\n</dl>"
},

meAF: {region:"Middle East and Africa", html: "<dl class='contactFull clearLeft'>\n\t<dt>ACE Life - Middle East and Africa<br/>ACE Insurance Company Egypt, S.A.E</dt>\n\t<dd>3, Abou El Feda St. 5th Floor</dd>\n\t<dd class='com'>Zamalek, Cairo, Egypt</dd>\n\t<dd>Tel: +202-27396700</dd>\n\t<dd>Fax: +202-27366707</dd>\n\t<dd><a href='www.acelifemea.com'>www.acelifemea.com</a></dd>\n\t<dd><a href='mailto:acelife.egypt@ace-ina.com'>acelife.egypt@ace-ina.com</a></dd>\n</dl>"
},

russia: {region:"Russia", html: "<dl class='contactFull clearLeft'>\n<dt>ACE Life Russia</dt>\n\t<dd>2, Stolyarny Pereulok</dd>\n\t<dd>Moscow 123242</dd>\n\t<dd class='com'>Russia</dd>\n\t<dd>Tel: +7 495-926-7404</dd>\n\t<dd>Fax: +7 495-253-27-24</dd>\n\t<dd><a href='www.acelife.ru'>www.acelife.ru</a></dd>\n\t<dd><a href='mailto:aceliferussia@ace-ina.com'>aceliferussia@ace-ina.com</a></dd>\n</dl>"
},

taiwan: {region:"Taiwan", html:"<dl class='contactFull clearLeft'>\n\t<dt>ACE Life Taiwan</dt>\n\t<dd>3F, No.285, Section 4,</dd>\n\t<dd>Zhong-Xiao E. Rd.,</dd>\n\t<dd class='com'>Taipei, Taiwan</dd>\n\t<dd>Tel: +886-8161-1988</dd>\n\t<dd>Fax: +886-8772-6599</dd>\n\t<dd><a href='www.acelife.com.tw'>www.acelife.com.tw</a></dd>\n\t<dd><a href='mailto:taiwanlife.cs@ace-ina.com'>taiwanlife.cs@ace-ina.com</a></dd>\n</dl>"
},

vietnam: {region:"Vietnam", html: "<dl class='contactFull clearLeft'>\n\t<dt>ACE Life Vietnam</dt>\n\t<dd>21st floor, Sun Wah Tower</dd>\n\t<dd>115 Nguyen Hue St., Dist. 1</dd>\n\t<dd>Ho Chi Minh City,</dd>\n\t<dd class='com'>Vietnam</dd>\n\t<dd>Tel: +848-827-8989</dd>\n\t<dd>Fax: +848-821-9000</dd>\n\t<dd><a href='www.acelife.com.vn'>www.acelife.com.vn</a></dd>\n\t<dd><a href='mailto:nuduongthanh.ton@ace-ina.com'>nuduongthanh.ton@ace-ina.com </a></dd>\n</dl>"
},

uae: {region: "United Arab Emirates", html: "<dl class='contactFull clearLeft'>\n\t<dt>ACE Life UAE</dt>\n\t<dd>Al Durrah Tower, 25th floor</dd>\n\t<dd>Corniche Al Buheira</dd>\t\n<dd>PO Box 68989</dd>\n\t<dd class='com'>Sharjah, UAE</dd>\n\t<dd>Tel: +971-6-519-6100</dd>\n\t<dd>Fax: +971-6-554-1121</dd>\n\t<dd><a href='www.acelifemea.com'>www.acelifemea.com</a></dd>\n\t<dd><a href='mailto:acelife.uae@ace-ina.com'>acelife.uae@ace-ina.com </a></dd>\n</dl>"
}
}

us = {
al: {region:"Alabama ", html:"<dl class='contactFull clearLeft'><dt>ACE USA</dt><dd>10 Inverness Center Parkway</dd><dd>Suite 230</dd><dd>Birmingham, AL 35242</dd><dd class='com'>USA</dd><dd>Tel: +1-205-991-6589 </dd><dd>Fax: +1-205-995-5486</dd><dd><a href='mailto:info@ace-ina.com '>info@ace-ina.com</a></dd><dd><a href='http://www.aceusa.com'>www.aceusa.com</a></dd></dl>"},
az: {region:"Arizona", html:"<dl class='contactFull clearLeft'><dt>ACE USA</dt><dd>1661 E. Camelback Road</dd><dd>Suite 203</dd><dd>Phoenix, AZ 85016</dd><dd class='com'>USA</dd><dd>Tel: +1-602-906-1500</dd><dd>Fax: +1-602-906-1594</dd><dd><a href='mailto:info@ace-ina.com'>info@ace-ina.com</a></dd><dd><a href='http://www.aceusa.com'>www.aceusa.com</a></dd></dl>"},
ak: {region:"Arkansas", html:""},
ca: {region:"California", html:""},
co: {region:"Colorado", html:""}, 
ct: {region:"Connecticut", html:""},
de: {region:"Delaware", html:""},
dc: {region:"District of Columbia", html:""}, 
fl: {region:"Florida", html:""},
ga: {region:"Georgia", html:""},
hw: {region:"Hawaii", html:""}, 
il: {region:"Illinois", html:""},
ind: {region:"Indiana", html:""},
ka: {region:"Kansas", html:""}, 
ls: {region:"Louisiana", html:""},
ml: {region:"Maryland", html:""},
ma: {region:"Massachusetts", html:""},
mi: {region:"Michigan", html:""},
mn: {region:"Minnesota", html:""},
nv: {region:"Nevada", html:""},
nj: {region:"New Jersey", html:""},
ny: {region:"New York", html:""},
nc: {region:"North Carolina", html:""},
oh: {region:"Ohio", html:""},
or: {region:"Oregon", html:""},
pa: {region:"Pennsylvania", html:""},
sc: {region:"South Carolina", html:""},
tx: {region:"Texas", html:""},
va: {region:"Virginia", html:""},
wa: {region:"Washington", html:""}
}

//A set of objects for use with the object-injection version of the Worldwide menu. 
/*world = {
na: {
territory:"North America",
countries: {
ber:{country:"Bermuda", href:"http://www.aceusa.com"},
can:{country:"Canada", href:"http://www.aceusa.com"},
pr:{country:"Puerto Rico", href:"http://www.aceusa.com"},
usa:{country:"United States", href:"http://ace.cbsandbox.com/prototype/site/aceusa.html"}
}
},

sa: {
territory:"Latin America",
countries: {
lar:{country:"Latin America Regional", href:"https://www.acelatinamerica.com/acela/"},
arg:{country:"Argentina", href:"https://www.acelatinamerica.com/acela/"},
bra:{country:"Brazil", href:"https://www.acelatinamerica.com/acela/"},
chl:{country:"Chile", href:"https://www.acelatinamerica.com/acela/"},
col:{country:"Columbia", href:"https://www.acelatinamerica.com/acela/"},
ecu:{country:"Ecuador", href:"http://ace.cbsandbox.com/prototype/site/ecuador.html"},
mex:{country:"Mexico", href:"http://www.aceusa.com"},
pan:{country:"Panama", href:"https://www.acelatinamerica.com/acela/"}, 
per:{country:"Peru", href:"https://www.acelatinamerica.com/acela/"}
}
},

af: {
territory:"Africa &amp; The Middle East",
countries: {
bah:{country:"Bahrain", href:"http://www.ace-mena.com/AceEuropeRoot/ACEMENA/"},
eyg:{country:"Egypt", href:"http://www.ace-mena.com/AceEuropeRoot/ACEMENA/"},
sda:{country:"Saudi Arabia", href:"http://www.ace-mena.com/AceEuropeRoot/ACEMENA/"},
sa:{country:"South Africa", href:"http://www.ace-mena.com/AceEuropeRoot/ACEMENA/"},
uae:{country:"United Arab Emirates", href:"http://www.ace-mena.com/AceEuropeRoot/ACEMENA/"}

}
},

eu: {
territory:"Europe",
countries: {
eu: {country:"Europe Regional", href:"http://www.aceuropeangroup.com/AceEuropeRoot/"},
aus:{country:"Austria", href:"http://www.aceeuropeangroup.com/AceEuropeRoot/"},
bel:{country:"Belgium",  href:"http://www.aceeuropeangroup.com/AceEuropeRoot/"},
czh:{country:"Czech Republic", href:"http://www.aceeuropeangroup.com/AceEuropeRoot/"},
den:{country:"Denmark", href:"http://www.aceeuropeangroup.com/AceEuropeRoot/"},
fld:{country:"Finland", href:"http://www.aceeuropeangroup.com/AceEuropeRoot/"},
fra:{country:"France", href:"http://www.aceeuropeangroup.com/AceEuropeRoot/"},
ger:{country:"Germany", href:"http://www.aceeuropeangroup.com/AceEuropeRoot/"},
ire:{country:"Ireland", href:"http://www.aceeuropeangroup.com/AceEuropeRoot/"},
ita:{country:"Italy", href:"http://www.aceeuropeangroup.com/AceEuropeRoot/"},
pol:{country:"Poland", href:"http://www.aceeuropeangroup.com/AceEuropeRoot/"},
ptg:{country:"Portugal", href:"http://www.aceeuropeangroup.com/AceEuropeRoot/"},
nor:{country:"Norway", href:"http://www.aceeuropeangroup.com/AceEuropeRoot/"},
rus:{country:"Russia", href:"http://www.aceeuropeangroup.com/AceEuropeRoot/"},
spa:{country:"Spain", href:"http://www.aceeuropeangroup.com/AceEuropeRoot/"},
swd:{country:"Sweden", href:"http://www.aceeuropeangroup.com/AceEuropeRoot/"},
swz:{country:"Switzerland", href:"http://www.aceeuropeangroup.com/AceEuropeRoot/"},
uk:{country:"United Kingdom", href:"http://www.aceeuropeangroup.com/AceEuropeRoot/"}
}
},

as: {
territory:"Asia",
countries: {
aus:{country:"Australia", href:"http://www.acegroup.com/AceGroupRoot/About+ACE/ACE+Companies/Overseas+General/ACE+Asia+Pacific.htm"},
cha:{country:"China", href:"http://www.acegroup.com/AceGroupRoot/About+ACE/ACE+Companies/Overseas+General/ACE+Asia+Pacific.htm"},
ind:{country:"India", href:"http://www.acegroup.com/AceGroupRoot/About+ACE/ACE+Companies/Overseas+General/ACE+Asia+Pacific.htm"},
ins:{country:"Indonesia", href:"http://www.acegroup.com/AceGroupRoot/About+ACE/ACE+Companies/Overseas+General/ACE+Asia+Pacific.htm"},
jpn:{country:"Japan", href:"http://www.acegroup.com/AceGroupRoot/About+ACE/ACE+Companies/Overseas+General/ACE+Asia+Pacific.htm"},
kor:{country:"Korea", href:"http://www.acegroup.com/AceGroupRoot/About+ACE/ACE+Companies/Overseas+General/ACE+Asia+Pacific.htm"},
mal:{country:"Malaysia", href:"http://www.acegroup.com/AceGroupRoot/About+ACE/ACE+Companies/Overseas+General/ACE+Asia+Pacific.htm"},
nzd:{country:"New Zealand", href:"http://www.acegroup.com/AceGroupRoot/About+ACE/ACE+Companies/Overseas+General/ACE+Asia+Pacific.htm"},
pak:{country:"Pakistan", href:"http://www.acegroup.com/AceGroupRoot/About+ACE/ACE+Companies/Overseas+General/ACE+Asia+Pacific.htm"},
phl:{country:"Phillipines", href:"http://www.acegroup.com/AceGroupRoot/About+ACE/ACE+Companies/Overseas+General/ACE+Asia+Pacific.htm"},
twn:{country:"Taiwan", href:"http://www.acegroup.com/AceGroupRoot/About+ACE/ACE+Companies/Overseas+General/ACE+Asia+Pacific.htm"},
thl:{country:"Thailand", href:"http://www.acegroup.com/AceGroupRoot/About+ACE/ACE+Companies/Overseas+General/ACE+Asia+Pacific.htm"},
vtm:{country:"Vietnam", href:"http://www.acegroup.com/AceGroupRoot/About+ACE/ACE+Companies/Overseas+General/ACE+Asia+Pacific.htm"}
}
}
}*/


$(function () { 
//COMMON
$.fn.createNav = function (navObj, ulClass) {
$(this).append("<ul class='" + ulClass + "'>");
navObj = navObj[$(this).attr('id')];

for (var i in navObj) { 
$("<li><a href='" + navObj[i].href + "' target='_top'>" + navObj[i].name + "</a></li>").appendTo('ul.' + ulClass); 
}

return $(this);
}

$.fn.resizeContainer = function (grow, element) {
$('div#container').css('height', (grow) ? $('div#container').height() + element.height() : $('div#container').height() - element.height());
return $(this);
}

$.fn.setupJump = function () {
$(this).css(
'backgroundImage', 
'url(http://ace.cbsandbox.com/prototype/site/images/arrow_down.gif)'
).after(
"<div id='jumpContainer'><ul class='jumpList'>"
).siblings('div#jumpContainer').after(
"<div id='bottom'>"
)
return $(this);
}

$.fn.createWorld = function () {
for (var i in world) { 
$("<li><dl id='"+i+"' class='territory'><dt>"+world[i].territory+"</dt></dl></li>").appendTo("div#world ul.jumpList");
for (var j in world[i].countries) {
$("<dd><a href='"+world[i].countries[j].href+"'>"+world[i].countries[j].country+"</a></dd>").appendTo("dl#"+i);
}
}
return $(this);
}

//There is no other way around this, but browser detection. 
$.fn.pauseMap = function (pause) {
//if ($('embed').length >= 1) {
//if ($.browser.msie == false ) {
//(pause) ? $('embed')[0].disableMap() : $('embed')[0].enableMap();
//} else {
//if ($.browser.version.indexOf('6') == -1) (pause) ? $('embed')[0].disableMap() : $('embed')[0].enableMap();
//}
//}
//return $(this);
return true
;}


$("#aceSearch").focus(function () {
$(this).css("border", "1px solid #97c906");
$(this).val("");
});

$("#aceSearch").blur(function () {
$(this).css("border", "1px solid #c0c0c0");
if ($(this).val()=="") $(this).val("Search");
});

//Primary Nav
$('#nav li').hover(function () {
if (eval(nav[this.id])!==undefined) $(this).createNav(nav, 'subNav');

var secondary = $(this).parents('ul').hasClass('secondaryNav');
(secondary) ? $('a.sec', this).css('color', '#8dc40a') : $(this).addClass('hover').children('a').addClass('top');

$(this).pauseMap(true);

},

function () {
$('ul', this).remove();

var secondary = $(this).parents('ul').hasClass('secondaryNav');
(secondary) ? $('a.sec', this).css('color', '#464a4f') : $(this).removeClass('hover').children('a').removeClass('top'); 

$(this).pauseMap(false);
});

//Secondary Nav
$('ul.secondaryNav li').toggle(function () {
if(eval(secondaryNav[this.id])!==undefined) {
$(this).append("<ul class='secondarySubNav'>");
for (var i in secondaryNav[this.id]) {
$("<li><a href='" + secondaryNav[this.id].href + "'>" + secondaryNav[this.id][i].name + "</a></li>").appendTo('ul.secondarySubNav');
}
$('a.sec', this).css('color', '#8dc40a');
} 
},

function () {
if(eval(secondaryNav[this.id])!==undefined) {
$('a.sec', this).css('color', '#464a4f');
$('ul', this).remove();
}
});


//World JumpMenu: Object Injection Ver. This is the preferred version. 
/*$("div#world a.trigger").toggle(function () {
$(this).setupJump().createWorld();

$(this).parents('div#world').find('dt, dd').hide().filter('dt').show().bind('click', function () {
$(this).css('color', '#8dc40a').siblings("dd").show("slow");
$(this).parents('li').siblings('li').find('dt').css('color', '#464a4f');
$(this).parents("li").siblings("li").children("dl").children("dd").hide("slow");
});
},

function () {
$(this).css('backgroundImage', 'url(http://ace.cbsandbox.com/prototype/site/images/arrow_up.gif)');
$(this).parents('div#world').find('ul, div').remove();
});*/

//World JumpMenu: Embedded HTML Ver. In case you plan on use a server-side technology to echo out the necessary html.
$('div#jumpContainer').find('li').not(':last').find('dd:last').children('a').css('padding-bottom', '20px'); //Necessary in this version, since the html is embedded and displayed by default.

$("div#world a.trigger").toggle(function () {
$(this).pauseMap(true);

$(this).css('backgroundImage', 'url(http://ace.cbsandbox.com/prototype/site/images/arrow_down.gif)');

$(this).parents('div#world').find('div#jumpContainer').show().find('dd').hide();

$(this).parents('div#world').find('dt').bind('click', function () {
$(this).css('color', '#8dc40a').siblings('dd').slideDown('fast').end().parents('li').siblings('li').find('dt').css('color', '#464a4f').siblings('dd').slideUp('fast'); 
});

},

function () {
$(this).pauseMap(false);
$('div#world div#jumpContainer').hide().find('dt').css('color', '#464a4f');
$(this).css('backgroundImage', 'url(http://ace.cbsandbox.com/prototype/site/images/arrow_up.gif)');
});



//City JumpMenu
$("div.city a.trigger").toggle(function () {
var menu=$(this).parents("div.city");
var obj=eval(menu.attr('id'));

$(this).setupJump();


for (var i in obj) {
$("<li><a href='" + (menu.hasClass('contactMenu') ? '#' : obj[i].href) + "' id='" + i + "'>" + obj[i].region + "</a></li>").appendTo("div.city ul.jumpList");
}

$('a', menu).not('.trigger').hide().show();

if (menu.hasClass("contactMenu")) {
var links = menu.children("div#jumpContainer").children("ul.jumpList").children("li").children("a"); 

links.click(function () {
if ($(this).parents("div#left").find("dl.contactFull").not("#headquarters").length > 0) {
$(this).parents("div#left").find("dl.contactFull").not("#headquarters").remove();
}
var obj=eval($(this).parents("div.city").attr('id')); 
$(this).parents("div.city").after(obj[$(this).attr("id")].html);

//Close Menu
$("div.city a.trigger").click();
});

}

//Resize container
menu.css('height', 'auto');
$(this).resizeContainer(true, $(this));
},

function () {
$(this).resizeContainer(false, $(this));
$(this).css('backgroundImage', 'url(http://ace.cbsandbox.com/prototype/site/images/arrow_up.gif)');
$(this).parents("div.city").find('div, ul').remove().end().css('height', '42px');

});


//Contact Menus
$('dl.contact dd').hide().siblings('dt').toggle(function () {
$(this).css('backgroundImage', 'url(/images/arrow_down.gif)').siblings('dd').show().css('height', 'auto');
$(this).resizeContainer(true, $(this).parents('dl')); 
},

function () {
$(this).resizeContainer(false, $(this).parents('dl'));
$(this).css('backgroundImage', 'url(/images/arrow_up.gif)').siblings('dd').hide();
});

});
