    function uploadFile(upForm)
    {
        file = upForm.logo.value;

        fileType = file.substring(file.lastIndexOf("."));
        fileType = fileType.toLowerCase();
        if (file==("") )
        {
            alert("Please choose the logo to upload");
       }
        else if (file.indexOf(".")==-1)
        {
            alert("Invalid file type.");
        }
        else if ( (fileType!=(".jpg")) && (fileType!=(".jpeg")) && (fileType!=(".gif")) && (fileType!=(".bmp")) )
        {
            alert("Invalid file type.");
        }
        else 
        {
            upForm.submit();
        }
    }

    function openDojoDialog( id )
    {
        var dlg0 = dojo.widget.byId(id);
        if ( dlg0 )
        {
            dlg0.show();
        }
    }
    
    function closeDojoDialog( id )
    {
        var dlg0 = dojo.widget.byId( id );
        if ( dlg0 )
        {
            dlg0.hide();
        }
    }
    
    function readPrefereceCookie(name) 
    {
        var the_cookie = document.cookie;
        if (the_cookie.indexOf(name)==-1)
        {
            return "true";
        }
        var results = document.cookie.match ( name + '=(.*?)(;|$)' );
        if ( results )
        {
            return ( unescape ( results[1] ) );
        }
        else
        {
           return "true";
        }
    }

/*  function showPanel(name, index)
  {
      var panels = new Array('EMAIL', 'Y!', 'AIM');
        for(i = 0; i < panels.length; i++)
        {
          document.getElementById(panels[i]).style.display = (name == panels[i]) ? 'block':'none';
        }
          document.RegisterUserForm.channel[index].checked=true;
  }*/

    function checkBoxes()
    {
    var check = false;
            var i;
            for (i=0; i < document.resendForm.elements.length; i++) 
            {
            if ((document.resendForm.elements[i].type == 'checkbox') && (document.resendForm.elements[i].name.indexOf('recipients') > -1)) 
                    {
                        if (document.resendForm.elements[i].checked == true)
                        {
                            check=true;
                        }
                    }
            }
            if (!check)
            {
                alert("Please select the recipient(s) to resend");
                return false;
            }
        return true;
    }
    
    
    function desselectSelectAllCheckBox(CheckBox)
    {
        if (CheckBox.checked == false)
        {
            document.resendForm.resendall.checked = false;
        }
        else
        {
            var selectallChecked = true;
            var i;
            for (i=0; i < document.resendForm.elements.length; i++) 
            {
            if ((document.resendForm.elements[i].type == 'checkbox') && (document.resendForm.elements[i].name.indexOf('recipients') > -1)) 
                    {
                        if (document.resendForm.elements[i].checked == false)
                        {
                            selectallChecked = false;
                        }
                    }
            }
            document.resendForm.resendall.checked = selectallChecked;
        }
        
    }
    
    function SelectAll(CheckBoxControl) 
    {
        if (CheckBoxControl.checked == true) 
        {
            var i;
            for (i=0; i < document.resendForm.elements.length; i++) 
            {
                if ((document.resendForm.elements[i].type == 'checkbox') && (document.resendForm.elements[i].name.indexOf('recipients') > -1)) 
                    {
                        document.resendForm.elements[i].checked = true;
                        }
                    }
                } 
                else 
                {
                    var i;
                    for (i=0; i < document.resendForm.elements.length; i++) 
                        {
                            if ((document.resendForm.elements[i].type == 'checkbox') && (document.resendForm.elements[i].name.indexOf('recipients') > -1)) 
                        {
                    document.resendForm.elements[i].checked = false;
                }
            }
        }
    }
    
    function limitText(limitField, limitCount, limitNum) 
    {
        if (limitField.value.length > limitNum) {
            limitField.value = limitField.value.substring(0, limitNum);
        }
        else 
        {
            limitCount.value = limitNum - limitField.value.length;
        }
    }
    
    function submit(tag, tagName)
    {
            document.browseForm.tagId.value=tag;
            document.browseForm.tagName.value=tagName;
            document.browseForm.submit();
    }

    function hideUniverse()
    {
        if (document.getElementById) // Netscape 6 and IE 5+
        {
        var targetElement = document.getElementById('universe');
        targetElement.style.display = 'none';
        }
    }    

    function showUniverse()
    {
        if (document.getElementById) // Netscape 6 and IE 5+
        {
	        var targetElement = document.getElementById('universe');
	        if ( targetElement != null )
	        {
		        targetElement.style.display = 'inline';
		        targetElement.style.top = 50;
		        targetElement.style.left = 200;
		        window.document.univ.movie = "/qanda/universe/universe.lzx.swf";
		        window.document.univ.play();
	        }
        }
    }
    
    function populateNick(loginName, nickName)
    {

        if (loginName.value != '' && loginName.value.indexOf('@') < 0)
        {
            if (loginName.value.length <= 15)
            {
                  nickName.value = loginName.value;
           }
        }
        else
        {
            if (loginName.value.substring(0,loginName.value.indexOf('@') <= 15))
            {
                nickName.value = loginName.value.substring(0,loginName.value.indexOf('@'));
             }
             else 
             {
                nickName.value = loginName.value.substring(0,15);
             }
        }
    }
        
    function setDispatch(target) 
    {
        document.RegisterUserForm.dispatch.value=target;
        document.RegisterUserForm.submit();

    }

    function clearOtherForms(channel)
    {
        if (channel=='EMAIL')
        {
            cleaerYahooForm();
            cleaerAIMForm();
        }
        else if (channel=='Y!')
        {
            cleaerEmailForm();
            cleaerAIMForm();
        }
        else if (channel=='AIM')
        {
            cleaerEmailForm();
            cleaerYahooForm();
        }
    }

    function cleaerEmailForm() 
    {
        document.RegisterUserForm.loginName.value="";
        document.RegisterUserForm.nickName.value="";
        document.RegisterUserForm.password.value="";
        document.RegisterUserForm.repeatPassword.value="";
    }

    function cleaerYahooForm() 
    {
        document.RegisterUserForm.loginNameYAHOO.value="";
        document.RegisterUserForm.nickNameYAHOO.value="";
        document.RegisterUserForm.passwordYAHOO.value="";
    }

    function cleaerAIMForm() 
    {
        document.RegisterUserForm.loginNameAIM.value="";
        document.RegisterUserForm.nickNameAIM.value="";
        document.RegisterUserForm.passwordAIM.value="";
    }
    
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }
    
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }
    
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    }
    
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
        
    function openURL(url)
    {
      var tempURL=url.toLowerCase();

      if(tempURL.indexOf("http:\\")==-1 && tempURL.indexOf("http://")==-1)
       url="http://"+url;
       window.open(url,"Media");
    }
    
    /**
     * openImage is a misnomer as this call can be used to 
     * open other kinds of media (pdf, doc, etc...)
     */
    function openImage(url)
    {
        var tempURL=url.toLowerCase();
        window.open(url,"Media","resizable=1,menubar=0,status=0,toolbar=0,width=600,height=500");
    }       

    function openPage(url)
    {
          var tempURL=url.toLowerCase();
          window.open(url);
    }       

    function showPopup (targetObjectId, eventObj) 
    {
        if(eventObj) 
        {
            hideCurrentPopup();
            eventObj.cancelBubble = true;
            if( changeObjectVisibility(targetObjectId, 'visible') ) 
            {
                    window.currentlyVisiblePopup = targetObjectId;
                    return true;
            } else 
            {
                    return false;
            }
         } else {
            return false;
        }
    } 

    function hideCurrentPopup() {
        if(window.currentlyVisiblePopup) {
        changeObjectVisibility(window.currentlyVisiblePopup, 'hidden');
        window.currentlyVisiblePopup = false;
        }
    } 
    
    
//    document.onclick = hideCurrentPopup1;
    
    function showPopup1 (selfObject, targetObjectId, shift, xshift, yshift, eventObj) {
        //if(document.getElementById('subcontent2')) {
        eventObj.cancelBubble = true;
        // hide any currently-visible popups
        hideCurrentPopup1();
        if(!overlay(selfObject, targetObjectId, shift, xshift, yshift) ) {
            // if we successfully showed the popup
            // store its Id on a globally-accessible object
            window.currentlyVisiblePopup1 = targetObjectId;
            return true;
        } else {
            // we couldn't show the popup, boo hoo!
            return false;
        }
        //} else {
        // there was no event object, so we won't be able to position anything, so give up
       //return false;
        //}
    } // showPopup
    
    function hideCurrentPopup1() {
        // note: we've stored the currently-visible popup on the global object window.currentlyVisiblePopup1
        if(window.currentlyVisiblePopup1) {
        overlayclose(window.currentlyVisiblePopup1);
        window.currentlyVisiblePopup1 = false;
        }
    } // hideCurrentPopup
    
    window.onload = initializeHacks;
    
    function initializeHacks() {
        if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
        && (navigator.platform.indexOf('Mac') != -1)
        && getStyleObject('blankDiv')) {
        window.onresize = explorerMacResizeFix;
        }
        resizeBlankDiv();
        createFakeEventObj();
        if(document.uploadForm) { //for the editprofile page
        	getCountDownValue(document.uploadForm.description,document.uploadForm.countdown,255);
        }
    }
    
    function createFakeEventObj() {
        if (!window.event) {
        window.event = false;
        }
    } 
    
    function resizeBlankDiv() {
        if ((navigator.appVersion.indexOf('MSIE 5') != -1) 
        && (navigator.platform.indexOf('Mac') != -1)
        && getStyleObject('blankDiv')) {
        getStyleObject('blankDiv').width = document.body.clientWidth - 20;
        getStyleObject('blankDiv').height = document.body.clientHeight - 20;
        }
    }
    
    function explorerMacResizeFix () {
        location.reload(false);
    }
    
    function getStyleObject(objectId) {
        if(document.getElementById && document.getElementById(objectId)) {
        return document.getElementById(objectId).style;
        } else if (document.all && document.all(objectId)) {
        return document.all(objectId).style;
        } else if (document.layers && document.layers[objectId]) {
        return document.layers[objectId];
        } else {
        return false;
        }
    } 
    
    function changeObjectVisibility(objectId, newVisibility) {
        var styleObject = getStyleObject(objectId);
        if(styleObject) {
        styleObject.visibility = newVisibility;
        return true;
        } else {
        return false;
        }
    }

    function redirectToMyCircleUp()
    {
        setTimeout("window.location.href='/my/cu/inbox/';", 5000);
    }
        
    function trim(argvalue) {
      var tmpstr = ltrim(argvalue);

      return rtrim(tmpstr);

    }
    
    function ltrim(argvalue) {
    
      while (1) {
        if (argvalue.substring(0, 1) != " ")
          break;
        argvalue = argvalue.substring(1, argvalue.length);
      }
    
      return argvalue;
    }
    
    function rtrim(argvalue) {
    
      while (1) {
        if (argvalue.substring(argvalue.length - 1, argvalue.length) != " ")
          break;
        argvalue = argvalue.substring(0, argvalue.length - 1);
      }
    
      return argvalue;
    }

    function fnSearch(document)
    {
        var key = document.search.value;
        window.location.href = "/my/cu/search?key='" + escape(key) + "'";

    }

    function submitCommentForm(form)
    {
        if (form.commentTemp.value==null || 
            trim(form.commentTemp.value)=="" || 
            trim(replaceAll(form.commentTemp.value, '\r\n', ''))=="" || 
            trim(replaceAll(form.commentTemp.value, '\n', ''))=="")
        {
            alert("Please enter text");
            form.commentTemp.value='';
            form.countdownComment.value='2000';
            form.commentTemp.focus();
            return;
        }
        form.comment.value = form.commentTemp.value;
        form.submit();
    }

    function submitAnnouncementForm(form)
    {
    	if (form.subject.value==null || trim(form.subject.value)=="")
        {
            alert("Please enter subject");
            form.subject.value='';
            form.subject.focus();
            return;
        }
        if (form.announcementTemp.value==null || trim(form.announcementTemp.value)=="" || trim(replaceAll(form.announcementTemp.value, '\r\n', ''))=="")
        {
            alert("Please enter text");
            form.announcementTemp.value='';
            form.countdownAnnouncment.value='2000';
            form.announcementTemp.focus();
            return;
        }
	
	if(announcementInProgress)
	{
		
		return;
	}
	announcementInProgress = true
        form.announcement.value = form.announcementTemp.value;
        
        form.submit();
    }


function replaceAll(argvalue, x, y) {

  if ((x == y) || (parseInt(y.indexOf(x)) > -1)) {
    errmessage = "replace function error: \n";
    errmessage += "Second argument and third argument could be the same ";
    errmessage += "or third argument contains second argument.\n";
    errmessage += "This will create an infinite loop as it's replaced globally.";
    alert(errmessage);
    return false;
  }
    
  while (argvalue.indexOf(x) != -1) {
    var leading = argvalue.substring(0, argvalue.indexOf(x));
    var trailing = argvalue.substring(argvalue.indexOf(x) + x.length, 
    argvalue.length);
    argvalue = leading + y + trailing;
  }

  return argvalue;

}
    function populateControlValue(form, subjectControl, salutationControl, announcementControl)
    {
        salutationControl.value = form.salutation.value;
        subjectControl.value = form.subject.value;
        announcementControl.value = form.announcement.value;
    }

    function getposOffset(overlay, offsettype){
        var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
        var parentEl=overlay.offsetParent;
        while (parentEl!=null){
        totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
        parentEl=parentEl.offsetParent;
        }
        return totaloffset;
    }

    function overlay(curobj, subobjstr, opt_position, shiftX, shiftY){
        if (document.getElementById(subobjstr)){
        var subobj=document.getElementById(subobjstr)
        subobj.style.display=(subobj.style.display!="block")? "block" : "none"
        var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
        var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
        subobj.style.left=xpos - shiftX +"px" // minus to push the div to left & vice-versa
        subobj.style.top=ypos - shiftY +"px"        // minus to push the div to top & vice-versa
        return false
        }
        else
        return true
    }

    function overlayclose(subobj){
        if(document.getElementById(subobj))
        {
            document.getElementById(subobj).style.display="none";
        }
    }

    function maskScreen(obj){
        var subobj=document.getElementById(obj);
        var scrollHeight = document.body.scrollHeight;
        var offHeight = document.body.offsetHeight
        var newHeight;
        var newWidth;
        if (scrollHeight > offHeight) // all but Explorer Mac
        {
          newWidth= document.body.scrollWidth;
          newHeight = document.body.scrollHeight;
        }
        else // Explorer Mac would also work in Explorer 6 Strict, Mozilla and Safari
        {
          newWidth = document.body.offsetWidth;
          newHeight = document.body.offsetHeight;
        }
        
        var windowHeight;
        if (self.innerHeight) // all except Explorer
        {
          windowHeight = self.innerHeight;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
            // Explorer 6 Strict Mode
        {
          windowHeight = document.documentElement.clientHeight;
        }
        else if (document.body) // other Explorers
        {
          windowHeight = document.body.clientHeight;
        }
        if(windowHeight > newHeight){
          newHeight = windowHeight;
        }
        
        subobj.style.width = newWidth + "px";
        subobj.style.height = newHeight + "px";
        subobj.style.display= "block";  
    }
    
    function maskOverlay(maskObj, curobj, subobjstr, opt_position, shiftX, shiftY){
        if (document.getElementById){
            maskScreen(maskObj);
            return overlay(curobj, subobjstr, opt_position, shiftX, shiftY);
        }
        else
        return true;
    }
    
    function closeMaskOverlay(maskObj, subobjstr){
        overlayclose(maskObj);
        overlayclose(subobjstr);
    }
    
    function closeMaskOverlayInCenter(maskObj, subobjstr){
        var theBody = document.getElementsByTagName("html")[0];
        theBody.style.overflow = "auto";
        closeMaskOverlay(maskObj, subobjstr);
    }

    function maskOverlayInCenter(maskObj, subobjstr){
        if (document.getElementById){
            window.scrollTo(0, 0);
            maskScreen(maskObj);
            var subobj=document.getElementById(subobjstr);
            if(centerAlignDialogBox(subobj)){
                removeScrollBar();
            }
            subobj.style.display="block";
            return false;
        }
        else
            return true;
    }
    
  function openWhoIsItForWindow(grn) 
    {
        var dlg = dojo.widget.byId('whoIsitFor');
        if ( dlg != null )
        {
        	//dlg.reset();
        	setRanNum(grn);
        	if (document.getElementById("box2"))
        	{
        		changeSet();
        		
        	}
        	else 
        	{
        		dojo.event.connect( dlg, "onLoad", "changeSet" );
        	}
        	dlg.show();
		}       
        return false;
    }
    
    function closeWhoIsItForWindow() 
    {   
        var dlg = dojo.widget.byId('whoIsitFor');
        if ( dlg != null )
        {
        	dlg.hide();
        }
        return false;
    }

    function overlayInCenter(subobjstr){
        if (document.getElementById){
            window.scrollTo(0, 0);
            var subobj=document.getElementById(subobjstr);
            centerAlignDialogBox(subobj)
            subobj.style.display="block";
            return false;
        }
        else
            return true;
    }
    
    function removeScrollBar(){
        var theBody = document.getElementsByTagName("html")[0];
        theBody.style.overflow = "hidden";
    }   

    function centerAlignDialogBox(subobj)
    {
        var windowWidth, windowHeight;
        if (self.innerHeight) // all except Explorer
        {
            windowWidth = self.innerWidth;
            windowHeight = self.innerHeight;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
            // Explorer 6 Strict Mode
        {
            windowWidth = document.documentElement.clientWidth;
            windowHeight = document.documentElement.clientHeight;
        }
        else if (document.body) // other Explorers
        {
            windowWidth = document.body.clientWidth;
            windowHeight = document.body.clientHeight;
        }

        var dialogWidth = subobj.style.width;
        var dialogHeight = subobj.style.height;
        dialogWidth = dialogWidth.substring(0,dialogWidth.indexOf("px"));
        dialogHeight = dialogHeight.substring(0,dialogHeight.indexOf("px"));
        var widthDiff = windowWidth-dialogWidth;
        var heightDiff = windowHeight-dialogHeight;
        subobj.style.left = (widthDiff)/2 + "px";
        subobj.style.top = (heightDiff)/2 + "px";
        if(widthDiff < 100 || heightDiff < 100){
            return false;
        }
        return true;
    }   
    
    
    //Functions for the home page start
    function newImage(arg) {
        if (document.images) {
            rslt = new Image();
            rslt.src = arg;
            return rslt;
        }
    }
    
    function changeImages() {
        if (document.images) {
            for (var i=0; i<changeImages.arguments.length; i+=2) {
                document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
            }
        }
    }
    
    var preloadFlag = false;
    function preloadImages() {
            if (document.images) {
            sport_btn_down = newImage("http://cachefly.circleup.com/assets/default/web/home/sport_btn-down.gif");
            sport_btn_over = newImage("http://cachefly.circleup.com/assets/default/web/home/sport_btn-over.gif");
            mom_btn_down = newImage("http://cachefly.circleup.com/assets/default/web/home/mom_btn-down.gif");
            mom_btn_over = newImage("http://cachefly.circleup.com/assets/default/web/home/mom_btn-over.gif");
            campaign_btn_down = newImage("http://cachefly.circleup.com/assets/default/web/home/campaign_btn-down.gif");
            campaign_btn_over = newImage("http://cachefly.circleup.com/assets/default/web/home/campaign_btn-over.gif");
            fund_btn_down = newImage("http://cachefly.circleup.com/assets/default/web/home/fund_btn-down.gif");
            fund_btn_over = newImage("http://cachefly.circleup.com/assets/default/web/home/fund_btn-over.gif");
            wedd_btn_down = newImage("http://cachefly.circleup.com/assets/default/web/home/wedd_btn-down.gif");
            wedd_btn_over = newImage("http://cachefly.circleup.com/assets/default/web/home/wedd_btn-over.gif");
            btn_sign_up_over = newImage("http://cachefly.circleup.com/assets/default/web/home/btn_sign_up_over.jpg");
            preloadFlag = true;
        }
    }

    function MM_openBrWindow(theURL,winName,features) { //v2.0
      window.open(theURL,winName,features);
    }
    
    function submitTryIt(tryItFrom,e)
    {
        if(isEnterKeyPressed(e)) 
        {
            return submitTryItForm(tryItFrom);
        } else 
        {
            return true;
        }
        
            
    }
    

        function checkEmail(str) {

        var at="@";
        var dot=".";
        var lat=str.indexOf(at);
        var lstr=str.length;
        var ldot=str.indexOf(dot);
        if (str.indexOf(at)==-1){
           alert("Please enter a valid email address so you can receive the question");
           return false ;
        }

        if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
           alert("Please enter a valid email address so you can receive the question");
           return false;
        }

        if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
            alert("Please enter a valid email address so you can receive the question");
            return false;
        }

         if (str.indexOf(at,(lat+1))!=-1){
            alert("Please enter a valid email address so you can receive the question");
            return false;
         }

         if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
            alert("Please enter a valid email address so you can receive the question");
            return false;
         }

         if (str.indexOf(dot,(lat+2))==-1){
            alert("Please enter a valid email address so you can receive the question");
            return false;
         }
        
         if (str.indexOf(" ")!=-1){
            alert("Please enter a valid email address so you can receive the question");
            return false;
         }

         return true;                   
    }
    
	function submitForm(form,e)
    {
        if(isEnterKeyPressed(e))
        {
           form.submit();
           return false;
         }
        else
           return true;
    }
    
    function isEnterKeyPressed(e) 
    {
        var keycode;
        if (window.event) keycode = window.event.keyCode;
        else if (e) keycode = e.which;
        else return false;

        if (keycode == 13)
            return true;
        return false;
    }
    function toggle_stepA (stepA) {
		var stepA = document.getElementById(stepA);
		if ( stepA.style.display != 'none' ) {
			stepA.style.display = 'none';
			MM_swapImage('imgA','','http://cachefly.circleup.com/assets/default/web-home/a.jpg',1);
		}
		else {
			stepA.style.display = '';
			MM_swapImage('imgA','','http://cachefly.circleup.com/assets/default/web-home/a_ex.jpg',1);
		}
		location.hash='send_anchor';
	}
	
	function toggle_stepA_sub1 (stepA_sub1) {
		var stepA_sub1 = document.getElementById(stepA_sub1);
		if ( stepA_sub1.style.display != 'none' ) {
			stepA_sub1.style.display = 'none';
			MM_swapImage('imgA_sub1','','http://cachefly.circleup.com/assets/default/web-home/a_sub1.jpg',1);
		}
		else {
			stepA_sub1.style.display = '';
			MM_swapImage('imgA_sub1','','http://cachefly.circleup.com/assets/default/web-home/a_sub1_ex.jpg',1);
		}
	}
	
	function toggle_stepA_sub2 (stepA_sub2) {
		var stepA_sub2 = document.getElementById(stepA_sub2);
		if ( stepA_sub2.style.display != 'none' ) {
			stepA_sub2.style.display = 'none';
			MM_swapImage('imgA_sub2','','http://cachefly.circleup.com/assets/default/web-home/a_sub2.jpg',1);
		}
		else {
			stepA_sub2.style.display = '';
			MM_swapImage('imgA_sub2','','http://cachefly.circleup.com/assets/default/web-home/a_sub2_ex.jpg',1);
		}
	}
	
	function toggle_stepA_sub3 (stepA_sub3) {
		var stepA_sub3 = document.getElementById(stepA_sub3);
		if ( stepA_sub3.style.display != 'none' ) {
			stepA_sub3.style.display = 'none';
			MM_swapImage('imgA_sub3','','http://cachefly.circleup.com/assets/default/web-home/a_sub3.jpg',1);
		}
		else {
			stepA_sub3.style.display = '';
			MM_swapImage('imgA_sub3','','http://cachefly.circleup.com/assets/default/web-home/a_sub3_ex.jpg',1);
		}
	}
	
	function toggle_stepA_sub3_more (stepA_sub3_more) {
		var stepA_sub3_more = document.getElementById(stepA_sub3_more);
		if ( stepA_sub3_more.style.display != 'none' ) {
			stepA_sub3_more.style.display = 'none';
		}
		else {
			stepA_sub3_more.style.display = '';
		}
	}
	
	function toggle_stepB (stepB) {
		var stepB = document.getElementById(stepB);
		if ( stepB.style.display != 'none' ) {
			stepB.style.display = 'none';
			MM_swapImage('imgB','','http://cachefly.circleup.com/assets/default/web-home/b.jpg',1);
		}
		else {
			stepB.style.display = '';
			MM_swapImage('imgB','','http://cachefly.circleup.com/assets/default/web-home/b_ex.jpg',1);
		}
		location.hash='answer_anchor';
	}
	
	function toggle_stepB_sub1 (stepB_sub1) {
		var stepB_sub1 = document.getElementById(stepB_sub1);
		if ( stepB_sub1.style.display != 'none' ) {
			stepB_sub1.style.display = 'none';
			MM_swapImage('imgB_sub1','','http://cachefly.circleup.com/assets/default/web-home/b_sub1.jpg',1);
		}
		else {
			stepB_sub1.style.display = '';
			MM_swapImage('imgB_sub1','','http://cachefly.circleup.com/assets/default/web-home/b_sub1_ex.jpg',1);
		}
	}
	
	function toggle_stepB_sub2 (stepB_sub2) {
		var stepB_sub2 = document.getElementById(stepB_sub2);
		if ( stepB_sub2.style.display != 'none' ) {
			stepB_sub2.style.display = 'none';
			MM_swapImage('imgB_sub2','','http://cachefly.circleup.com/assets/default/web-home/b_sub2.jpg',1);
		}
		else {
			stepB_sub2.style.display = '';
			MM_swapImage('imgB_sub2','','http://cachefly.circleup.com/assets/default/web-home/b_sub2_ex.jpg',1);
		}
	}
	
	function toggle_stepC (stepC) {
		var stepC = document.getElementById(stepC);
		if ( stepC.style.display != 'none' ) {
			stepC.style.display = 'none';
			MM_swapImage('imgC','','http://cachefly.circleup.com/assets/default/web-home/c.jpg',1);
		}
		else {
			stepC.style.display = '';
			MM_swapImage('imgC','','http://cachefly.circleup.com/assets/default/web-home/c_ex.jpg',1);
		}
		location.hash='view_anchor';
	}
	function toggle_stepD (stepD) {
		var stepD = document.getElementById(stepD);
		if ( stepD.style.display != 'none' ) {
			stepD.style.display = 'none';
			MM_swapImage('imgD','','http://cachefly.circleup.com/assets/default/web-home/d.jpg',1);
		}
		else {
			stepD.style.display = '';
			MM_swapImage('imgD','','http://cachefly.circleup.com/assets/default/web-home/d_ex.jpg',1);
		}
		location.hash='add_anchor';
	}
	
	function toggle_stepD_sub1 (stepD_sub1) {
		var stepD_sub1 = document.getElementById(stepD_sub1);
		if ( stepD_sub1.style.display != 'none' ) {
			stepD_sub1.style.display = 'none';
		}
		else {
			stepD_sub1.style.display = '';
		}
	}
	
	function toggle_stepD_sub2 (stepD_sub2) {
		var stepD_sub2 = document.getElementById(stepD_sub2);
		if ( stepD_sub2.style.display != 'none' ) {
			stepD_sub2.style.display = 'none';
		}
		else {
			stepD_sub2.style.display = '';
		}
	}
	
	function toggle_stepD_sub3 (stepD_sub3) {
		var stepD_sub3 = document.getElementById(stepD_sub3);
		if ( stepD_sub3.style.display != 'none' ) {
			stepD_sub3.style.display = 'none';
		}
		else {
			stepD_sub3.style.display = '';
		}
	}
	
	function toggle_stepD_sub4 (stepD_sub4) {
		var stepD_sub4 = document.getElementById(stepD_sub4);
		if ( stepD_sub4.style.display != 'none' ) {
			stepD_sub4.style.display = 'none';
		}
		else {
			stepD_sub4.style.display = '';
		}
	}

	// connect directly to the useAnalyticsJavascript function in our analytics 
	// template.  The djConfig event can't be used because of dojo ajax scripting
	// limitations
	function connectTabsToAnalyticsEvent( tabId )
	{
		try {
			var tabber = document.getElementById(tabId).tabber;
			dojo.event.connect( tabber, "onTabDisplay", function( args ) {
				try {
		            var titleText = args.tabber.tabs[ args.index ].headingText;  
		            doEventAnalytics( "profileTabs", "Show", titleText );
				} catch(e) {
					// swallow
				}
	          } ); 
		} catch(e) {
			// swallow
		}
	}
	
	/**
	 * video player resizing related scripts
	 */
	var timerState = 0;  // init state
	var player = null;
	var shimId = null;
	var playerStartSize = [ 300, 160, 0 ];   // values can get overwritten  
	var playerExpandSize = [ 300, 257, 0 ];  // values can get overwritten
	function playerReady(thePlayer) {
		player = document.getElementById(thePlayer.id);
	    addListeners();
	}

	function addListeners() {
		if ( timerState == 0 || timerState == 1 ) {
	        if (player) { 
	        	timerState = 2;
	            player.addModelListener("STATE", "stateListener" );
	        } else if ( timerState == 0 ) {
	            window.setTimeout( function(){ timerState == 0; addListeners(); }, 100 );
	        }
	    }
	}

	function stateListener(obj) { //IDLE, BUFFERING, PLAYING, PAUSED, COMPLETED
	    currentState = obj.newstate; 
	    previousState = obj.oldstate; 

	    if ((currentState != "PLAYING")&&(previousState == "PLAYING")) 
	    {
	    	removeShim();
	        setFlashSize(playerStartSize[0], playerStartSize[1], playerStartSize[2]); 
	    }
	    else if ( currentState == "PLAYING" )
	    {
	    	addShim();
	        setFlashSize( playerExpandSize[0], playerExpandSize[1], playerExpandSize[2]);
	    }
	    djConfig.onAnalyticsEvent('EVENT', { 'category':'VIDEO', 'action':obj.newstate, 'opt_label':player.getConfig().file } );
	}

	function setFlashSize(newW, newH, newT)
	{
	    player.width = newW + "px";
	    player.height = newH + "px";
	    document.getElementById("mediaplayer").style.height  = newH + "px";
	    document.getElementById("mediaplayer").style.top = newT + "px";
	}
	
	function addShim()
	{
		try
		{
			if ( /Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent) == false )
			{
				document.getElementById(shimId).style.zIndex = 1;
				document.getElementById(shimId).style.display = "block";
			}
		}
		catch(e){}
	}
	
	function removeShim()
	{
		try
		{
			document.getElementById(shimId).style.zIndex = -1;
			document.getElementById(shimId).style.display = "none";
		}
		catch(e){}
	}
	
	
	function deferredJavaScript( src, targetId, delay )
	{
	    var target = document.getElementById( targetId ); 
	    var deferScript = document.createElement( "script" );
	    deferScript.src = src;
	    setTimeout( "target.appendChild( deferScript );", delay );
	}
	
	function unescapeHTML(html) 
	{
        var htmlNode = document.createElement("DIV");
        htmlNode.innerHTML = html;
        if(htmlNode.innerText !== undefined)
        return htmlNode.innerText; // IE
        return htmlNode.textContent; // FF
    } 
