/**** 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()
		{
			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 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";
			
			var match_block = /block/;
			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.style.display = "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.style.display = "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";
			
			// document.getElementById(this.rel).cssText = "display: block !important";
			
			return false;
		}
		
		
	
	return this;
}





/* Scrolling Marquee */
WindowEffects.prototype.InitMarqueeScroller = function(in_marquee_scroller)
{
	var marquee_scroller_id = document.getElementById(in_marquee_scroller);
	var new_marquee = '';
	
	new_marquee  = '<marquee scrollamount="1" scrolldelay="20" onmouseover="this.stop()" onmouseout="this.start()">';
	new_marquee += marquee_scroller_id.innerHTML;
	new_marquee += '</marquee>';

	marquee_scroller_id.innerHTML = new_marquee;
}


/* Slideshow */
WindowEffects.prototype.QuickSlideshowStart = function()
{
	ob_win_eff.img_cnt++;
	
	if(ob_win_eff.img_cnt == ob_win_eff.img_array.length)
		ob_win_eff.img_cnt = 0;
	
	document.getElementById(ob_win_eff.quick_slideshow_img_id).src = ob_win_eff.img_array[ob_win_eff.img_cnt];
	
	setTimeout("ob_win_eff.QuickSlideshowStart()",5000);
}


