jQuery(document).ready(function() {
	jQuery("input.b3230type3right[name=f19], input.b3230type3right[name=f20], input.b3230type3right[name=f23], input.b3230type3right[name=f31]").css("width", "102px");
	jQuery('input[name=smsinfo_route_odden_ebeltoft], input[name=smsinfo_route_odden_aarhus]').click(uncheckFollowingCheckboxesForSmsService);
	jQuery('td.ringtone').each(function () {
		var id = jQuery(this).attr('id');
		jQuery(this).find('a').click(function () {
			trackEvent ('ringtone_download', id);
		});
	});
});


function uncheckFollowingCheckboxesForSmsService() {
	var f = this.form;
	if (!f.smsinfo_route_odden_ebeltoft.checked && !f.smsinfo_route_odden_aarhus.checked) {
		f.smsinfo_weekdays.checked = false;
		f.smsinfo_weekend.checked = false;
		f.smsinfo_time_0500_0900.checked = false;
		f.smsinfo_time_0900_1400.checked = false;
		f.smsinfo_time_1400_1900.checked = false;
		f.smsinfo_time_1900_0500.checked = false;						
	}

}

function toggleMailAFriend(query) {
	
	if (jQuery("#MAF").css('display') == 'block') {
		jQuery("#MAF").hide();
		jQuery("#iframe_div").hide();
		
	} else {
		jQuery("#toolsLogin").hide();
		jQuery("#MAF").empty().load('get_maf_form.dsp', {q: query});
		jQuery("#MAF").slideDown(100);	
	}
}

function toggleToolsLogin () {
	if (jQuery("#toolsLogin").css('display') == 'block') {
		jQuery("#toolsLogin").hide();
	} else {
		jQuery("#MAF").hide();
		jQuery("#toolsLogin").slideDown(100);
	}
	
}

function togglePasswordReminder() {
	jQuery("#loginFormTools").toggle();
	jQuery("#passwordreminderForm").toggle();
}

function submitMafForm (f) {
	jQuery("#iframe_div").show();
	f.submit();
}

function openBookingWindow () {
	//var bookingWin = window.open('http://www.booking.mols-linien.dk/book_01.asp', 'bookingWin', 'resizable=1,toolbar=0,location=0,menubar=0,status=0,scrollbars=1,directories=0,width=758,height=583');
	var bookingWin = window.open(booking_url, 'bookingWin', 'resizable=1,toolbar=0,location=0,menubar=0,status=0,scrollbars=1,directories=0,width=758,height=583');
	bookingWin.focus();
}

function openLiniebonusWindow () {
	var liniebonusWin = window.open('http://www.booking.mols-linien.dk/ly03.asp', 'liniebonusWin', 'resizable=1,toolbar=0,location=0,menubar=0,status=0,scrollbars=1,directories=0,width=965,height=800');
	liniebonusWin.focus();
}

function trackEvent (category, action, opt_label, opt_value) {
	if (pageTracker) {
		pageTracker._trackEvent(category, action, opt_label, opt_value);
	}
}

function playVideoWithEventTracking (url, width, height, trackingAction, optionalTrackingCatagory) {
	var w = width || 420;
	var h = height || 215;
	window.open(url, 'ml_vplayer','status=no,location=no,width=' + w + ',height=' + h);
	if (trackingAction) {
		var category = optionalTrackingCatagory || 'videoPlayer';
		trackEvent (category, trackingAction);
	}
	return false;
}

