
function CreateId(id){return"#"+id;}
function GetById(id,getJQueryObject){return(getJQueryObject)?$(CreateId(id)):$(CreateId(id)).get(0);}
function AddPx(numericString){return parseInt(numericString)+"px";}
function RefreshOnContentChange()
{refreshTests++;if(refreshTests>3)
{window.clearInterval(refreshInt);}
else
{var innerContent=$("#InnerContent");var fixedContentHeight=innerContent.height();if(fixedContentHeight)
{var headlineHeight=$(".BlueHeader").height();var contentHeight=$(".StdText").height();var allHeight=0;if(headlineHeight)
allHeight+=headlineHeight;if(contentHeight)
allHeight+=contentHeight;if((allHeight!=0)&&(allHeight>fixedContentHeight))
{innerContent.get(0).style.height=allHeight+"px";}}}}
if(!document.all)
{var refreshTests=0;var refreshInt=window.setInterval("RefreshOnContentChange()",3000);}
function modalReset(url)
{document.getElementById('modalFrame').src=url;}
var CONTROL_LEFT_CONTENT_PART="LeftContentPart";ControlHandler=function(){this.itemToBindToMenu=null;}
ControlHandler.prototype={GetControl:function(controlKey,getJQueryObject){switch(controlKey){case CONTROL_LEFT_CONTENT_PART:return GetById("LeftContentPart",getJQueryObject);break;}}}
var controlHandler=new ControlHandler();$(document).ready(function(){uiHandler.HandleResizeUI();switchingBoxHandler.OpenBox("Section1Content");});$(window).bind('resize',function(){modalPopupHandler.RefreshModalPopup();});$(window).bind('scroll',function(){modalPopupHandler.RefreshModalPopup();});var isOpera=((navigator.userAgent+"").search(/Opera/)>=0);var isMac=(navigator.userAgent.search(/Mac/)>=0);UIHandler=function(){this.itemToBindToMenu=null;}
UIHandler.prototype={HandleResizeUI:function(){if(this.itemToBindToMenu){var leftContentPart=controlHandler.GetControl(CONTROL_LEFT_CONTENT_PART,true);if(leftContentPart){var itemToBindHeight=parseInt(this.itemToBindToMenu.offsetHeight);var menuHeight=leftContentPart.height();if(menuHeight>itemToBindHeight){var requiredHeight=leftContentPart.height()-this.itemToBindToMenu.offsetTop;this.itemToBindToMenu.style.height=AddPx(requiredHeight);}}}},BindToMenuHeight:function(controlId){this.itemToBindToMenu=GetById(controlId);},CenterElement:function(controlToCenter){var windowWidth=$(window).width();var windowHeight=$(window).height();var controlWidth=parseInt(controlToCenter.offsetWidth);var controlHeight=parseInt(controlToCenter.offsetHeight);var scrollTop=this.GetScrollTop();controlToCenter.style.left=parseInt((windowWidth-controlWidth)/2)+"px";if(!isOpera)
{controlToCenter.style.top=(parseInt((windowHeight-controlHeight)/2)+scrollTop)+"px";}
else
{var int_new_top=(parseInt((windowHeight-controlHeight)/2)+scrollTop);var new_top=(int_new_top/2)+"px"
controlToCenter.style.top=new_top;if(isMac)
{var omac_top=(parseInt((window.innerHeight-controlHeight)/2)+scrollTop);controlToCenter.style.top=omac_top+'px';}}},GetScrollTop:function(){var scrollTop=0;if(document.documentElement.scrollTop)
scrollTop=document.documentElement.scrollTop;if(window.pageYOffset)
scrollTop=window.pageYOffset;return scrollTop;}}
var uiHandler=new UIHandler();SwitchingBoxHandler=function(){this.OpenedBox=null;this.ClosedBox=null;}
SwitchingBoxHandler.prototype={OpenBox:function(itemToOpenId){var itemTopOpen=GetById(itemToOpenId);if(this.OpenedBox){this.ClosedBox=this.OpenedBox;$(CreateId(this.OpenedBox)).animate({height:0},"fast",switchingBoxHandler.HideBox);}
if(this.OpenedBox!=itemToOpenId){$(CreateId(itemToOpenId)).animate({height:100},"fast");this.OpenedBox=itemToOpenId;}},HideBox:function(){if(switchingBoxHandler.ClosedBox){GetById(switchingBoxHandler.ClosedBox).style.display='none';if(switchingBoxHandler.ClosedBox==switchingBoxHandler.OpenedBox)
switchingBoxHandler.OpenedBox=null;}},RegisterSwitchingBoxHandler:function(itemToClickId,itemToOpenId){GetById(itemToClickId,true).click(function(){switchingBoxHandler.OpenBox(itemToOpenId);});}}
var switchingBoxHandler=new SwitchingBoxHandler();ModalPopupHandler=function(){this.ModalBackground=null;this.ModaledElement=null;}
ModalPopupHandler.prototype={ShowModalPopup:function(elementToModalId){if(elementToModalId){var elementToModal=GetById(elementToModalId);if(elementToModal){this.CreateTransparentBackground();elementToModal.style.position="absolute";elementToModal.style.display="block";elementToModal.style.top="0px";elementToModal.style.left="0px";elementToModal.style.zIndex="15";uiHandler.CenterElement(elementToModal);this.ModaledElement=elementToModal;window.setTimeout("modalPopupHandler.RefreshModalPopup()",500);}}},CreateTransparentBackground:function(){if(this.ModalBackground){this.ModalBackground.style.display="block";}
else{var modalDiv=document.createElement("div");modalDiv.className="ModalPopup";modalDiv.style.height=$(window).height()+"px";modalDiv.style.width=$(window).width()+"px";document.body.appendChild(modalDiv);this.ModalBackground=modalDiv;}},RefreshModalPopup:function(){if(this.ModaledElement&&this.ModaledElement.style.display=="block"){uiHandler.CenterElement(this.ModaledElement);}
if(this.ModalBackground){this.ModalBackground.style.height=($(window).height()+uiHandler.GetScrollTop())+"px";this.ModalBackground.style.width=$(window).width()+"px";}},HideModalPopup:function(){if(this.ModalBackground)
this.ModalBackground.style.display="none";if(this.ModaledElement)
this.ModaledElement.style.display="none";}}
var modalPopupHandler=new ModalPopupHandler();