$(document).ready(function(){
	if(window.location.href.indexOf('faq') != -1){
		var hashTable = {
			'faq' : 1,
			'dobór' : 2,
			'dobor' : 2,
			'dobór_kolorów' : 2,
			'dobor_kolorow' : 2
		};
		
		var section = '';
		if(
		   (window.location.hash != "") &&
		   (window.location.hash.substr(0,1) == "#") &&
		   (section = window.location.hash.split('#')[1]) &&
		   (section = section.toLowerCase()) &&
		   hashTable.hasOwnProperty(section)
		){
			WALLYShowContent(hashTable[section]);
		}
	}
  
else if(window.location.href.match('\/p[0-9]+\,') != null){
		// -- Switch tab only on 
		var hashTable = {
			'opis' : 1,
			'kolory' : 2
		};
		
		var section = '';
		if(
		   (window.location.hash != "") &&
		   (window.location.hash.substr(0,1) == "#") &&
		   (section = window.location.hash.split('#')[1]) &&
		   (section = section.toLowerCase()) &&
		   hashTable.hasOwnProperty(section)
		){
			WALLYShowContent(hashTable[section]);
		}
	}
	
	else if(window.location.href.indexOf('instrukcje') != -1){
		var hashTable = {
			'naklejki' : 1,
			'szablony' : 2,
			'fototapety' : 3
			
		};
		
		var section = '';
		if(
		   (window.location.hash != "") &&
		   (window.location.hash.substr(0,1) == "#") &&
		   (section = window.location.hash.split('#')[1]) &&
		   (section = section.toLowerCase()) &&
		   hashTable.hasOwnProperty(section)
		){
			WALLYShowContent(hashTable[section]);
		}
	}
	
});

function WALLYShowContent(no){               
        if(!(no >= 0))
			return false;
		
		var x = 1;
		while(
			(obj = document.getElementById('WALLY-content'+x)) &&
			(typeof(obj) != 'undefined') &&
			(typeof(obj.style) != 'undefined')
		){
			if(x == no){
				obj.style.display = 'block';
				if((obj2 = document.getElementById('WALLYMenuItem'+x)) && typeof(obj2) != 'undefined'){
					obj2.className = 'active';

				}
			}else{
				obj.style.display = 'none';
				if((obj2 = document.getElementById('WALLYMenuItem'+x)) && typeof(obj2) != 'undefined'){
					obj2.className = '';

				}
			}
			
			x++;
		}
		
		return false;
}	
