/*
 * bssng.js
 * 
 * Version 1.0
 *
 * Changes "BlueSwitch" link style/colors onMouseOver and restores original link style/colors
 * onMouseOut. More cross-browser compliant DOM and contained in a js file. Less typing, less
 * copying & pasting, less calories, same great taste!
 * 
 * HTML usage:
 * 
 * 
 * <a id="blue_id" href="...">Blue</a><a id="switch_id" href="...">Switch</a>
 * <script type="text/javascript">
 *     var bs = new BlueSwitcher("blue_id", "switch_id");
 * </script>
 * 
 * 
 * "blue_id"    - string variable, the name of the id (can be named anything you want)
 *                that'll change to BlueSwitch blue 
 * "switch_id"  - string variable, the name of the id (can be named anything you want)
 *                that'll change to BlueSwitch orange 
 * 
 * 
 * 
 * P.S. Your mom. <3
 *
 */

var BLUE_COLOR = "#00479c";
var SWITCH_COLOR = "#f93";
var TEXT_DECORATION = "underline";
var original_blue_color;
var original_switch_color;
var original_text_decoration;

if(typeof bs=="undefined"){var bs=new Object();}

bs.BlueSwitcher = function(b,s)
{
	document.getElementById(b).onmouseover = function() { saturate(b,s) };
	document.getElementById(s).onmouseover = function() { saturate(b,s) };
	document.getElementById(b).onmouseout = function() { desaturate(b,s) };
	document.getElementById(s).onmouseout = function() { desaturate(b,s) };
}

function saturate(blue_id, switch_id)
{
	original_blue_color = document.getElementById(blue_id).style.color;
	original_switch_color = document.getElementById(switch_id).style.color;
	original_text_decoration = document.getElementById(blue_id).style.textDecoration ? document.getElementById(blue_id).style.textDecoration : "none";
	//alert(original_text_decoration);
	document.getElementById(blue_id).style.color = BLUE_COLOR;
	document.getElementById(blue_id).style.textDecoration = TEXT_DECORATION;
	document.getElementById(switch_id).style.color = SWITCH_COLOR;
	document.getElementById(switch_id).style.textDecoration = TEXT_DECORATION;
}

function desaturate(blue_id, switch_id)
{
	document.getElementById(blue_id).style.color = original_blue_color;
	document.getElementById(blue_id).style.textDecoration = original_text_decoration;
	document.getElementById(switch_id).style.color = original_switch_color;
	document.getElementById(switch_id).style.textDecoration = original_text_decoration;
}

var BlueSwitcher = bs.BlueSwitcher;