// Centralized Conversion Tracking Utilities for Classic Motorworks

// Prevent duplication
if ('function' != typeof(window.cs_conversion)) {
	
	// DOM inclusions function
	function cs_include_js(script_filename) {
		
		var head_tag = document.getElementsByTagName('head').item(0);
		var script_tag = document.createElement('script');
		
		script_tag.setAttribute('type', 'text/javascript');
		script_tag.setAttribute('language', 'javascript');
		script_tag.setAttribute('src', script_filename);
		
		return head_tag.appendChild(script_tag);
		
	}
	
	// Static inclusion function
	function cs_include_stat(script_filename) {
		document.write('<' + 'script');
		document.write(' language="javascript"');
		document.write(' type="text/javascript"');
		document.write(' src="' + script_filename + '">');
		document.write('</' + 'script' + '>');
	}
	
	// Discover conversion variables that we may have set elsewhere in the document
	function cs_conversion(c_type, c_value) {
		
		google_conversion_label = c_type;
		google_conversion_value = c_value;
		if (use_https) cs_include_js(aw_js_ssl);
		else cs_include_js(aw_js_std);
		
	}
	
	// AdWords conversion script locations
	var aw_js_std = "http://www.googleadservices.com/pagead/conversion.js";
	var aw_js_ssl = "https://www.googleadservices.com/pagead/conversion.js";
	
	// Default AdWords conversion tracking information
	var google_conversion_id = 1070830394;
	var google_conversion_language = "en_US";
	var google_conversion_format = "1";
	var google_conversion_color = "FFFFFF";
	var google_conversion_value = "0";
	var google_conversion_label = "default";
	
	// Determine wether or not HTTPS is needed in script calls
	var use_https = false;
	if (window.location.protocol == 'https:') use_https = true;
	
}