function gotoWork(url) {
	window.location.href = url;	
	checkRedirect();
}

function checkRedirect() {
	var uri = window.location.href;
	var uri_arr = uri.split("#");
	
	if (uri_arr.length > 1) {
		var uri_str = uri_arr[1];
		uri_arr = uri_str.split("/");
		
		if (uri_arr.length > 0) {		
			switch (uri_arr[1]) {
				case 'work':
					//alert("uri_arr.length: " + uri_arr.length);
					if (uri_arr.length == 4) {
						setContentHTML('works/contents_menu.php?cl='+uri_arr[2], 'content_03');
					} else {
						setContentHTML('works/contents_direct.php?cl='+uri_arr[2]+'&p='+uri_arr[3]+'&c='+uri_arr[4], 'content_03', true);
					}
					break;
					
				case 'contact':
					if (uri_arr[2] == 'headquarters') {
						resetBtnStyles();
						
						myM2_2.hide();
						myM2_3.hide();
						myM2_6.hide();
						myM2_8.show();
						$('m1_8').className='m_item_active';
		
						$('m1_8').className='m_item_active';
						$('m2_8_1').className='m2_item_active';
						window.location.href = '#/contact/headquarters/';
						document.title = "Headquarters | Contact | Woonky";
						setContentHTML('contents/headquarters.html', 'content_02');
					} else if (uri_arr[2] == 'talk_to_us') {
						//alert('contact_form');
						resetBtnStyles();
						
						myM2_2.hide();
						myM2_3.hide();
						myM2_6.hide();
						myM2_8.show();
						$('m1_8').className='m_item_active';
						
						$('m1_8').className='m_item_active';
						$('m2_8_2').className='m2_item_active';
						window.location.href = '#/contact/talk_to_us/';
						document.title = "Talk to us | Contact | Woonky";
						setContentHTML('contents/contact_form.html', 'content_02');
					} else {
						myM2_2.hide();
						myM2_3.hide();
						myM2_6.hide();
						myM2_8.hide();
						$('m1_1').className='m_item_activeb';
						window.location.href = '#/hello/';
						setContentHTML('contents/hello.php', 'content_01');	
					}
					break;
					
				case 'follow_us':
					resetBtnStyles();
					myM2_2.hide();
					myM2_3.hide();
					myM2_6.hide();
					myM2_8.hide();
					$('m1_7').className='m_item_activeb';
					window.location.href = '#/follow_us/';
					document.title = "Follow Us | Woonky";
					setContentHTML('contents/followus.html', 'content_01');
					break;
					
				case 'clients':
					resetBtnStyles();
					myM2_2.hide();
					myM2_3.hide();
					myM2_6.hide();
					myM2_8.hide();
					$('m1_5').className='m_item_activeb';
					window.location.href = '#/clients/';
					document.title = "Clients | Woonky";
					setContentHTML('contents/clients.html', 'content_01');
					break;
					
				case 'services':
					resetBtnStyles();
					myM2_2.hide();
					myM2_3.hide();
					myM2_6.hide();
					myM2_8.hide();
					$('m1_4').className='m_item_activeb';
					window.location.href = '#/services/';
					document.title = "Services | Woonky";
					setContentHTML('contents/services.html', 'content_01');
					break;
					
				case 'who_we_are':
					if (uri_arr[2] == 'marcelo_dabramo') {
						resetBtnStyles();
						
						myM2_3.show();
						myM2_2.hide();
						myM2_6.hide();
						myM2_8.hide();
						$('m1_3').className='m_item_active';
		
						$('m1_3').className='m_item_active';
						$('m2_3_1').className='m2_item_active';
						window.location.href = '#/who_we_are/marcelo_dabramo/';
						document.title = "Marcelo D'Abramo | Who We Are | Woonky";
						setContentHTML('contents/marcelo_dabramo.html', 'content_02');
					} else if (uri_arr[2] == 'tomas_wells') {
						resetBtnStyles();
						
						myM2_3.show();
						myM2_2.hide();
						myM2_6.hide();
						myM2_8.hide();
						$('m1_3').className='m_item_active';
						
						$('m1_3').className='m_item_active';
						$('m2_3_2').className='m2_item_active';
						window.location.href = '#/who_we_are/tomas_wells/';
						document.title = "Tomas Wells | Who We Are | Woonky";
						setContentHTML('contents/tomas_wells.html', 'content_02');
					} else if (uri_arr[2] == 'patricio_cavalli') {
						resetBtnStyles();
						
						myM2_3.show();
						myM2_2.hide();
						myM2_6.hide();
						myM2_8.hide();
						$('m1_3').className='m_item_active';
						
						$('m1_3').className='m_item_active';
						$('m2_3_3').className='m2_item_active';
						window.location.href = '#/who_we_are/patricio_cavalli/';
						document.title = "Patricio Cavalli | Who We Are | Woonky";
						setContentHTML('contents/patricio_cavalli.html', 'content_02');
					} else if (uri_arr[2] == 'ramiro_delgado') {
						resetBtnStyles();
						
						myM2_3.show();
						myM2_2.hide();
						myM2_6.hide();
						myM2_8.hide();
						$('m1_3').className='m_item_active';
						
						$('m1_3').className='m_item_active';
						$('m2_3_4').className='m2_item_active';
						window.location.href = '#/who_we_are/ramiro_delgado/';
						document.title = "Ramiro Delgado | Who We Are | Woonky";
						setContentHTML('contents/ramiro_delgado.html', 'content_02');
					} else if (uri_arr[2] == 'the_woonkies') {
						resetBtnStyles();
						
						myM2_3.show();
						myM2_2.hide();
						myM2_6.hide();
						myM2_8.hide();
						$('m1_3').className='m_item_active';
						
						$('m1_3').className='m_item_active';
						$('m2_3_5').className='m2_item_active';
						window.location.href = '#/who_we_are/the_woonkies/';
						document.title = "The Woonkies | Who We Are | Woonky";
						setContentHTML('contents/the_woonkies.html', 'content_02');
					} else {
						$('m1_1').className='m_item_activeb';
						window.location.href = '#/hello/';
						setContentHTML('contents/hello.php', 'content_01');	
					}
					break;
					
				case 'about_us':
					if (uri_arr[2] == 'vision') {
						resetBtnStyles();
						
						myM2_3.hide();
						myM2_2.show();
						myM2_6.hide();
						myM2_8.hide();
						$('m1_2').className='m_item_active';
		
						$('m1_2').className='m_item_active';
						$('m2_2_1').className='m2_item_active';
						window.location.href = '#/about_us/vision/';
						document.title = "Vision | About Us | Woonky";
						setContentHTML('contents/vision.html', 'content_02');
					} else if (uri_arr[2] == 'our_dna') {
						resetBtnStyles();
						
						myM2_3.hide();
						myM2_2.show();
						myM2_6.hide();
						myM2_8.hide();
						$('m1_2').className='m_item_active';
						
						$('m1_2').className='m_item_active';
						$('m2_2_2').className='m2_item_active';
						window.location.href = '#/about_us/our_dna/';
						document.title = "Our DNA | About Us | Woonky";
						setContentHTML('contents/our_dna.html', 'content_02');
					} else if (uri_arr[2] == 'beliefs') {
						resetBtnStyles();
						
						myM2_3.hide();
						myM2_2.show();
						myM2_6.hide();
						myM2_8.hide();
						$('m1_2').className='m_item_active';
						
						$('m1_2').className='m_item_active';
						$('m2_2_3').className='m2_item_active';
						window.location.href = '#/about_us/beliefs/';
						document.title = "Beliefs | About Us | Woonky";
						setContentHTML('contents/beliefs.html', 'content_02');
					} else if (uri_arr[2] == 'woonky_group') {
						resetBtnStyles();
						
						myM2_3.hide();
						myM2_2.show();
						myM2_6.hide();
						myM2_8.hide();
						$('m1_2').className='m_item_active';
						
						$('m1_2').className='m_item_active';
						$('m2_2_4').className='m2_item_active';
						window.location.href = '#/about_us/woonky_group/';
						document.title = "Woonky Group | About Us | Woonky";
						setContentHTML('contents/woonky_group.html', 'content_02');
					} else {
						$('m1_1').className='m_item_activeb';
						window.location.href = '#/hello/';
						setContentHTML('contents/hello.php', 'content_01');	
					}
					break;
				
				default: 
					myM2_2.hide();
					myM2_3.hide();
					myM2_6.hide();
					myM2_8.hide();
					$('m1_1').className='m_item_activeb';
					window.location.href = '#/hello/';
					setContentHTML('contents/hello.php', 'content_01');	
					break;
			}
		} else {
			myM2_2.hide();
			myM2_3.hide();
			myM2_6.hide();
			myM2_8.hide();
			$('m1_1').className='m_item_activeb';
			window.location.href = '#/hello/';
			setContentHTML('contents/hello.php', 'content_01');		
		}
	} else {
		myM2_2.hide();
		myM2_3.hide();
		myM2_6.hide();
		myM2_8.hide();
		$('m1_1').className='m_item_activeb';
		window.location.href = '#/hello/';
		setContentHTML('contents/hello.php', 'content_01');		
	}
}

function goToSection(section)
{
	var url = '#/' + section;	
	
	window.location.href = url;
	
	checkRedirect();
}
