/**** Window Effects ****/
function WindowEffects()
{
	this.PopUpsInit = function()
	{
		var match_class = "open_popup";
		var kids = document.getElementsByTagName("A");
		
		for(var i=0; i < kids.length; i++)
		{
			if(kids[i].className.match(match_class))
				kids[i].onclick = this.PopUpClick;
		}
	}
		this.PopUpClick = function()
		{
			if(this.rel == "normal")
			{
				new_window = window.open(this.href, 'newWin');
			}
			else
			{
				var win_dims = this.rel.split('x');
				window_options = 'toolbar=no,location=no,resizable=yes,scrollbars=yes,menubar=no,width=' + win_dims[0] + ',height=' + win_dims[1];
				new_window = window.open(this.href, 'newWin', window_options);
			}

			return false;
		}
	
	
	this.ConfirmClickInit = function()
	{
		var match_class = "confirm_click";
		var kids = document.getElementsByTagName("*");
		
		for(var i=0; i < kids.length; i++)
		{
			if(kids[i].className.match(match_class))
				kids[i].onclick = this.ConfirmClick;
		}
	}
		this.ConfirmClick = function()
		{
			if(confirm(this.title))
				return true;
			else
				return false;
		}

	
	this.ToggleDisplayInit = function()
	{
		var match_class = "toggle_display";
		var kids = document.getElementsByTagName("A");
		
		for(var i=0; i < kids.length; i++)
		{
			if(kids[i].className.match(match_class))
				kids[i].onclick = this.ToggleDisplay;
		}
	}
		this.ToggleDisplay = function()
		{
			// Only works on toggling block and table-rows elements for now
			var toggle_this = this.id.split(".");
			var toggle_this_switch_on = document.getElementById(toggle_this[0] + ".inline");
			var toggle_this_switch_off = document.getElementById(toggle_this[0] + ".none");
			var toggle_this_content = document.getElementById(toggle_this[0]);
					
			var match_inline = /inline/;
			var replace_inline = "inline";
			
			var match_none = /none/;
			var replace_none = "none";
			
			if(this.rel = "table-row")
				var match_block = "table-row";
			else
				var match_block = "block";
			
			
			if(this.rel == "table-row")
				var replace_block = "table-row";
			else
				var replace_block = "block";

			if(toggle_this_switch_on.className.match("inline"))
			{
				toggle_this_switch_on.className = toggle_this_switch_on.className.replace(match_inline, replace_none);
				toggle_this_switch_off.className = toggle_this_switch_off.className.replace(match_none, replace_inline);
				toggle_this_content.className = toggle_this_content.className.replace(match_block, replace_none);
			}
			else
			{
				toggle_this_switch_on.className = toggle_this_switch_on.className.replace(match_none, replace_inline);
				toggle_this_switch_off.className = toggle_this_switch_off.className.replace(match_inline, replace_none);
				toggle_this_content.className = toggle_this_content.className.replace(match_none, replace_block);
			}

			return false;
		}
		
		
	this.FlipDisplayInit = function()
	{
		var match_class = "flip_display_link";
		var kids = document.getElementsByTagName("A");
		
		for(var i=0; i < kids.length; i++)
		{
			if(kids[i].className.match(match_class))
				kids[i].onclick = this.FlipDisplay;
		}
	}
		this.FlipDisplay = function()
		{
			var match_class = "flip_display_content";
			var kids = document.getElementsByTagName("*");

			for(var i=0; i < kids.length; i++)
			{
				if(kids[i].className.match(match_class))
					document.getElementById(kids[i].id).style.display = "none";
			}

			document.getElementById(this.rel).style.display = "block";
			
			// alert(this.rel);
			// document.getElementById(this.rel).cssText = "display: block !important";
			//alert(document.getElementById(this.rel).style.display);

			return false;
		}

	return this;
}


WindowEffects.prototype.SetMenuHoversInit = function(in_object)
{
	if(document.getElementById(in_object))
	{
		var li_hovers_tags = document.getElementById(in_object).getElementsByTagName('LI');
	
		for(var i=0; i < li_hovers_tags.length; i++)
		{
			if(li_hovers_tags[i].id)
			{
				var ul_blocks_tags = document.getElementById(li_hovers_tags[i].id).getElementsByTagName('UL');
	
				if(ul_blocks_tags.length == 1)
				{
					li_hovers_tags[i].onmouseover = this.SetMenuHoversHoverOn;
					li_hovers_tags[i].onmouseout = this.SetMenuHoversHoverOff;
				}
			}
		}
	}
}
	WindowEffects.prototype.SetMenuHoversHoverOn = function()
	{
		var ul_blocks_tags = document.getElementById(this.id).getElementsByTagName('UL');
		ul_blocks_tags[0].className = "menu_hover_on";
	}
	
	WindowEffects.prototype.SetMenuHoversHoverOff = function()
	{
		var ul_blocks_tags = document.getElementById(this.id).getElementsByTagName('UL');
		ul_blocks_tags[0].className = "menu_hover_off";
	}

