var rgb_beg, rgb_end, rgb_beg_white, over_spd, out_spd
var dualhex, hex

rgb_beg = [204,204,255]
rgb_beg_white = [153,153,204]
rgb_end = [255,255,255]
over_spd = 15
out_spd = 15

document.onmouseover = domouseover;
document.onmouseout  = domouseout;

dualhex = new Array()
hex = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]

for(i = 0; i < 256; i++) dualhex[i] = hex[parseInt(i / 16)] + hex[i % 16]

function show_cart() {
	alert("We apologise, but our new shopping cart has not yet been adapted to include non-music merchandise.  It will be upgraded in the near future, but until then please contact the Saiko Sounds staff directly if you wish to purchase non-music merchandise.");
}

function domouseover() {
  if (document.all && window.event.srcElement.tagName == "A") fade(window.event.srcElement.sourceIndex, 1, window.event.srcElement.className)
}

function domouseout() {
  if (document.all && window.event.srcElement.tagName == "A") setTimeout("fade('" + window.event.srcElement.sourceIndex + "', 0, '" + window.event.srcElement.className + "')", over_spd * over_spd * 2)
}

function fade(element, over, class_name) {
  if(over) {
		if(class_name == "white") beg = rgb_beg_white;
		else beg = rgb_beg;
    end = rgb_end;
    spd = over_spd;
  }
  else {
		if(class_name == "white") end = rgb_beg_white;
		else end = rgb_beg;
    beg = rgb_end;
    spd = out_spd;
  }
  for(i = 0; i <= spd; i++)
    setTimeout("document.all[" + element + "].style.color = '#"
     + dualhex[Math.floor(beg[0] * ((spd - i) / spd) + end[0] * (i / spd))]
     + dualhex[Math.floor(beg[1] * ((spd - i) / spd) + end[1] * (i / spd))]
     + dualhex[Math.floor(beg[2] * ((spd - i) / spd) + end[2] * (i / spd))] + "';",  i * spd);
}

if (document.images) {
	var catalog_out = new Image();
	catalog_out = img_path + "cataloga.gif";
	var catalog_over = new Image();
	catalog_over = img_path + "catalogb.gif";

	var special_out = new Image();
	special_out = img_path + "speciala.gif";
	var special_over = new Image();
	special_over = img_path + "specialb.gif";

	var contact_out = new Image();
	contact_out = img_path + "contacta.gif";
	var contact_over = new Image();
	contact_over = img_path + "contactb.gif";

	var about_out = new Image();
	about_out = img_path + "abouta.gif";
	var about_over = new Image();
	about_over = img_path + "aboutb.gif";

	var mailing_out = new Image();
	mailing_out = img_path + "mailinga.gif";
	var mailing_over = new Image();
	mailing_over = img_path + "mailingb.gif";

	var news_out = new Image();
	news_out = img_path + "newsa.gif";
	var news_over = new Image();
	news_over = img_path + "newsb.gif";

	var links_out = new Image();
	links_out = img_path + "linksa.gif";
	var links_over = new Image();
	links_over = img_path + "linksb.gif";

	var parties_out = new Image();
	parties_out = img_path + "partiesa.gif";
	var parties_over = new Image();
	parties_over = img_path + "partiesb.gif";

	var djmixes_out = new Image();
	djmixes_out = img_path + "djmixesa.gif";
	var djmixes_over = new Image();
	djmixes_over = img_path + "djmixesb.gif";

	var orderinfo_out = new Image();
	orderinfo_out = img_path + "orderinfoa.gif";
	var orderinfo_over = new Image();
	orderinfo_over = img_path + "orderinfob.gif";

	var home_out = new Image();
	home_out = img_path + "homea.gif";
	var home_over = new Image();
	home_over = img_path + "homeb.gif";
}

function out(id)  {
	change_image(id, eval(id + "_out"));
}
function over(id) {
	change_image(id, eval(id + "_over"));
}

function toggle_wishlist(id) {
	path = "toggle_wishlist.asp?title_id=" + id + "&seed=" + parseInt(Math.random() * 10000)
  for (i = 0; i < document.images.length; i++) {
		if (document.images[i].name == "img_" + id) {
			change_image(i, path);
		}
	}
}

function change_image(name, path) {
	document.images[name].src = path;
}

function show_button(name, height, width, url_link) {
	return("<a onfocus=\"this.blur();\" onmouseover=\"over('" + name + "')\" onmouseout=\"out('" + name + "')\" href=\"" + url_link + "\"><img name=\"" + name + "\" src=\"" + img_path + name + "a.gif\" width=\"" + width + "\" height=\"" + height + "\" border=\"0\"></a>");
}

function process_data(data) {
	data_array = data.split("=")
	if(data_array[0] == "ExpChkSts") return("<tr><td><p>" + data_array[1] + "</p></td>")
	if(data_array[0] == "FmtChkDate")	return("<td><p>" + data_array[1] + "</p></td>")
	if(data_array[0] == "FmtChkTime") return("<td><p>" + data_array[1] + "</p></td></tr>")
	return("")
}

function show_menu() {
	document.write(show_button("catalog", 25, 134, "store.asp") + "<br>" + show_button("special", 25, 134, "specials.asp") + "<br>" + show_button("contact", 25, 134, "contact.asp") + "<br>" + show_button("about", 24, 134, "aboutus.asp") + "<br>" + show_button("mailing", 24, 134, "lists.asp") + "<br>" + show_button("news", 25, 134, "news.asp") + "<br>" + show_button("links", 24, 134, "links.asp") + "<br>" + show_button("parties", 26, 134, "parties.asp") + "<br>" + show_button("djmixes", 25, 134, "djmixes.asp") + "<br>" + show_button("orderinfo", 25, 134, "orderinfo.asp") + "<br>" + show_button("home", 25, 134, "default.asp"));
}