// JavaScript Document

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array()
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_effectAppearFade(targetElement, duration, from, to, toggle) {
	Spry.Effect.DoFade(targetElement, {duration: duration, from: from, to: to, toggle: toggle});
}

function MM_setTextOfLayer(objId,x,newText) { //v9.0
  with (document) if (getElementById && ((obj=getElementById(objId))!=null))
    with (obj) innerHTML = unescape(newText);
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

var vFormat = 1;
function sortFormat() {
	(vFormat) ? vFormat=0: vFormat=1;
}

//  This routine sets a cookie on the visitor's machine.
//  name is the name of the cookie
//  value is the information contained by name
//  expires sets the number of days of when you want the cookie to expire. Leave blank to have cookie expire when browser is closed
//  path specifies which folder on your Web site can access this cookie
//  domain specifies which servers on your domain can access this cookie
//  secure specifies whether a secure connection is needed to access this cookie
function setCookie(name,value,expires,path,domain,secure)
{	if (expires)
	{	var exp = new Date()
		exp.setTime(exp.getTime() + (expires * 60 * 60 * 24 * 1000))
		expires = exp.toGMTString()
	}

	document.cookie = name + "=" + escape(value) + 
	((expires) ? "; expires=" + expires : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "");
}

//  This routine retireves a cookie's value
//  if the returned value is "null", then the cookie has not been set or has been cleared
function getCookie(name)
{	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;

	if (cookie.length > 0)
	{	offset = cookie.indexOf(search)
		if (offset != -1)
		{	offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1)
			{	end = cookie.length;
			}
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return(setStr);
}

// This routine clears the value of a cookie
function clearCookie(variable)
{	setCookie(variable,"","Thu, 01-Jan-1970 00:00:00 GMT");
}

function resetWindow() {
	window.location.reload(); 
}

function showMainImage(x) {
	switch (x) {
		case 1:
			document.getElementById("MainImage").setAttribute("src","otherImages/HomeImages/Score.png");
			break;
		case 2:
			document.getElementById("MainImage").setAttribute("src","otherImages/HomeImages/HSQ.png");
			break;
		case 3:
			document.getElementById("MainImage").setAttribute("src","otherImages/HomeImages/CD.png");
			break;
		case 4:
			document.getElementById("MainImage").setAttribute("src","otherImages/HomeImages/Gift.png");
			break;
	}
}

// The next 3 routines handle the rollover effects for the CDs tab bar
var currentCD = 1;

function cdRollOver(obj,which)
{	obj.className = "cd" + which + "Over";
	
}

function cdRollOut(obj,which)
{	if (currentCD != which)
		obj.className = "cd" + which;
	
}

function setCD(x)
{	liTags = document.getElementById("cdRow").getElementsByTagName("LI");
	for (i=0;i<10;i++)
		liTags[i].className = "cd" + (i+1);
	
	currentCD = x;
	
	liTags[x-1].className = "cd" + (x) + "Over";
}

// Special Annoucements on index page
function showNote() {
	setTimeout("document.getElementById('note').style.visibility = 'hidden'", 10000);
}


// Software slideshow
function showBadTalkImages(x) {
	c = c + x;
	if (c < 1) c = 5;
	if (c > 5) c = 1;
	
	switch (c) {
		case 1:
			document.getElementById("BadTalkImage").setAttribute("src","otherImages/Software/BadTalk1.png");
			break;
		case 2:
			document.getElementById("BadTalkImage").setAttribute("src","otherImages/Software/BadTalk2.png");
			break;
		case 3:
			document.getElementById("BadTalkImage").setAttribute("src","otherImages/Software/BadTalk3.png");
			break;
		case 4:
			document.getElementById("BadTalkImage").setAttribute("src","otherImages/Software/BadTalk4.png");
			break;
		case 5:
			document.getElementById("BadTalkImage").setAttribute("src","otherImages/Software/BadTalk5.png");
			break;
	}
}

// Software slideshow
function showSmalTalkImages(x) {
	c = c + x;
	if (c < 1) c = 9;
	if (c > 9) c = 1;
	
	switch (c) {
		case 1:
			document.getElementById("SmalTalkImage").setAttribute("src","otherImages/Software/SmalTalk1.png");
			break;
		case 2:
			document.getElementById("SmalTalkImage").setAttribute("src","otherImages/Software/SmalTalk2.png");
			break;
		case 3:
			document.getElementById("SmalTalkImage").setAttribute("src","otherImages/Software/SmalTalk3.png");
			break;
		case 4:
			document.getElementById("SmalTalkImage").setAttribute("src","otherImages/Software/SmalTalk4.png");
			break;
		case 5:
			document.getElementById("SmalTalkImage").setAttribute("src","otherImages/Software/SmalTalk5.png");
			break;
		case 6:
			document.getElementById("SmalTalkImage").setAttribute("src","otherImages/Software/SmalTalk6.png");
			break;
		case 7:
			document.getElementById("SmalTalkImage").setAttribute("src","otherImages/Software/SmalTalk7.png");
			break;
		case 8:
			document.getElementById("SmalTalkImage").setAttribute("src","otherImages/Software/SmalTalk8.png");
			break;
		case 9:
			document.getElementById("SmalTalkImage").setAttribute("src","otherImages/Software/SmalTalk9.png");
			break;
	}
}

// Software slideshow
function showMonaMusicImages(x) {
	c = c + x;
	if (c < 1) c = 16;
	if (c > 16) c = 1;
	
	switch (c) {
		case 1:
			document.getElementById("MonaMusicImage").setAttribute("src","otherImages/Software/MonaMusic1.png");
			break;
		case 2:
			document.getElementById("MonaMusicImage").setAttribute("src","otherImages/Software/MonaMusic2.png");
			break;
		case 3:
			document.getElementById("MonaMusicImage").setAttribute("src","otherImages/Software/MonaMusic3.png");
			break;
		case 4:
			document.getElementById("MonaMusicImage").setAttribute("src","otherImages/Software/MonaMusic4.png");
			break;
		case 5:
			document.getElementById("MonaMusicImage").setAttribute("src","otherImages/Software/MonaMusic5.png");
			break;
		case 6:
			document.getElementById("MonaMusicImage").setAttribute("src","otherImages/Software/MonaMusic6.png");
			break;
		case 7:
			document.getElementById("MonaMusicImage").setAttribute("src","otherImages/Software/MonaMusic7.png");
			break;
		case 8:
			document.getElementById("MonaMusicImage").setAttribute("src","otherImages/Software/MonaMusic8.png");
			break;
		case 9:
			document.getElementById("MonaMusicImage").setAttribute("src","otherImages/Software/MonaMusic9.png");
			break;
		case 10:
			document.getElementById("MonaMusicImage").setAttribute("src","otherImages/Software/MonaMusic10.png");
			break;
		case 11:
			document.getElementById("MonaMusicImage").setAttribute("src","otherImages/Software/MonaMusic11.png");
			break;
		case 12:
			document.getElementById("MonaMusicImage").setAttribute("src","otherImages/Software/MonaMusic12.png");
			break;
		case 13:
			document.getElementById("MonaMusicImage").setAttribute("src","otherImages/Software/MonaMusic13.png");
			break;
		case 14:
			document.getElementById("MonaMusicImage").setAttribute("src","otherImages/Software/MonaMusic14.png");
			break;
		case 15:
			document.getElementById("MonaMusicImage").setAttribute("src","otherImages/Software/MonaMusic15.png");
			break;
		case 16:
			document.getElementById("MonaMusicImage").setAttribute("src","otherImages/Software/MonaMusic16.png");
			break;
	}
}

// Software slideshow
function showuWriteImages(x) {
	c = c + x;
	if (c < 1) c = 5;
	if (c > 5) c = 1;
	
	switch (c) {
		case 1:
			document.getElementById("uWriteImage").setAttribute("src","otherImages/Software/uWrite1.png");
			break;
		case 2:
			document.getElementById("uWriteImage").setAttribute("src","otherImages/Software/uWrite2.png");
			break;
		case 3:
			document.getElementById("uWriteImage").setAttribute("src","otherImages/Software/uWrite3.png");
			break;
		case 4:
			document.getElementById("uWriteImage").setAttribute("src","otherImages/Software/uWrite4.png");
			break;
		case 5:
			document.getElementById("uWriteImage").setAttribute("src","otherImages/Software/uWrite5.png");
			break;
	}
}

/*function clearAllCheckboxes()
{	for (var i=0; i<goemerchant.elements.length; i++)
	{	var e = goemerchant.elements[i];
    	if (e.type=='checkbox')
			e.checked = false;
  	}
}
*/

/*function setAll()
{	x = document.getElementsByTagName("INPUT");
	alert(x.length);
   	for (i=0; i<x.length; i++)
   	{	y = x[i].getAttribute("type");
	   	if (y == "checkbox")
		   x[i].setAttribute("checkbox","unchecked");
   	}
}*/