var mainover=0;
var subover=0;

window.addEvent('domready',function(){
/*******************************collapsible start***************************/
if($defined($('expand_all'))){
$('expand_all').addEvent('click', function(event) {
 		if(this.innerHTML=="Expand All"){
			this.innerHTML="Collapse All";
			$$('#accordion h3.toggler').each(function(el){
				var previousSibling = el.getPrevious('p');
				previousSibling.innerHTML='<img src="'+shwbaseURL+'images/common/icon_expand_close.gif" alt="" />';
				var nextSibling=el.getNext('div');					  
				el.retrieve('nfx').slideIn();
            });
		}else{
			this.innerHTML="Expand All";
			$$('#accordion h3.toggler').each(function(el){
				var previousSibling = el.getPrevious('p');
				previousSibling.innerHTML='<img src="'+shwbaseURL+'images/common/icon_expand_add.gif" alt="" />';
				var nextSibling=el.getNext('div');
				el.retrieve('nfx').slideOut();
            });
		}
		return false;
    });
	var shwi=1;
	$$('#accordion h3.toggler').each(function(el){
        var p = el.getPrevious('p');
		p.innerHTML='<img src="'+shwbaseURL+'images/common/icon_expand_add.gif" alt="" />';
		var n=el.getNext('div');
		el.store('nfx',new Fx.Slide(n));
		if(shwi==1){
			el.retrieve('nfx').slideIn();
			p.innerHTML='<img src="'+shwbaseURL+'images/common/icon_expand_close.gif" alt="" />';
		}else{
			el.retrieve('nfx').slideOut();
		}
		shwi++;
		p.addEvent('click', function(event) {
			this.fireEvent('click');
		}.bind(el));		
   		el.addEvent('click', function(event) {
			var previousSibling = this.getPrevious('p');
			var nextSibling=this.getNext('div');
			var nfx=this.retrieve('nfx');
			if(!nfx.open){
			nfx.slideIn();
				previousSibling.innerHTML='<img src="'+shwbaseURL+'images/common/icon_expand_close.gif" alt="" />';
			}else{
				nfx.slideOut();
				previousSibling.innerHTML='<img src="'+shwbaseURL+'images/common/icon_expand_add.gif" alt="" />';
			}
		}.bind(el));
    });
}
/*******************************collapsible end***************************/

//tips
	var Tips2 = new Tips($$('.shwimg'),{
		offsets:{'x':-70,'y':-40},
		showDelay: 400,
		hideDelay: 400,
		className: 'shwcustom'
	})

	var Tips3 = new Tips($$('.shwtip'),{
		offsets:{'x':-200,'y':15},
		showDelay: 400,
		hideDelay: 400,
		className: 'shwcustom2'
	});
	
	var Tips4 = new Tips($$('.shwtip_2'),{
		offsets:{'x':-400,'y':15},
		showDelay: 400,
		hideDelay: 400,
		className: 'shwcustom3'
	});
	if($defined($('tip1'))){
		$('tip1').store('tip:title', 'Tip 1. Name Format');
		$('tip1').store('tip:text', '<ul class="chatlist"><li>State your family name and given name(s) in whichever order you feel most comfortable. It can be a good idea to underline your family name to avoid any potential confusion.</li><li>If you go by an abbreviated form of your name or a nickname that\'s different to your official name, put this in brackets next to your name.</li></ul>');
		
		$('tip2').store('tip:title', '<b>Tip 2. Inclusion of Photo</b>');
		$('tip2').store('tip:text', '<ul class="chatlist"><li>It is not essential to include a photo in your r&eacute;sum&eacute;. But if you feel comfortable adding one, it generally enhances the document and can also be a helpful way for interviewers to remember you.</li><li>When using a picture make sure it is one where you are professionally attired and avoid casual looking pictures.</li></ul>');
		
		$('tip3').store('tip:title', '<b>Tip 3. Personal Details</b>');
		$('tip3').store('tip:text', '<ul class="chatlist"><li>Include your current address. Indicate clearly if this is a temporary or permanent address.</li><li>Include the phone number on which you are most easily accessible. Don\'t include a number that you rarely answer.</li><li>Include a personal email address. Avoid using a work email address for confidentiality reasons.</li><li>Mention your gender (especially if you have a name that can be used for either a male or female), nationality (and working/residency visa information if applicable) and languages.</li><li>Details such as date of birth, willingness to relocate, ethnicity and marital status are often helpful but not essential.</li></ul>');
		
		$('tip4').store('tip:title', '<b>Tip 4. Career Summary</b>');
		$('tip4').store('tip:text', '<ul class="chatlist"><li>A tightly written statement at the start of your r&eacute;sum&eacute; can help to neatly package up your background and present a clear message to a prospective employer on the direction you intend to take your career.</li><li>If you are using the r&eacute;sum&eacute; for generic applications, be sure that what you write in the Career Summary is as broadly applicable as possible. </li><li>If you wish to stand out for a particular company or position, ensure that your Career Summary has been specifically tailored.</li></ul>');
		
		$('tip5').store('tip:title', '<b>Tip 5. Education </b>');
		$('tip5').store('tip:text', '<ul class="chatlist"><li>For formal education, include the name of the educational establishment, location, years of attendance and grades achieved. </li><li>Extra details such as awards and class rankings can also be mentioned, if outstanding.</li><li>If you want to include details of courses you have completed within a company (for instance \'Two week Leadership Training course at FII\'), include these at the bottom of the r&eacute;sum&eacute; and don\'t mix these with the contents of the Education section. </li></ul>');
		
		$('tip6').store('tip:title', '<b>Tip 6. Professional Experience</b>');
		$('tip6').store('tip:text', '<ul class="chatlist"><li>Always list professional experience in reverse chronological order so that your most recent experience comes first.</li><li>Be sure to break down the various roles that you held within the same company. This is especially important if you were in the same organisation for a long time.</li></ul>');		
		
		$('tip7').store('tip:title', '<b>Tip 7.Company information</b>');
		$('tip7').store('tip:text', '<ul class="chatlist"><li>Include a brief explanation of each company you have worked for, including details such as global and regional headcount, global revenue and perhaps a link to the company website.</li><li>Don\'t forget that your r&eacute;sum&eacute; may be scrutinised by international decision-makers who may not be as familiar with the local or regional landscape as you. </li></ul>');
		
		$('tip8').store('tip:title', '<b>Tip 8. Position within organisational structure</b>');
		$('tip8').store('tip:text', '<ul class="chatlist"><li>As corporate HR structures differ so widely from company to company, it is important to explain how each role fitted into the organisation. When hiring managers look for the right \'cultural fit\' they often look at these details.</li><li>Include information such as the title of the person you report to, a breakdown of the titles of your direct reports and details on your team size, including both direct and indirect reports.</li><li>It is worth also making mention of your peer relationships. For example \'I, along with the Latin America HR Head and the EMEA HR Head, report to the Global Head of HR\'.</li><li>Describe your coverage in detail, including countries covered, total business headcount size, and business revenue information.</li></ul>');
		
		$('tip9').store('tip:title', '<b>Tip 9. Responsibilities &amp; Achievements</b>');
		$('tip9').store('tip:text', '<ul class="chatlist"><li>The clearest r&eacute;sum&eacute;s we see are those that use bullet-points to break down both the key responsibilities and key achievements of the role. Separate these into two sections and be concise. </li><li>Under responsibilities, try to encapsulate both the \'big picture\' and the detail of your role. Restrict yourself to three or four points, with no more than two sentences per point.</li><li>Under achievements, use action-oriented words such as \'created\' or  \'improved\' and where possible quantify your achievements (eg \'achieved a 25% reduction in recruitment costs\').</li></ul>');
		
		$('tip10').store('tip:title', '<b>Tip 10. Reasons for Leaving</b>');
		$('tip10').store('tip:text', '<ul class="chatlist"><li>The most commonly forgotten parts of a r&eacute;sum&eacute; are the reasons for leaving each position.</li><li>A prospective employer will always want to know why you left your previous roles, as these reasons are the best pointers to understanding what keeps you professionally motivated.</li><li>Avoid evasive phrases such as \'Headhunted to join new company\' or vague descriptions like \'Corporate restructuring\'. Use more exact descriptions such as: \'Was not challenged in the role. Left to take up a more senior position with broader regional responsibility.\'</li><li>If a particular reason for leaving a role is best explained face to face rather than on paper (for example because of  acutely personal, family or confidential matters) clearly indicate this below the specific job.</li></ul>');	
		
		$('tip11').store('tip:title', '<b>Tip 11. Dates</b>');
		$('tip11').store('tip:text', '<ul class="chatlist"><li>Do include the exact month in all key dates.</li></ul>');
		
		$('tip12').store('tip:title', '<b>Tip 12. Avoid Abbreviations &amp; Jargon</b>');
		$('tip12').store('tip:text', '<ul class="chatlist"><li>Don\'t be afraid to list detailed information in your CV, but avoid the use of any esoteric terms or abbreviations that may not be widely understood outside your industry or your company. </li><li>In the example r&eacute;sum&eacute;, it would not have been sufficient to use the term \'Project OCT\' under the Senior HR Manager role without a description. But it is acceptable to later use the term \'R&amp;D\' without an explanation, since this is a commonly used abbreviation. </li></ul>');
		
		$('tip13').store('tip:title', '<b>Tip 13. Consistency</b>');
		$('tip13').store('tip:text', '<ul class="chatlist"><li>It is important not to take short-cuts. For example, our r&eacute;sum&eacute; has listed \'Key Responsibilities\' and \'Significant Achievements\' in the two most recent jobs listed, but has not stuck to this format for the rest of the document.</li><li>In this case, the reason is that the author has decided to include more detail for more recent roles than past roles. This in itself is good practice, but care should be taken not to shorten sections at the expense of the quality of the information provided.</li></ul>');
		
		$('tip14').store('tip:title', '<b>Tip 14. Continuous Timeline</b>');
		$('tip14').store('tip:text', '<ul class="chatlist"><li>If there is a gap of more than one month between the end of one role and the beginning of another, always explain the gap. Honesty is the best policy.</li><li>Common reasons include career breaks, full time study and following a spouse overseas. </li></ul>');
		
		$('tip15').store('tip:title', '<b>Tip 15. Expanded details of project work</b>');
		$('tip15').store('tip:text', '<ul class="chatlist"><li>For HR consultants or those who have worked on a project/contract basis, it is a good idea to expand in detail the specifics of key projects that were worked on. </li></ul>');	
		
		$('tip16').store('tip:title', '<b>Tip 16. Availability</b>');
		$('tip16').store('tip:text', '<ul class="chatlist"><li>Include details such as notice period and any other factors that could either bring forward or delay your starting date in a new company.</li></ul>');	
		
		$('tip17').store('tip:title', '<b>Tip 17. Salary</b>');
		$('tip17').store('tip:text', '<ul class="chatlist"><li>Inclusion of salary details is optional, although we advocate that its best not to for reasons of confidentiality.</li><li>If you choose to include, then you should feature the following:</li><li>Fixed Package:<ul><li>Monthly base salary paid over 12 months</li><li>Dates and monthly multipliers of seasonal bonuses (eg Annual Wage Supplement in Singapore, Summer/Winter Bonuses in Japan, Festival Bonuses in Indonesia, etc.)</li> <li>Monthly allowances (eg transport allowances, presumably paid over 12 months)</li><li>Total of the above </li></ul></li><li>Discretionary Bonuses (if applicable):<ul><li>Value of last bonuses paid (including dates), and possible value and date of next bonuses</li></ul></li><li>Long Term Incentives and Other Benefits (if applicable):<ul><li>Include the details of current value of LTIs.</li><li>Only include extra benefits (eg expat benefits such as housing, children\'s tuition) that would materially affect your decision </li></ul></li><li>Salary Expectations - What are you looking for in your next role, and why?</li><li>In English r&eacute;sum&eacute;s it is important to avoid using any local numbering systems (eg \'lakhs\' in India or \'man\' in Japan).</li></ul>');	
		
		$('tip18').store('tip:title', '<b>Tip 18. References</b>');
		$('tip18').store('tip:text', '<ul class="chatlist"><li>For the sake of confidentiality, it is best practice to omit the details of referees on the CV that you distribute publicly.</li><li>If you choose to mention referees, ask anyone looking at your r&eacute;sum&eacute; to gain your permission first before contacting them.</li><li>It is best to have one HR referee (ideally from your direct HR boss) and one business referee (ideally from your key business client), as this will allow the assessor to understand your impact from both sides. </li><li>When specifying referees, include:<ul><li>Name of Referee</li><li>Current Title and Company</li><li>Current Contact Details (Phone &amp; Email)</li><li>Title and Company at the time of working together</li><li>Details of your working relationship</li></ul></li></ul>');	
		
		$('tip19').store('tip:title', '<b>Tip 19. Other Optional Details</b>');
		$('tip19').store('tip:text', '<ul class="chatlist"><li>Other details that we often see on HR r&eacute;sum&eacute;s include personal interests, voluntary work, publications and public appearances, and professional development courses completed.</li><li>When including these details it is important to assess them for relevance. What may be subjectively of interest to one person may turn off another. Be selective. </li></ul>');	
		
	}
		
		
		$('sublink').getElements('ul').setStyle('display', 'none');
		$('sublink').setStyle('display', 'block');
		//$('s1_m').setStyle('display', 'block');
		$$('#mymenu li').each(function(el){
         el.getElement('a').addEvent('mouseover', function(subLinkId){
			var layer = subLinkId+"_m";
				$('sublink').getElements('ul').setStyle('display', 'none');
				if($defined($(layer))){
					$(layer).setStyle('display', 'block');
				}
          }.pass(el.id)
        );      
      });
	  
		
		if($$('#mymenu li a.active_menu').length){
			$$('#mymenu li a.active_menu')[0].addEvent("mouseover",function(){
				//alert('over1');
				this.setStyles({
					background:"#005D9A"
				});
			}.bind($$('#mymenu li a.active_menu')[0]));
		}else{
			if($defined($('active_menu'))){
				$('active_menu').addEvent("mouseover",function(){
				//alert('over2');
					this.setStyles({
						background:"#005D9A"
					});
				}.bind($('active_menu')));
			}
		}
		
		$$('#mymenu li').each(function(el){
				//var elid="s"+i
				
					el.addEvent('mouseover', function(e){
						mainover=1;
						var mya = el.getElement('a');
						if(!(mya.id=="active_menu" || mya.hasClass('active_menu'))){
							var els=$$('#mymenu li a.active_menu');
							if(els.length){
								
								els[0].setStyles({
									background:"none"
								});
							}else{
								
								if($defined($('active_menu'))){
									$('active_menu').setStyles({
										background:"none"
									});
								}
							}
						}
					}.bind(el));
				
				el.addEvent('mouseout', function(e){
					mainover=0;
				}.bind(el));
			});
			if($defined($('sublinkOuter'))){
				$('sublinkOuter').addEvent('mouseover',function(e){
					subover=1;
				});
				$('sublinkOuter').addEvent('mouseout',function(e){
					subover=0;
				});
			}
			if($defined($('active_menu'))){
				(function(){	  
					if((subover==0 && mainover==0)){
						$('sublink').getElements('ul').setStyle('display', 'none');
						$('active_menu').getParents("li").each(function(el){
							if(el.id.length<4 && /s{1}[A-Za-z0-9_]*/.test(el.id)){
								if($defined($(el.id+"_m"))){
									$(el.id+"_m").setStyle('display', 'block');
								}
								
								//reselect the active item
								var els=$$('#mymenu li a.active_menu');
								if(els.length){
									els[0].setStyles({
										background:"#005D9A"
										
									});
								}else{
									$('active_menu').setStyles({
										background:"#005D9A"
										
									});
								}
							}
						});
						$('active_menu').getParents("ul").each(function(el){
							if(el.id.length>=4 ){
								el.setStyle('display', 'block');
								
								
								//reselect the active item.
								var els=$$('#mymenu li a.active_menu');
								if(els.length){
									els[0].setStyles({
										background:"#005D9A"
										
									});
								}else{
									$('active_menu').setStyles({
										background:"#005D9A"
										
									});
								}
							}
						});
	
					}
				 }).periodical(2000);
			}
});
