﻿   var bolHovers = true; 
    var clientsideTaskChange = false;  
    
    function addLoadEvent(func) {
      var oldonload = window.onload;
      if (typeof window.onload != 'function') {
        window.onload = func;
      } else {
        window.onload = function() {
          if (oldonload) {
            oldonload();
          }
          func();
        }
      }
    }
    
    function MenuOver(menuAchor)
    {
        var currentPadding =  menuAchor.style.paddingLeft.toString().substring(0,menuAchor.style.paddingLeft.toString().length-2);
        var currentMargin = menuAchor.style.marginRight.toString().substring(0,menuAchor.style.marginRight.toString().length-2);
        var currentWidth = menuAchor.style.width.toString().substring(0,menuAchor.style.width.toString().length-2);
        menuAchor.style.paddingLeft = parseInt(currentPadding) + 8 + "px";
        menuAchor.style.marginRight = parseInt(currentMargin) - 8 + "px";
        
        if (currentWidth != 110)
        {
            menuAchor.style.backgroundPosition = "-" + parseInt(parseInt(currentWidth) - 50) + "px 0px";
        }
        
        //show submenu
        domNav.toggleNextObjDisplay(menuAchor);
    }
    
    function MenuOut(menuAchor)
    {
        var currentPadding =  menuAchor.style.paddingLeft.toString().substring(0,menuAchor.style.paddingLeft.toString().length-2);
        var currentMargin = menuAchor.style.marginRight.toString().substring(0,menuAchor.style.marginRight.toString().length-2);
        menuAchor.style.paddingLeft = parseInt(currentPadding) - 8 + "px";
        menuAchor.style.marginRight = parseInt(currentMargin) + 8 + "px";
        var currentWidth = menuAchor.style.width.toString().substring(0,menuAchor.style.width.toString().length-2);
        
        if (currentWidth != 110)
        {
            menuAchor.style.backgroundPosition = "-" + parseInt(parseInt(currentWidth) -35) + "px 0px";
        }
        
        //hide submenu
        domNav.toggleNextObjDisplay(menuAchor);
    }

    function SubmenuMouseOver(pos)
    {
                
        var div = document.getElementById("submenuhover_" + pos);
        if (div != null)
            div.style.display = "";
    }
    function SubmenuMouseOut(pos)
    {
   
        var div = document.getElementById("submenuhover_" + pos);
        if (div != null)
            div.style.display = "none";
    }
    
    function DoSearch() 
    {
        var keywords = escape(document.getElementById('searchtext').value);       
        keywords = keywords.replace("+", "");
        keywords = keywords.replace(/%27/g, "");
        keywords = keywords.replace(/-/g, "");
        keywords = keywords.replace(/%3C/g, "");
        keywords = keywords.replace(/%3E/g, "");
        keywords = keywords.replace("/", "");
        keywords = keywords.replace(/%3D/g, "");
        keywords = keywords.replace(/%3B/g, "");
        keywords = keywords.replace(/%22/g, "");
        keywords = keywords.replace(/%23/g, "");
        keywords = keywords.replace(/%25/g, "");
        keywords = keywords.replace(/%7B/g, "");
        keywords = keywords.replace(/%7D/g, "");
        keywords = keywords.replace(/%7C/g, "");
        keywords = keywords.replace(/%5C/g, "");
        keywords = keywords.replace(/%5E/g, "");
        keywords = keywords.replace(/%7E/g, "");
        keywords = keywords.replace(/%5B/g, "");
        keywords = keywords.replace(/%5D/g, "");
        keywords = keywords.replace(/%60/g, "");
        keywords = keywords.replace(/%26/g, "");
        keywords = keywords.replace(/%2C/g, "");
        keywords = keywords.replace(/%3A/g, "");
        keywords = keywords.replace(/%3F/g, "");
        keywords = keywords.replace(/%24/g, "");
        keywords = keywords.replace(/@/g, "");
        
        //sql chars
        keywords = keywords.replace(/drop/g, "");
        keywords = keywords.replace(/create/g, "");
        keywords = keywords.replace(/update/g, "");
        keywords = keywords.replace(/table/g, "");
        keywords = keywords.replace(/%20or%20/g, "");
        
        if (keywords != '')
            window.location = 'search.aspx?k=' + keywords;
    }
    
    function FixSearchImages() 
    {   
        if (navigator.appVersion.indexOf("MSIE") != -1) 
        {
                document.getElementById("searchImage").style.top = 3;
        }              
    }

    function ClickSearch(btn, event)
	{
		if(event != null && btn == 'lnkDoSearch')
		{
		    if(document.all)
		    {					
			    if(event.keyCode == 13)
			    {
				    event.returnValue=false;
				    event.cancel = true;
				    DoSearch();
				    return;
			    }
		    }
		    else if (document.getElementById)
		    {					
			    if(event.which == 13)
			    {
				    event.returnValue=false;
				    event.cancel = true;
				    DoSearch();
				    return;
			    }
		    }
		    else if(document.layers)
		    {					
			    if(event.which == 13)
			    {
				    event.returnValue=false;
				    event.cancel = true;
				    DoSearch();
				    return;
			    }
		    }
		}
		
		var keycode;
        if (window.event) 
            keycode = window.event.keyCode;
        else if (event) 
            keycode = event.which;
        else 
            return;
        
        if (keycode == 13)
            DoSearch();
    }
    
      function findPosX(obj)
      {
        var curleft = 0;
        if(obj.offsetParent)
            while(1) 
            {
              curleft += obj.offsetLeft;
              if(!obj.offsetParent)
                break;
              obj = obj.offsetParent;
            }
        else if(obj.x)
            curleft += obj.x;
        return curleft;
      }

      function findPosY(obj)
      {
        var curtop = 0;
        if(obj.offsetParent)
            while(1)
            {
              curtop += obj.offsetTop;
              if(!obj.offsetParent)
                break;
              obj = obj.offsetParent;
            }
        else if(obj.y)
            curtop += obj.y;
        return curtop;
      }

         
    function SetPosition(obj, x, y) 
    {          
        try 
        {
          document.getElementById(obj).style.left = (x) + "px";
          document.getElementById(obj).style.top  = (y) + "px";           
        } catch (e) { }
    }
    
    /* function SetNextButtonPos() 
    {   
        
        var x = 858;
        var y = 0;
        var obj; 
          
        try {
         obj = document.getElementById('RefImgY');                
         y = findPosY(obj)-220;   
        }
        catch (e)
        {
            y = 525;
        }      
        
        if (navigator.appVersion.indexOf('MSIE 6') >= 0)
        {  
            x = 836;     
        }
        
        if (y < 525) 
        {
            y = 525;
        }     
             
        
        try {
        SetPosition('nextPageButton', x, y);
        } catch (e2) {} 
    } */
    
    function FixTaskCheck() 
    {       
        var x = 0;
        var y = 0;
        var obj;      
     
        try {
            obj = document.getElementById('tblTaskSummary');           
            if (navigator.appVersion.indexOf('MSIE 7.0') >= 0)
            {   
                y   = findPosY(obj) + 20;
                x   = findPosX(obj) - 36;
            }
            else if (navigator.appVersion.indexOf('MSIE 6') >= 0)
            {  
                if (document.URL.indexOf('search.aspx') >= 0) 
                {     
                            
                    y   = findPosY(obj) + 15;
                    x   = findPosX(obj) - 36;    
                }
                else {     
                                 
                    y   = findPosY(obj) + 15;
                    x   = findPosX(obj) - 36;   
                    
                }
            }
            else 
            {                
                y   = findPosY(obj) - 20;
                x   = findPosX(obj) - 28;
            }
        }
        catch (e) 
        {
            x = 74;
            y = 170;
        }                
                   
        try {
            SetPosition('CheckFader', x, y);      
        } catch (e2) 
        {
            //
        }
        
        if (navigator.appVersion.indexOf('AppleWebKit') >= 0)
        {
            try
            {
                var yPos = findPosY($get('tblTaskSummary'))
                document.getElementById('searchImage').style.top = '5px'
            } catch (e) { }
        }
    }
    
    function ShowHome()
	{   
	    $find('modalBehaviorHome').show();
	}
	
	function HideHome()
	{	    
	    $find('modalBehaviorHome').hide();
	}
	
	function DetectUnload() 
	{	   
	   return "Are you sure you want to leave the Startup Center without saving your Startup Checklist?  To save changes, click Cancel below and then sign in or create a new account by clicking the \"Sign In\" button at the top of your screen." ;
	}
	
	function DisableExitWarning()
    {
        window.onbeforeunload = "";
    }
    
    function DisableExitMessage() 
    {        
       
        DisableExitWarning();
        
    }
    
    function fixExitLinks()
    {
        var myLinks = document.links;
        
        for(var i=0;i < myLinks.length;i++) {            
            var thetarget = myLinks[i].target.toString();
            var thehref = myLinks[i].href.toString();                     
          
            if (myLinks[i].id.indexOf('TopicCloud') < 0) 
            {
                if (thetarget.indexOf("blank") >= 0 || thehref.indexOf('startup-toolkit') >= 0
                    || thehref.indexOf("javascript:") >= 0 || thehref.indexOf("javascript") >= 0) 
                {
                    // Update onload without hijacking it (TS 01/01/2008)
                    if(myLinks[i].onclick != null ) {
                        var myClick = String(myLinks[i].onclick);                      
                        myClick = myClick.substr(myClick.indexOf("{") + 1);
                        myClick = myClick.substr(0, myClick.lastIndexOf("}") - 1);
			            myLinks[i].onclick = new Function(myClick + "; DisableExitMessage();");
                    }
                    else {
                        myLinks[i].onclick = DisableExitMessage;
                    }
                }    
            }    
        }
    }
    
    function ShowIE6TaskPopUp(obj, width, height, myPageY) 
    {   
			var TopLeftX = document.documentElement.clientWidth  / 2 - obj.offsetWidth/2 - 375;			
			var TopLeftY = 0;
			
			var div = obj;										
			div.style.top = TopLeftY;			
			div.style.left = TopLeftX + "px";	
			div.style.width = width + "px";
			div.style.height= height + "px";
			//div.style.display = "block";
    }
    
    function ShowIE6TaskPopUpHome(obj, width, height, myPageY) 
    {   
			var TopLeftX = document.documentElement.clientWidth  / 2 - obj.offsetWidth/2 - 375;			
			var TopLeftY = 0;
			
			var div = obj;										
			div.style.top = TopLeftY;			
			div.style.left = TopLeftX + "px";	
			div.style.width = width + "px";
			div.style.height= height + "px";
			//div.style.display = "block";
    }    
    
    var addTask;
    var refImgElement;
    var PopUpBottomImg;
    
    function ShowAddTask(id, refimg, bottomId) 
    {
        addTask = document.getElementById(id); 
        
        document.getElementById('content').style.zIndex = 999999;   
        document.getElementById('content').style.zIndex = 999999;         
        document.getElementById('taskListSummary').style.zIndex = 0;
        //document.getElementById('taskListSummaryChild').style.zIndex = 0;           
                              
         refImgElement = document.getElementById(refimg);
         
         PopUpBottomImg = document.getElementById(bottomId);
        

         
         addTask.style.visibility = 'visible';  

            window.scrollTo(0, 0);
    }
    
    
    
    function HideAddTask(id) 
    {            
        var addTask = document.getElementById(id); 
        addTask.style.visibility = 'hidden';  
        
        document.getElementById('content').style.zIndex = 0;              
        document.getElementById('taskListSummary').style.zIndex = 0;
        //document.getElementById('taskListSummaryChild').style.zIndex = 0;        
         
         addTask = null;
         refImgElement = null;
         PopUpBottomImg = null;
         
         return false;
    }   
    
    function showIframe(url)
    {        
        document.getElementById('iframe').src = url;
        document.getElementById('diviframe').style.visibility = "visible";
    }
    
    function closeIframe()
    {
        document.getElementById('diviframe').style.visibility = "hidden";
        document.getElementById('iframe').src = "";
    }
    

function ShowHide(id)
{
    var notes = 'notes-' + id;
    var img = 'img-' + id
    var label = 'lnkAddNotes-' + id;
    var e = document.getElementById(notes);
    var i = document.getElementById(img);
    var l = document.getElementById(label);    
    if (e.style.display == 'block')
    {
        e.style.display = 'none';
        i.src = "images/detail_arrow_expand.gif";
        if (l != null) {
            if (l.innerText) {                
                l.innerText = 'Add Notes';
            } else if (l.textContent) {
                l.textContent = 'Add Notes';
            }
        }
    }
    else
    {
        e.style.display = 'block';
        i.src = "images/detail_arrow_collapse.gif";
        if (l != null) {
            if (l.innerText) {
                l.innerText = 'Hide Notes';
            } else if (l.textContent) {
                l.textContent = 'Hide Notes';
            }
        }
    }
}

var t = new Array();
function RollOver(id)
{
  
    $get(id).style.display='block';
    var num = parseInt(id.substring(id.indexOf('-')+1));
    clearTimeout(t[num]); 
   
}

function RollOut(id)
{
    var num = parseInt(id.substring(id.indexOf('-')+1));
    clearTimeout(t[num]);
    t[num] = setTimeout('$get("' + id + '").style.display="none";',200);
}

var sponsors = new Array()
sponsors[0] = "Bank of America~BankOfAmerica.aspx~./images/logo_boa_small.gif";
sponsors[1] = "MasterCard~MasterCard.aspx~./images/logo_mc_small.gif";
sponsors[2] = "FedEx~MakeFedExAMemberOfYourSmallBusinessTeam.aspx~./images/logo_fedex_small.gif";
sponsors[3] = "StartupNation~StartupNation.aspx~./images/logo_sun_small.jpg";
sponsors[4] = "Safeco Insurance~SafecoInsurance.aspx~./images/logo_safeco_small.gif";
sponsors[5] = "at&t~att.aspx~./images/logo_att_small.gif";
sponsors[6] = "Comcast~comcast.aspx~./images/logo_comcast.jpg";
sponsors[7] = "LegalZoom~legalzoom.aspx~./images/logo_legalzoom.gif";
function RotateSponsors()
{
    if($get('Partners') != null)
    {
        if ($get('Partners').innerHTML == '')
        {        
            var i = Math.round((sponsors.length - 1) * Math.random());
            
            while(i == 6)
                i = Math.round((sponsors.length - 1) * Math.random());
            
            var data = sponsors[i].split('~');
            $get('Partners').innerHTML = '<a href="' + data[1] + '" title="' + data[0] + '" onclick="DisableExitMessage();"><img src="' + data[2] + '" alt="' + data[0] + '" /></a><br/>' + 
                '<br /><a href="AllAlliancePartners.aspx" onclick="DisableExitMessage();">View all of the alliance partners</a>';
        }
    }
    else if($get('PartnersATT') != null)
    {
        if ($get('PartnersATT').innerHTML == '')
        {        
            var i = Math.round((sponsors.length - 1) * Math.random());
            
            while(i == 6)
                i = Math.round((sponsors.length - 1) * Math.random());
            
            var data = sponsors[i].split('~');
            $get('PartnersATT').innerHTML = '<a href="' + data[1] + '" title="' + data[0] + '" onclick="DisableExitMessage();"><img src="' + data[2] + '" alt="' + data[0] + '" /></a><br/>' + 
                '<br /><a href="AllAlliancePartners.aspx" onclick="DisableExitMessage();">View all of the alliance partners</a>';
        }
    }
    else if($get('PartnersComcast') != null)
    {
        if ($get('PartnersComcast').innerHTML == '')
        {        
            var i = Math.round((sponsors.length - 1) * Math.random());
            
            while(i == 5)
                i = Math.round((sponsors.length - 1) * Math.random());
            
            var data = sponsors[i].split('~');
            $get('PartnersComcast').innerHTML = '<a href="' + data[1] + '" title="' + data[0] + '" onclick="DisableExitMessage();"><img src="' + data[2] + '" alt="' + data[0] + '" /></a><br/>' + 
                '<br /><a href="AllAlliancePartners.aspx" onclick="DisableExitMessage();">View all of the alliance partners</a>';
        }
    }
}
Sys.Application.add_load(function() { RotateSponsors(); });

function FixSolutionHome()
{
    try
    {
        if (navigator.appVersion.indexOf('MSIE 6') >= 0)
        {
            var h = '700';
            if (document.location.toString().indexOf('financial-planning-for-startups.aspx') >= 0)
	            h = '810';
            else if (document.location.toString().indexOf('employee-management-system.aspx') >= 0)
	            h = '780';
	        else if (document.location.toString().indexOf('business-startup-checklist.aspx') >= 0)
	            h = '600';

            document.getElementById('content').style.height = h;
        }
    } catch (e) { }
}

      function FadeOut(id, val) 
      {      
           var obj=document.getElementById(id);    
           
           if (isIE6())           
           {
                obj.style.display = 'none';               
                return;
           }
           else 
           {
               obj.style.filter = "alpha(opacity=" + val + ")";             
               obj.style.filter.opacity = val;             
               obj.style.opacity = val/100;
               obj.style.KhtmlOpacity = val/100;
               obj.style.MozOpacity = val/100;
               val = val - 25;   
               
               //if (val < 0) val = 0;    
               if (val >= 0) {       
                    setTimeout("FadeOut('"+id+"',"+val+");", 50);                    
               }
               else {
                    obj.style.display = 'none';
                    FadingOut=0;
               }
           }
      }
      
      function FadeIn(id, val) 
      {       
           FadingIn = 1;
           var obj=document.getElementById(id);
           
           if (isIE6())           
           {
                obj.style.display = 'block';
                obj.style.filter = null;             
                obj.style.filter.opacity = null;   
                return;
           }
           else 
           {           
               obj.style.filter = "alpha(opacity=" + val + ")";             
               obj.style.filter.opacity = val;             
               obj.style.opacity = val/100;
               obj.style.KhtmlOpacity = val/100;
               obj.style.MozOpacity = val/100;
               obj.style.display = 'block';
               val = val + 25;
               
               //if (val > 100) val = 100;
               
               if (val <= 100) 
               {
                    setTimeout("FadeIn('"+id+"',"+val+");", 50);
               }      
               else FadingIn = 0;  
           }     
      }
      
      function isIE6()
	{
	    var result = false;
        var agt=navigator.userAgent.toLowerCase();
        var version = parseInt(navigator.appVersion);
        var isIE = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
        if (isIE)
        {
            var isIE6 = ((agt.indexOf("msie 6.")!=-1));
            if (isIE6)
            {
                result = true;
            }
        }
        return result;
    }
    
    function isIE8Compat7()
	{
	    var result = false;
        var agt=navigator.userAgent.toLowerCase();
        var version = parseInt(navigator.appVersion);
        var isIE = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
        if (isIE)
        {
            var isIE7 = ((agt.indexOf("msie 7.")!=-1) && (agt.indexOf("trident")!=-1));
            if (isIE7)
            {
                result = true;
            }
        }
        return result;
    }
    function isIE() {
        var result = false;
        var agt = navigator.userAgent.toLowerCase();
        var version = parseInt(navigator.appVersion);
        result = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));        
        return result;
    }
      
    