function AjaxCallSimple(url,theDiv) { 
	new Ajax(url, {
		method: 'get',
		update: $(theDiv)
	}).request();
}


function SetTab(section) {
	// message...
	if (section == "Create") {  url = '/model/getpage/page_name/Create_the_right_message';  }
	if (section == "Deliver") {  url = '/model/getpage/page_name/Deliver_the_right_message';  }
	if (section == "Empower") {  url = '/model/getpage/page_name/Empower_your_career';  }
	if (section == "StartMsg") {  url = '/model/getpage/page_name/message_start';  }

	// plans...
	if (section == "ImpressionMaker") {  url = '/model/getpage/page_name/Plan_ImpressionMaker';  }
	if (section == "ImpressionPlus") {  url = '/model/getpage/page_name/Plan_ImpressionPlus';  }
	if (section == "PersonalAgent") {  url = '/model/getpage/page_name/Plan_PersonalAgent';  }
	if (section == "StartPlans") {  url = '/model/getpage/page_name/Plan_Start';  }

	// press...
	if (section == "press_video") {  url = '/model/getpage/page_name/press_video';  }
	if (section == "press_blog") {  url = '/model/getpage/page_name/press_blogs';  }
	if (section == "press_news") {  url = '/model/getpage/page_name/press_news';  }
	if (section == "StartPress") {  url = '/model/getpage/page_name/press_start';  }


	AjaxCallSimple(url,'tabContent');
	
	$$('ul.tabs li').removeClass('activeLink');
	
	thelink = section + "Link";
	$(thelink).addClass('activeLink');
	
}


function showEle(theDiv) {
	if ($(theDiv)) {
		$(theDiv).setStyle('display','block');
	}
}

function hideEle(theDiv) {
	if ($(theDiv)) {
		$(theDiv).setStyle('display','none');
	}
}

/* jj's change to how changeURL is populated into the menu
   basically, the menu is only changed to have the js call
   when the page is page.html */

window.addEvent('load',function() {
  url = document.location.href;
  if (url.indexOf('/plans.html') > -1) {
    $$('a.plan_tab_links').forEach(function(link,i) {
      var cur = link.getProperty('href');
      link.setProperty('href','javascript:changeURL(\''+cur+'\');');
    });
  }
});

function changeURL(theurl) {
	url = document.location.href;
	document.location.href = theurl;
	if ( (url.indexOf('/plans.html') > -1) && (theurl.indexOf('plans.html#') > -1) ) {
		document.location.reload();
	}
}

// the business card (and perhaps other sections) need a way to hide the instructions
window.addEvent('load',function() {
  $$('.instructions2hideTrigger').forEach(function(item) {
    // set all the toggles first 
    var triggerid = item.getProperty('id');
    $$('.'+triggerid).forEach(function(instruction) {
      eval('fx'+triggerid+' = new Fx.Slide(instruction, {duration:1000});');
      eval('fx'+triggerid+'.toggle();');
      instruction.setStyle('visibility','visible');
    }); 
    item.addEvent('click',function(e) {
      var triggerid = item.getProperty('id');
      $$('.'+triggerid).forEach(function(instruction) {
        eval('fx'+triggerid+'.toggle();');
        item.innerHTML = (item.innerHTML=='Show Instructions') ? 'Hide Instructions' : 'Show Instructions';
      });
    });
  });
});

