	function setFormLogin(type) {
		switch(type) {
			case 'tyres':
				$('#lFormForm').attr('action', 'http://85.234.249.1/dotcube/dotcube.cgi?cube.action=login&cube.gateway=CGI150');
				$('#lFormUser').attr('name', 'gebruiker');
				$('#lFormPass').attr('name', 'wachtwoord');
			break;
			
			case 'parts':
				$('#lFormForm').attr('action', 'http://start.mijngrossier.nl/login/Default.aspx');
				$('#lFormUser').attr('name', 'txtLogin');
				$('#lFormPass').attr('name', 'txtPassword');
				$('#lFormSubmit').attr('name', 'btn');
			break;				
	
			case 'webms':
				$('#lFormForm').attr('action', 'http://www.rvwebms.nl/RVWebMS2/index.php');
				$('#lFormUser').attr('name', 'form_username');
				$('#lFormPass').attr('name', 'form_password');
				$('#lFormSubmit').attr('name', 'submit');
			break;				
		}
	}
	
	
	

	var startTweetsAnim = function(selector) {
		$(selector).hide();
		animTweets(selector);	
	}
		
	var animTweets = function(selector, no) {
		$tweets = $(selector);
		if(!no || no > $tweets.length-1) no = 0;
		$tweets.slideUp('fast').eq(no).show();
		no++;
		setTimeout("animTweets('" + selector + "', " + no + ");",15000);
	}
	
	$(document).ready(function(){
	   
		var myClose = function(hash){
		   hash.w.animate({
				left: '-1000'
			}, 500, function() {
				hash.o.fadeOut('500', function(){
					hash.o.remove();
				});
			});
		};
		
		startTweetsAnim('.tweets .tweet');
		
		var openInIframe = function(hash){
			var newWidth = 0, newHeight = 0, newLeft = 0, newTop = 0;
			var $trigger = $(hash.t);
			var $modal = $(hash.w);
			var myUrl = $trigger.attr('href');
			var myTitle = $trigger.attr('title');
			var $modalContent = $("iframe", $modal);
			
			$modalContent.html('').attr('src', myUrl);
			//let's use the anchor "title" attribute as modal window title
			$('#jqmTitleText').text(myTitle);
			
			myUrl = (myUrl.lastIndexOf("#") > -1) ? myUrl.slice(0, myUrl.lastIndexOf("#")) : myUrl;
			var queryString = (myUrl.indexOf("?") > -1) ? myUrl.substr(myUrl.indexOf("?") + 1) : null;
			
			if (queryString != null && typeof queryString != 'undefined') {
				var queryVarsArray = queryString.split("&");
				for (var i = 0; i < queryVarsArray.length; i++) {
					if (unescape(queryVarsArray[i].split("=")[0]) == 'width') {
						var newWidth = queryVarsArray[i].split("=")[1];
					}
					if (escape(unescape(queryVarsArray[i].split("=")[0])) == 'height') {
						var newHeight = queryVarsArray[i].split("=")[1];
					}
				}
				// let's run through all possible values: 90%, nothing or a value in pixel
				if (newHeight != 0) {
					if (newHeight.indexOf('%') > -1) {
						newHeight = Math.floor(parseInt($(window).height()) * (parseInt(newHeight) / 100));
					}
					var newTop = Math.floor(parseInt($(window).height() - newHeight) / 2);
				}
				else {
					newHeight = $modal.height();
				}
				if (newWidth != 0) {
					if (newWidth.indexOf('%') > -1) {
						newWidth = Math.floor(parseInt($(window).width() / 100) * parseInt(newWidth));
					}
					var newLeft = Math.floor(parseInt($(window).width() / 2) - parseInt(newWidth) / 2);
					
				}
				else {
					newWidth = $modal.width();
				}
				// do the animation so that the windows stays on center of screen despite resizing
				
				$modal.jqmShow().animate({
					width: newWidth,
					height: newHeight,
					top: newTop,
					left: newLeft,
					marginLeft: 0
				}, 1000);
			}
			
			else {
				// don't do animations
				$modal.jqmShow();
			}
			
		}
		
		$('#modalWindow').jqm({
			//modal: true,
			trigger: 'a.thickbox',
			target: '#jqmContent',
			onHide: myClose,
			onShow: openInIframe
		});
		
		$('a:contains(Contact), a:contains(contact)')
			.attr('href', 'javascript:void(0)')
			.click( function() { 
				$.scrollTo( '#subfoot', 800, { onAfter: function() {
				//		$('.f2').effect("bounce", { times: 3 }, 200);
						$('.f2').effect("pulsate", { times: 2 });
					}
				});
		});
		
		$('#informatie').effect("pulsate", { times: 2 });

		
		$('a[@href="20/"]').attr('href', "autostyle-catalogus/");
		$('#footer').click( function() { $.scrollTo('a[name="top"]', 800); });
		
		$('#pg_news .subtitle').each( function() {
			nDate = $(this).text().substr( ($(this).parent().parent().attr("id") == "newsarticle") ? "7" : "0" ,'10' ).split('-');
			$(this).html(nDate['2'] + '-' + nDate['1'] + '<br /><small>' + nDate['0'] + '</small>');
		});
		setTimeout("$('.wheels').animate({ marginTop: '-=70px' }, 1300);",0);
		
	//	$('#footer').after('<div class="pageCorner"><a href="/vacatures/"><img src="images/gezocht_corner.png"></a></div>');
	});

