﻿// JavaScript Document



function customCSS(){
	var location = window.location.href;
	var obj = document.getElementById('content');
	var findOne = location.match(/\w+\arpm-bootcamp|arpm-bootcamp\/|attilio-meucci|attilio-meucci\/|arpm-bootcamp/);
	var findTow = location.match(/\w+\attilio-meucci\/book\/|attilio-meucci\/resume\/|attilio-meucci\/book\//);
	var findthree = location.match(/\w+\events|events/);
	var findfour = location.match(/\w+\resources|resources/);
	if(findOne){
		//obj.setAttribute("style", "marginTop:42px");
		obj.style.marginTop = "32px";
	}
	if(findTow){
		//obj.setAttribute("style", "marginTop:74px");
		obj.style.marginTop = "64px";
	}
	if(findthree){
		//obj.setAttribute("style", "marginTop:74px");
		obj.style.marginTop = "35px";
	}
	if(findfour){
		//obj.setAttribute("style", "marginTop:74px");
		obj.style.marginTop = "35px";
	}
}





function removeResourceMenuLink(){



	var MainMenu = document.getElementById('mainmenu');

	if(MainMenu != null){

		var LITab = MainMenu.firstChild;

		do

		 {

		   var Tab = LITab.firstChild;

		   if (Tab.tagName == "A")

		   {

			 Tab.href      = "#";

			 Tab.blur();

		   }

		 }

		 while (LITab = LITab.nextSibling);

	}

}



function showInnerMenu(){
	

	var lng_path = '';
	var lng_cookie = getLangCookie();
		if(lng_cookie=='zh-hans'){
		lng_path = '/zh-hans';
	}
	if(window.location.href.match(/\w+\arpm-bootcamp|arpm-bootcamp/)){
		var active0="", active1 = "", active2 = "", active3 = "", active4 = "", active5 = "", active6 = "", active7 = "";
		var link=document.location.pathname;
		if(link=='/arpm-bootcamp'){
			active0 = "active-trail";
		}else if(window.location.href.match(/\w+\arpm-bootcamp\/program|arpm-bootcamp\/program/)){
			active1 = "active-trail";
		}else if(window.location.href.match(/\w+\arpm-bootcamp\/certification|arpm-bootcamp\/certification/)){
			active2 = "active-trail";
		} else if(window.location.href.match(/\w+\arpm-bootcamp\/registration|arpm-bootcamp\/registration/)){
			active3 = "active-trail";
		}else if(window.location.href.match(/\w+\arpm-bootcamp\/instructor|arpm-bootcamp\/instructor/)){
			active4 = "active-trail";
		}else if(window.location.href.match(/\w+\arpm-bootcamp\/testimonial|arpm-bootcamp\/testimonial/)){
			active5 = "active-trail";
		}else if(window.location.href.match(/\w+\arpm-bootcamp\/past-courses|arpm-bootcamp\/past-courses/)){
			active6 = "active-trail";
		}else if(window.location.href.match(/\w+\arpm-bootcamp\/faq|arpm-bootcamp\/faq/)){
			active7 = "active-trail";
		}
		if(lng_cookie=='zh-hans')
		{
			return ('<ul class="menu" id="submenu"><li class="expanded active-trail"><ul class="menu" id="submenu-level-3"><li class="leaf first '+active0+'"><a title="概述" href="'+lng_path+'/arpm-bootcamp">概述</a></li><li class="leaf  '+active1+'"><a title="课程" href="'+lng_path+'/arpm-bootcamp/program">课程</a></li><li class="leaf '+active2+'"><a title="证书" href="'+lng_path+'/arpm-bootcamp/certifications">证书</a></li><li class="leaf '+active3+'"><a title="注册" href="'+lng_path+'/arpm-bootcamp/registration">注册</a></li><li class="leaf '+active4+'"><a title="教授／客座教授" href="'+lng_path+'/arpm-bootcamp/instructor">教授／客座教授</a></li><li class="leaf '+active5+'"><a title="推荐" href="'+lng_path+'/arpm-bootcamp/testimonial">推荐</a></li><li class="leaf '+active6+'"><a title="以往课程" href="'+lng_path+'/arpm-bootcamp/past-courses">以往课程</a></li><li class="leaf last '+active7+'"><a class="active" title="常见问答" href="'+lng_path+'/arpm-bootcamp/faq">常见问答</a></li></ul></li></ul>');
		}else{
			return ('<ul class="menu" id="submenu"><li class="expanded active-trail"><ul class="menu" id="submenu-level-3"><li class="leaf first '+active0+'"><a title="Overview" href="'+lng_path+'/arpm-bootcamp">Overview</a></li><li class="leaf '+active1+'"><a  href="'+lng_path+'/arpm-bootcamp/program">Program</a></li><li class="leaf '+active2+'"><a  href="'+lng_path+'/arpm-bootcamp/certifications">Certifications</a></li><li class="leaf '+active3+'"><a  href="'+lng_path+'/arpm-bootcamp/registration">Registration</a></li><li class="leaf '+active4+'"><a  href="'+lng_path+'/arpm-bootcamp/instructor">Instructor / Guests</a></li><li class="leaf '+active5+'"><a  href="'+lng_path+'/arpm-bootcamp/testimonial">Testimonial</a></li><li class="leaf '+active6+'"><a  href="'+lng_path+'/arpm-bootcamp/past-courses">Past Courses</a></li><li class="leaf last '+active7+'"><a class="active" href="'+lng_path+'/arpm-bootcamp/faq">FAQ</a></li></ul></li></ul>');
		}

	}
	else if(window.location.href.match(/\w+\attilio-meucci|attilio-meucci/)){

		var active0="", active1 = "", active2 = "", active3 = "", active4 = "";
        var link=document.location.pathname;
		if(link=='/attilio-meucci'){
		  active0 = "active-trail";
		}
		else if(window.location.href.match(/\w+\attilio-meucci\/resume|attilio-meucci\/resume/)){
			active1 = "active-trail";
		}else if(window.location.href.match(/\w+\attilio-meucci\/events|attilio-meucci\/events/)){
			active2 = "active-trail";
		}else if(window.location.href.match(/\w+\attilio-meucci\/publications|attilio-meucci\/publications/)){
			active3 = "active-trail";
		}else if(window.location.href.match(/\w+\attilio-meucci\/book|attilio-meucci\/book/)){
			active4 = "active-trail";
		}
		if(lng_cookie=='zh-hans')
		{
			return ('<ul class="menu" id="submenu"><li class="expanded active-trail"><ul class="menu" id="submenu-level-3"><li class="leaf first '+ active0 +'"><a title="概述" href="'+lng_path+'/attilio-meucci">概述</a></li><li class="leaf  '+active1+'"><a title="简历" href="'+lng_path+'/attilio-meucci/resume">简历</a></li><li class="leaf '+active2+'"><a title="活动" href="'+lng_path+'/attilio-meucci/events">活动</a></li><li class="leaf '+active3+'"><a title=" 发表文献" href="'+lng_path+'/attilio-meucci/publications"> 发表文献</a></li><li class="leaf last '+active4+'"><a title="书作" href="'+lng_path+'/attilio-meucci/book">书作</a></li></ul></li></ul>');
		}else{
			return ('<ul class="menu" id="submenu"><li class="expanded active-trail"><ul class="menu" id="submenu-level-3"><li class="leaf first '+ active0 +'"><a title="Overview" href="'+lng_path+'/attilio-meucci">Overview</a></li><li class="leaf '+active1+'"><a title="Resume" href="'+lng_path+'/attilio-meucci/resume">Resume</a></li><li class="leaf '+active2+'"><a title="Events" href="'+lng_path+'/attilio-meucci/events">Events</a></li><li class="leaf '+active3+'"><a title="Publications" href="'+lng_path+'/attilio-meucci/publications">Publications</a></li><li class="leaf last '+active4+'"><a title="Book" href="'+lng_path+'/attilio-meucci/book">Book</a></li></ul></li></ul>');

		}


	}
	else if(window.location.href.match(/\w+\events|events/)){

		var active0="", active1 = "", active2 = "";
        var link=document.location.pathname;
		if(link=='/events'){
		  active0 = "active-trail";
		}
		else if(window.location.href.match(/\w+\events\/arpm_bootcamp|events\/arpm_bootcamp/)){
			active1 = "active-trail";
		}else if(window.location.href.match(/\w+\events\/conferences-and-others|events\/conferences-and-others/)){
			active2 = "active-trail";
		}
		if(lng_cookie=='zh-hans')
		{
			return ('<ul class="menu" id="submenu"><li class="expanded active-trail"><ul class="menu" id="submenu-level-3"><li class="leaf first '+ active0 +'"><a title="概述" href="'+lng_path+'/attilio-meucci">概述</a></li><li class="leaf  '+active1+'"><a title="简历" href="'+lng_path+'/attilio-meucci/resume">简历</a></li><li class="leaf '+active2+'"><a title="活动" href="'+lng_path+'/attilio-meucci/events">活动</a></li><li class="leaf '+active3+'"><a title=" 发表文献" href="'+lng_path+'/attilio-meucci/publications"> 发表文献</a></li><li class="leaf last '+active4+'"><a title="书作" href="'+lng_path+'/attilio-meucci/book">书作</a></li></ul></li></ul>');
		}else{
						
		return ('<ul class="menu" id="submenu"><li class="expanded active-trail"><ul class="menu" id="submenu-level-3"><li class="leaf first '+ active1 +'"><a class ="subnav2" title="arpm-bootcamp" href="/events/arpm_bootcamp">ARPM Bootcamp</a></li><li class="leaf last '+active2+'"><a  class ="subnav2"  href="/events/conferences-and-others">Conferences And Others</a></li></ul></li></ul>');
		}
	}
	
else if(window.location.href.match(/\w+\resources|resources/)){

		var active0="", active1 = "", active2 = "";
        var link=document.location.pathname;
		if(link=='/resources'){
		  active0 = "active-trail";
		}
		else if(window.location.href.match(/\w+\resources\/arpm-bootcamp|resources\/arpm-bootcamp/)){
			active1 = "active-trail";
		}else if(window.location.href.match(/\w+\resources\/ssrn-research-paper-series|resources\/ssrn-research-paper-series/)){
			active2 = "active-trail";
		}
		else if(window.location.href.match(/\w+\resources\/linkedin-online-forum|resources\/linkedin-online-forum/)){
			active3 = "active-trail";
		}
		if(lng_cookie=='zh-hans')
		{
			return ('<ul class="menu" id="submenu"><li class="expanded active-trail"><ul class="menu" id="submenu-level-3"><li class="leaf first '+ active0 +'"><a title="概述" href="'+lng_path+'/attilio-meucci">概述</a></li><li class="leaf  '+active1+'"><a title="简历" href="'+lng_path+'/attilio-meucci/resume">简历</a></li><li class="leaf '+active2+'"><a title="活动" href="'+lng_path+'/attilio-meucci/events">活动</a></li><li class="leaf '+active3+'"><a title=" 发表文献" href="'+lng_path+'/attilio-meucci/publications"> 发表文献</a></li><li class="leaf last '+active4+'"><a title="书作" href="'+lng_path+'/attilio-meucci/book">书作</a></li></ul></li></ul>');
		}else{
			return ('<ul class="menu" id="submenu"><li class="expanded active-trail"><ul class="menu" id="submenu-level-3"><li class="leaf first '+ active0 +'"><a class ="subnav1" title="Downloadable Resource" href="/resources">Downloadable Resource</a></li><li class="leaf '+active2+'"><a class ="subnav1" href="/resources/ssrn-research-paper-series" >SSRN Research Paper Series</a></li><li class="leaf last '+active3+'"><a   class ="subnav1"  href="/resources/linkedin-online-forum">LinkedIn Online Forum</a></li></ul></li></ul>');
		}
	}
	
    else{
      return "";
    }

	
	}


function showToolTip(id, value){

	if ( $("input#"+id).val() == "")

		 $("input#"+id).val(value);

	$("input#"+id).focus(function(){

		 if ( $(this).val() == value)

		$(this).val('');

	 });

	 $("input#"+id).blur(function(){

		 if ( $(this).val() == "")

		 $(this).val(value);

	 });

}

function setElement(value){
try{
	if(document.getElementById('edit-registertype-partner-wrapper')){
	if(value == 2){
	document.getElementById('edit-registertype-partner-wrapper').style.display = 'block';
	}else{
		document.getElementById('edit-registertype-partner-wrapper').style.display = 'none';
		document.getElementById('edit-partner-other-wrapper').style.display = 'none';
		document.getElementById('edit-registertype-partner').value = '';
	}
	}
} catch(e){}

}
function dynamicPartnerElement(){
try{
 if(document.getElementById('edit-registertype')){
  setElement(document.getElementById('edit-registertype').value);
  document.getElementById('edit-registertype').onchange = function(){
  setElement(document.getElementById('edit-registertype').value);
  };
 }
   }
	catch(e){

		}
}
function setLangCookie(value){
	if(getLangCookie() != null){
		setLanguageCookie(value, -1);
	}
	setLanguageCookie(value, 60*24);
}
function setLanguageCookie(value, exdays)
{
	var exdate = new Date();
	exdate.setDate(exdate.getDate() + exdays);
	var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()+"; path=/");
	document.cookie = "c_language=" + c_value;
	window.location.href = window.location.href;
}
function getLangCookie()
{
	var value = null;
	var i,x,y,ARRcookies = document.cookie.split(";");
	for (i=0;i<ARRcookies.length;i++)
	{
	  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
	  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
	  x=x.replace(/^\s+|\s+$/g,"");
	  if (x == "c_language"){
			value = unescape(y);
		}
	  }
	  return value;
}

				  
