/* 
	HNZC 2006
	Master Script
	Last Updated 060906
*/

//	FUNCTIONS

//	function handleError() 
//	{
//		return true;
//	}
	
//	window.onerror = handleError;
	
//	EDITABLE VARIABLES

	// Flash Content
	var global_flash_file_path = '/hnzc/flash/web/';
	var global_add_flash_file_extension = true; // add .swf automatically, without specifying as part of the file path
	var global_required_flash_version = 6;	
	var global_latest_flash_version = 11;	
	
	// Default Low Script Redirect Page - Where can the user go if their browser does not support generated content?
	var global_default_lowscript_redirect_page_url = '/contact-us.cfm';	// Where can I get alternative content? eg '/contact-us.cfm' (set to '' to remove alternative content link)
	var global_default_lowscript_redirect_page_action = 'Contact Us'; // What action does this require? eg 'Contact Us'
		
//	IMPORT JAVASCRIPT FILES

	var scripts = new Array();
	
	scripts[0] = 'generic_browserdetect.js';	
	scripts[1] = 'generic_flash.js';
	scripts[2] = 'generic_forms.js'; 
	scripts[3] = 'generic_printbutton.js';
	scripts[4] = 'generic_styleswitcher.js';
	
	scripts[5] = 'hnzc_map.js';
	scripts[6] = 'hnzc_popup_titles.js';
	scripts[7] = 'hnzc_styleswitcherbuttons.js';	
	
	var imported_scripts = '';
	
	for (var i=0; i<scripts.length; i++)
	{
		imported_scripts += ('\n<script type="text/javascript" src="/hnzc/js/web/imported/' + scripts[i] + '"></script>');
	}
	
	imported_scripts += ('\n');

	// write imported files to page head
	document.write(imported_scripts);		

/*	INIT - AFTER PAGE LOAD */
	
	function init()
	{
		// 	060906 - HiFi check moved up to here for IE4
		//	This voids the low browser check for non-Flash content,
		//	but this is no longer required anyway as there is now non-Flash content
		if (whichbrowser.isHiFi)
		{
			add_print_tool('hnz', 'Print');
	
			generate_resize_buttons();
			
			applyResize();	

			var shell = document.getElementsByTagName('table')[0].getElementsByTagName('div')[0];
			
			if ((shell.id == 'flash') || (shell.id == 'form')) // all flash movies require 'wide' template
			{
				var main_divs = document.getElementById('main-content').getElementsByTagName('div');
				
				var flashwrapper = '';
				
				for (i=0; i<main_divs.length; i++)
				{
					if (main_divs[i].className == 'flash')
					{
						flashwrapper = main_divs[i];
					}
				}
				
				if ((flashwrapper != '') && (flashwrapper.id != 'contact-form-map'))
				{			
				//	generateFlash(flashContainerID, flashFileName, global_specific_noflash_flash_content_action, global_specific_noflash_flash_content_name, flashWidth, flashHeight, flashParamName, flashParamValue, markupBefore, markupAfter, global_specific_noflash_redirect_page_url, global_specific_noflash_redirect_page_action)				
					generateFlash(flashwrapper.id, flashwrapper.id, '', '', 674, 363, '', '', '', '', '', '');					
				}
				else if ((flashwrapper != '') && (flashwrapper.id == 'contact-form-map'))
				{					
					generateFlash(flashwrapper.id, flashwrapper.id, '', '', 212, 292, '', '', '', '', '', '');					
				}				
			}
			else if (shell.id == 'form')
			{
				create_regions_map();
			}
		}
	}	
	
	window.onload = init;	
