function dbg(str) {
	if(typeof(console) != 'undefined') {
		console.debug(str);
		}
	}

$(document).ready(function() {
	$(':text, :password').addClass('text');
	$(':button, :reset, :submit').addClass('button');
	$('#menu ul li ul').wrap('<div></div>');
	mfw = $('#footmenu > ul').outerWidth();
	$('#footmenu > ul > li').each(function() {
		mfw = mfw - $(this).width();
		});
	mfl = $('#footmenu > ul > li').length - 1;
	mfm = Math.floor(mfw/mfl);
	$('#footmenu > ul > li').css({marginRight:mfm});
	$('#footmenu > ul > li:last-child').css({marginRight:0});

	$('#navi > .pad > ul > li:last-child').css('margin-bottom', 0);

	$('#navi ul ul ul').wrap('<div></div>');

	if($('#promor').length) {
		$('#promor').nivoSlider({
			effect:'fade',
			animSpeed:500,
			slices:1,
			pauseTime:3500,
			directionNav:0,
			controlNav:0
			});
		}
	if($('#promor-farright').length) {
		$('#promor-farright').nivoSlider({
			effect:'fade',
			animSpeed:500,
			slices:1,
			pauseTime:3500,
			directionNav:0,
			controlNav:0
			});
		}

	if($.browser.msie) {
		$('#menu > ul > li').hover(
			function() {$(this).addClass('hover')},
			function() {$(this).removeClass('hover')}
			);
		}

	//~ $('#navi ul > li> ul > li').hover(
		//~ function() {$(this).addClass('hover')},
		//~ function() {$(this).removeClass('hover')}
		//~ );

	//~ n = document.location.href;
	//~ $('#navi a').each(function() {
		//~ l = this.href;
		//~ if(l.indexOf("www.vectonemobile.co.uk") > -1) {
			//~ l = l.replace(/https?:\/\/www\.vectonemobile\.co\.uk/i, "http://192.168.1.70/vectonemobileuk_v3");
			//~ }
		//~ if(l == n) {
			//~ $(this).parent('li').addClass('active');
			//~ $(this).parent().parent().parent().parent().addClass('active');
			//~ }
		//~ });

	if(document.domain == '192.168.1.70') {
		$('a').each(function() {
			l = this.href;
			if(l.indexOf("www.vectonemobile.ch") > -1) {
				r = l.replace(/https?:\/\/www\.vectonemobile\.ch/i, "http://192.168.1.70/VMCH.Website");
				$(this).attr({href:r,title:'LIVE: '+l});
				}
			});
		}

	if($('.SuperGeniusLoginBox').length > 0) {
		$('<div>',{id:'SuperGeniusLoginMask'}).appendTo('body');
		$('a.SuperGeniusLoginButton').click(function(e) {
				e.preventDefault();
				b = $(this).parent().find('.SuperGeniusLoginBox');
				if($(b).is(':hidden')) {
					b.fadeIn(100);
					$('#SuperGeniusLoginMask').show();
					}
				else {
					b.fadeOut(100);
					$('#SuperGeniusLoginMask').hide();
					}
				}
			);
		$('#SuperGeniusLoginMask').click(function() {
			$('.SuperGeniusLoginBox').fadeOut();
			$('#SuperGeniusLoginMask').hide();
			});
		}


	});

$(window).ready(function() {
	});
