/*
Copyright (c) 2007 Mediasparx (http://www.mediasparx.com)
Notes: Submeny
*/
$(function() {
$('#submeny').addClass('alt');
$('#subcontent').addClass('alt');
$('#subcontent p').filter(':contains(toppen)').remove();

$('#submeny li a').click(function(){
                this.blur();

				$('div[id="validation"]').remove(); // validation.js
				requiredGroupValue = 0; // validation.js
				$("#validation-no").empty();

                var hash = this.href;
				hash = hash.replace(/^.*.com/, '');
				var hash2 = hash.replace(/#/, '-');
                pageTracker._trackPageview(hash2);
				hash = hash.replace(/^.*#/, '');
				$.historyLoad(hash);
                return false;
            });
$('.more ul').addClass('morelist');
$('.more li a').click(function(){
                this.blur();
                var hash = this.href;
				hash = hash.replace(/^.*.com/, '');
				var hash2 = hash.replace(/#/, '-');
                pageTracker._trackPageview(hash2);
				hash = hash.replace(/^.*#/, '');
				$.historyLoad(hash);
                return false;
            });
$('.change').click(function(){
                this.blur();
                var hash = this.href;
				hash = hash.replace(/^.*.com/, '');
				var hash2 = hash.replace(/#/, '-');
                pageTracker._trackPageview(hash2);
				hash = hash.replace(/^.*#/, '');
				$.historyLoad(hash);
                return false;
            });
$.historyInit(pageload);

});

function pageload(hash) {
//	if (hash.match(/step/i) ) {

//	} else {
	if(hash) {
		temp = "#" + hash;
		$('#submeny li').removeAttr('id');
		var counter = 0;
		while ( temp2 != temp ) {
			var temp2 = $('#submeny li:eq('+counter+')').children().attr('href');
			temp2 = temp2.substring(temp2.indexOf('#'));
		    counter++;
		}
		counter--;
		$('#submeny li:eq('+counter+')').attr('id', 'submenyselected');
		$('#subcontent div.sub').hide();
		$('#subcontent div.sub:eq('+counter+')').fadeIn('slow');
	} else {
		$('#submeny li').removeAttr('id');
		$('#submeny li:eq(0)').attr('id', 'submenyselected');
		$('#subcontent div.sub').hide();
		$('#subcontent div:eq(0)').fadeIn('slow');
	}
//	}
	return false;
}
