/**** Window Load Functions ****/
window.onload = function()
{
	if(window.bjs_debugger_flag != undefined)
		ob_win_bjs = new JS_Debug();

	ob_win_eff = new WindowEffects();
	ob_bro_det = new BrowserDetails();

	if(window.popup_window_flag != undefined)
		ob_win_eff.PopUpsInit();
		// <a href="page.html" class="open_popup" rel="normal">
		// 	or
		// <a href="page.html" class="open_popup" rel="450x350">

	if(window.page_form_flag != undefined)
	{
		ob_for_eff = new FormEffects();
		
		if(window.copy_form_fields_flag != undefined)
			ob_for_eff.CopyFormFieldsInit();

		if(window.check_all_flag != undefined)
			ob_for_eff.CheckAllInit();
			
		if(window.click_fields != undefined)
			ob_for_eff.ClickFieldsInit();
			
		if(window.clear_fields_flag != undefined)
			ob_for_eff.ClearFormFields();
			
		if(window.clear_fields_submit_flag != undefined)
			ob_for_eff.ClearFormAndSubmitInit();
		
		if(window.required_fields_flag != undefined)
		{
			ob_for_eff.RequiredFieldsInit();
			ob_for_eff.FormSubmitInit();
		}
		
		if(window.redirect_validate_flag != undefined)
			ob_for_eff.RedirectValidateInit();
	}

	if(window.toggle_display_flag != undefined)
		ob_win_eff.ToggleDisplayInit();
		// Only works on toggling block elements for now

	if(window.flip_display_flag != undefined)
		ob_win_eff.FlipDisplayInit();
		// Only works on toggling block elements for now
		
	if(window.toggle_tabs_flag != undefined)
	{
		var current_tab_sets = window.toggle_tabs_flag.split("|");
		for(var i=0; i < current_tab_sets.length; i++)
			ob_win_eff.ToggleTabsInit(current_tab_sets[i]);
	}

	// drag and drop application
	if(window.drag_drop_flag != undefined)
	{
		ob_dnd = new DragAndDrop();
		
		var dnd_boxes = window.drag_drop_flag.split("|");
		for(var i=0; i < dnd_boxes.length; i++)
		{
			ob_dnd.CreateDragContainer(document.getElementById(dnd_boxes[i]));
			ob_dnd.UpdateHiddenField(dnd_boxes);
		}
	}

	if(window.confirm_click_flag != undefined)
		ob_win_eff.ConfirmClickInit();
		// <a href="page.html" class="confirm_click" title="Confirm message here?">
		// <input type="submit" name="whatever" value="" class="confirm_click" title="Confirm message here?">

	if(window.print_onload_flag != undefined)
		window.print();

	if(window.lightbox_flag != undefined)
		initLightbox();

	// add to textarea class -- be_editor
	if(window.be_enabled_flag != undefined)
	{
		if(ob_bro_det.is_safari)
		{
			alert("Support for Safari is not yet enabled");
		}
		else
		{
			ob_be_cleaner = new BourbonEditorCode();
			ob_be = new BourbonEditor();		
			ob_be.LoadBourbonEditors();
		}
		
		//this_be = ajaxBe();
		//this_be.initAjaxBe();
	}
	
	if(window.menu_hovers_flag != undefined && ob_bro_det.is_msie === true)
		ob_win_eff.SetMenuHoversInit('site_nav_menu');
		
		
	/* if(window.resize_div_height != undefined)
	{
		ob_win_eff.GetViewPort();
		section_wrapper_shadow_nh = ob_win_eff.page_y - 20;
		setTimeout("ob_win_eff.SetElementHeight('section_wrapper_shadow', section_wrapper_shadow_nh)", 100);
	} */
}



/**** Visitor Browser ****/
function BrowserDetails()
{
	this.ua = navigator.userAgent;
	
	this.match_opera = "Opera";
	this.is_opera = false;
	
	this.match_gecko = "Gecko";
	this.is_gecko = false;
	
	this.match_msie = "MSIE";
	this.is_msie = false;
	
	this.match_msie7 = "MSIE 7";
	this.is_msie7 = false;
	
	this.match_safari = "Safari";
	this.is_safari = false;
	
	if(this.ua.match(this.match_opera))
		this.is_opera = true;
		
	else if(this.ua.match(this.match_gecko))
		this.is_gecko = true;
		
	else if(this.ua.match(this.match_msie))
	{
		this.is_msie = true;
		if(this.ua.match(this.match_msie7))
		{
			this.is_msie7 = true;
			this.is_msie = false;
		}
	}
	
	else if(this.ua.match(this.match_safari))
		this.is_safari = true;

	
	return this;
}

