/**
 * Asyncronously lazy load libraries as required.
 * This file is separate to init.js so that it blocks init just long enough for the dependencies to be ready.
 */

// only load qgov.js if not already loaded
	if (typeof qg === 'undefined' || typeof qg.swe.scriptsLoaded === 'undefined') {
		document.write(unescape('%3Cscript src="'+qg.swe.paths.assets+'script/qgov.js"%3E%3C/script%3E'));
	}

// only load qgov-forms.js if a required field exists (test that validation is required)
	if (( !! qg.swe.load.formValidation ) || $( 'input[required], select[required], textarea[required]' ).length > 0 ) {
		document.write(unescape('%3Cscript src="'+qg.swe.paths.assets+'script/qgov-forms.js"%3E%3C/script%3E'));
	}

// only load video files if a video exists on the page
	if ($('.qg-ovt').length > 0) {
		document.write(unescape('%3Cscript src="'+qg.swe.paths.assets+'script/qgov-video.js"%3E%3C/script%3E'));
		document.write(unescape('%3Clink type="text/css" rel="stylesheet" href="'+qg.swe.paths.assets+'style/qgov-video.css" /%3E'));
	}
	
	if ($('script[src*="jquery.min.js"]').length === 0) {
		$.debug('loading');
	}
