





		
// Master JScript File

$ = document.all ? function (id) { return document.all[id] } : function (id) { return document.getElementById(id) };
get_element = $;

function readCookie(name)
{
    var allcookies = document.cookie;
    var pos = allcookies.indexOf(name+"=");
    if (pos != -1)
    {
        var start = pos + (name.toString().length) + 1;
        var end = allcookies.indexOf(";", start); 
        if (end == -1) end = allcookies.length;
        var value = allcookies.substring(start, end);  
    }
    return value;
}

function openPopup(url, width, height, dialog)
{
//    if (modal == true)
//        return window.showModalDialog(url, "", "dialogWidth:" + width + "px;dialogHeight:" + height + "px;center:yes;status:no;scroll:no;resizable:no;help:no;");
	if (dialog == true)
		return window.open(url, "popup", "width=" + width + ", height=" + height + ", channelmode=no, directories=no, fullscreen=no, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, toolbar=no");
    else
        return window.open(url, "popup", "width=" + width + ", height=" + height + ", scrollbars=yes, resizable=yes");
        
}
        
function bookmarkCurrentPage()
{
    if (window.sidebar)
        window.sidebar.addPanel(document.title, self.location, "");
    else if (window.external)
        window.external.AddFavorite(self.location, document.title);
    else
        alert("Please press CTRL+D to bookmark this page.");
}

function setFontSize(newFontSize)
{
    var rootFontElement = $("content-start");
    if(newFontSize == "smaller")
    {
        rootFontElement.style.fontSize = "11px";
        document.cookie = "currentFontsize="+newFontSize+"; path=/";
    }
    else if(newFontSize == "bigger")
    {
        rootFontElement.style.fontSize = "130%"; // "small";
        document.cookie = "currentFontsize="+newFontSize+"; path=/";
    }
    else if(newFontSize == "normal")
    {
        rootFontElement.style.fontSize = "12px";
        document.cookie = "currentFontsize="+newFontSize+"; path=/";
    }
    else
    {
        newFontSize = "normal";
        rootFontElement.style.fontSize = "12px";
        document.cookie = "currentFontsize="+newFontSize+"; path=/"; 
    }
}

function alignNavMenus()
{
    var xOffSet = -6;
    var yOffSet = -6;
    var navb = $("navbar");
    
    if (navb != null)
    {
        var x = getPageOffsetLeft(navb, true);
	    var y = getPageOffsetTop(navb, true);

        $('backdrop').style.left = (getPageOffsetLeft(navb, true)+xOffSet)+"px"; 
        $('backdrop').style.top = (getPageOffsetTop(navb, true)+yOffSet)+"px";  

	    $('dropdown_home').style.left = (getPageOffsetLeft($("home"), true)+xOffSet)+"px";
        $('dropdown_home').style.top = (getPageOffsetTop($("home"), true)+yOffSet)+"px";

	    $('dropdown_aboutMPW').style.left = (getPageOffsetLeft($("about-us"), true)+xOffSet)+"px";
        $('dropdown_aboutMPW').style.top = (getPageOffsetTop($("about-us"), true)+yOffSet)+"px";
    	
	    $('dropdown_solution').style.left = (getPageOffsetLeft($("solutions"), true)+xOffSet)+"px";
        $('dropdown_solution').style.top = (getPageOffsetTop($("solutions"), true)+yOffSet)+"px";
    	
	    $('dropdown_lifeStages').style.left = (getPageOffsetLeft($("life-stages"), true)+xOffSet)+"px";
        $('dropdown_lifeStages').style.top = (getPageOffsetTop($("life-stages"), true)+yOffSet)+"px";
    	
	    $('dropdown_products').style.left = (getPageOffsetLeft($("products-services"), true)+xOffSet)+"px";
        $('dropdown_products').style.top = (getPageOffsetTop($("products-services"), true)+yOffSet)+"px";

	    $('dropdown_gettingStart').style.left = (getPageOffsetLeft($("getting-started"), true)+xOffSet)+"px";
        $('dropdown_gettingStart').style.top = (getPageOffsetTop($("getting-started"), true)+yOffSet)+"px";  
        
        startAction = true;
    }
}

// Functions for IE to get position of an object
function getPageOffsetLeft (el, asInt){
	var ol=el.offsetLeft;
	while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
	if (asInt == true)
	    try
	    {
	        var i = parseInt(ol, 10);
	        return isNaN(i) ? 0 : i;
	    }catch(ex){return 0;}
	return ol;
}
function getWindowOffsetLeft (el, asInt) {
	return getPageOffsetLeft(el, asInt)-parseInt(document.body.scrollLeft, 10);
}	
function getPageOffsetTop (el, asInt) {
	var ot=el.offsetTop;
	while((el=el.offsetParent) != null) { ot += el.offsetTop; }
	if (asInt == true)
	    try
	    {
	        var i = parseInt(ot, 10);
	        return isNaN(i) ? 0 : i;
	    }catch(ex){return 0;}
	return ot;
}

function getWindowOffsetTop (el, asInt) {
	return getPageOffsetTop(el, asInt)-parseInt(document.body.scrollTop, 10);
}

window.onresize = function(){alignNavMenus();}

function getHeight(name) {    
    var tmpElem = $(name);
    if(tmpElem.currentStyle) return tmpElem.offsetHeight;       
    else return parseInt(document.defaultView.getComputedStyle(tmpElem, "").getPropertyValue("height"));                
}


  function js_waterMark_Focus(objname, waterMarkText, waterMarkStyle, normalStyle)
  {
      obj = document.getElementById(objname);
      if(obj.value == waterMarkText)
      {
          obj.value="";
          obj.className = normalStyle
      }
  }
  function js_waterMark_Blur(objname, waterMarkText, waterMarkStyle, normalStyle)
  {
      obj = document.getElementById(objname);
      if(obj.value == "")
      {
  	      obj.value=waterMarkText;
          obj.className = waterMarkStyle
      }
      else
      {
          obj.className = normalStyle
      }
  }
 
function KeyDownHandler(btn)
{
    // process only the Enter key
    if (event.keyCode == 13)
    {
        // cancel the default submit
        event.returnValue=false;
        event.cancel = true;
        // submit the form by programmatically clicking the specified button
        btn.click();
    }
}
     
  /*************************/
  // Tabbing
  /*************************/
    
function _SetTabState(tab, isSelected)
{
    if (tab != null)
    {
        var tabContent = $(tab.id + "Content");
        if (tabContent != null)
        {
            var img = tab.getElementsByTagName("img");
            if (isSelected == true)
            {
                tab.className = tab.className.replace(/tab-off/i, "tab-on");
                if (img != null && img.length == 1)
                    img[0].src = img[0].src.replace(/arrow-off.gif/i, "arrow-on.gif");
                tabContent.style.display = "block";
            }
            else
            {
                tab.className = tab.className.replace(/tab-on/i, "tab-off");
                if (img != null && img.length == 1)
                    img[0].src = img[0].src.replace(/arrow-on.gif/i, "arrow-off.gif");
                tabContent.style.display = "none";
            }
        }
    }
}

function SelectTab(tab, tabname)
{
    if (tab != null)
    {		    
		var tabs = GetTabs(tab.parentNode);
        for (var i = 0; i < tabs.length; ++i)
			_SetTabState(tabs[i], tab == tabs[i])
		_SetTabTrackerTab(tab.parentNode, tab);

		// call the Nielsen tracking code
		if(tabname != '_init')
		    _rsEvent(window.location.href + '&tab=' + tabname);
    }
}


function SelectTabByIndex(tabContainer, index)
{
    var tabs = GetTabs(tabContainer);
    if (index >= 0 && index < tabs.length)
    {
		for (var i = 0; i < tabs.length; ++i)
			_SetTabState(tabs[i], index == i);
		_SetTabTrackerTab(tabContainer, tabs[index]);
    }
}

function PreselectTab(tabContainer, defaultIndex)
{
	var tab = _GetTabTrackerTab(tabContainer);
    if (tab != null)
        SelectTab(tab, '_init');
    else
        SelectTabByIndex(tabContainer, defaultIndex);
}

function SelectNextTab(tabContainer)
{
	SelectTabByIndex(tabContainer, GetTabIndex(tabContainer, GetSelectedTab(tabContainer)) + 1);
}

function SelectPreviousTab(tabContainer)
{
	SelectTabByIndex(tabContainer, GetTabIndex(tabContainer, GetSelectedTab(tabContainer)) - 1);
}

function GetTabs(tabContainer)
{
	var tabs = new Array();
	if (tabContainer != null)
		for (var i = 0; i < tabContainer.childNodes.length; ++i)
            if (tabContainer.childNodes[i].tagName && tabContainer.childNodes[i].tagName.toLowerCase() != "input")
				tabs.push(tabContainer.childNodes[i]);
	return tabs;
}

function _GetTabTracker(tabContainer)
{
	if (tabContainer != null)
		for (var i = 0; i < tabContainer.childNodes.length; ++i)
            if (tabContainer.childNodes[i].tagName && tabContainer.childNodes[i].tagName.toLowerCase() == "input")
                return tabContainer.childNodes[i];
	return null;
}

function _GetTabTrackerTab(tabContainer)
{
	var tabTracker = _GetTabTracker(tabContainer);
	if (tabTracker != null)
		return $(tabTracker.value);
	return null;
}

function _SetTabTrackerTab(tabContainer, tab)
{
	if (tab != null && tab.id)
	{
		var tabTracker = _GetTabTracker(tabContainer);
		if (tabTracker != null)
			tabTracker.value = tab.id;
	}
}

function GetSelectedTab(tabContainer)
{
	var tab = _GetTabTrackerTab(tabContainer);
	if (tab != null)
		return tab;
	var tabs = GetTabs(tabContainer);
	for (var i = 0; i < tabs.length; ++i)
		if (tabs[i].className.indexOf("tab-on") > -1)
			return tabs[i];
	return null;
}

function GetTabIndex(tabContainer, tab)
{
	if (tab != null)
	{
		var tabs = GetTabs(tabContainer);
		for (var i = 0; i < tabs.length; ++i)
			if (tabs[i] == tab)
				return i;
	}
	return -1;
}


<!--//--><![CDATA[//><!--

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

//--><!]]>



