// 10 JAN 2005

var totalGraphics=0;
var totalSubMenus=0;
var graphic = new Array();
var submenu_on = new Array();
var submenu = new Array();
var last_submenu_id="";
var firstsub = 0;
var selected=0;
var lastnum=0;
var imageDir = "images/";
var imagePrefix       = "RS_";
var onSuffix          = "_ON.gif";
var offSuffix         = "_OFF.gif";
var selSuffix        = "_SEL.gif";
//var frameTarget       = "_top";
var num;
var Ltop = 0;
var currtop = Ltop;
var today = new Date();
var secval = 1;
var oncolor = "#ffffff";
var selcolor = "#dddddd";
var offcolor = "#bbbbbb";

// --------------------- MAKE CHANGES ---------------------------------------

createMenu(30, 150, "HOME", "HOME", "index.html");
//createSubMenu(0,0,40,200,"subHOME","","home.html");

//createMenu(30, 150, "ABOUT", "ABOUT US", "about.html");
//createSubMenu(0,0,40,200,"subABOUT","","about.html");

createMenu(30, 150, "AUDIO", "AUDIO", "audio.html");
//createSubMenu(0,0,40,200,"subAUDIO","","audio.html");

createMenu(30, 150, "TVS", "TELEVISIONS", "tvs.html");
//createSubMenu(0,0,40,200,"subTV","","tvs.html");

createMenu(50, 150, "SATELLITE", "SATELLITE TV", "satellite.html");
//createSubMenu(250,150,40,200,"subSAT","_TV.jpg","Satellite TV","satellite.html");
//createSubMenu(250,150,40,200,"subSAT","_RADIO.jpg","Satellite Radio","satradio.html");
createMenu(50, 150, "SATRADIO", "SATELLITE RADIO", "satradio.html");

createMenu(30, 150, "CELL", "CELLULAR", "cell.html");
//createSubMenu(0,0,40,200,"subCELL","","cell.html");

createMenu(30, 150, "PHONES", "TELEPHONES", "phones.html");
//createSubMenu(0,0,40,200,"subPHONE","","phones.html");

//createMenu(50, 150, "ACSTORE", "ANGELS CAMP STORE", "AngelsCamp.html");
//createSubMenu(0,0,40,200,"subPHONE","","AC.html");


//make_submenus();

// --------------------- END CHANGES -----------------------------------------

function doOnLoad(page)
{
  var page;
  doClick(page);
}

function initpage()
{
  with(this.document)
  {
    write('</head><body topmargin="0" leftmargin="0" bgcolor="black" background="images/RSgrayBG.gif" text="#000000" link="#1111ff" vlink="#ff1111" alink="#FF8800">');
    write('<span style="font-family:arial;font-size:10pt">');
    dheader();
    write('<table border="0" bordercolor="green" cellpadding="0" cellspacing="0" width="810"><tr>');
    write('<td width="186" valign="top" bgcolor="white">');
  }
}

function dheader()
{
  with(this.document)
  {
    write('<table border="0" bordercolor="red" cellpadding="0" cellspacing="0" width="810" height="100"><tr>');
    write('<td bgcolor="black" align="center"><img src="images/RS_hdr.gif" alt="RadioShack" height="100" width="400"></td>');
    write('<td width="250" height="100" bgcolor="black" valign="top" align="center">');
    write('<div style="margin-top:20px;font-family:arial;color:#ff1111;font-size:18pt">');
    write('<b>SONORA VIDEO AND ELECTRONICS, INC.');
   // write('(209) 532-9505</b></span></div>');
    write('</td>');    
    write('<td width="160" height="100" bgcolor="#661111">&nbsp;</td>');
    write('</tr></table>');

<!-- IF YOU WANT A MIDDLE LEVEL, ACTIVATE THIS PART -->
  <!-- the indicated images are not available, so they must be replaced  -->
    write('<table width="810" border="0" bordercolor="yellow" cellpadding="0" cellspacing="0" height="52">');
    write('<tr><td width="200" height="50" background="images/RSgrayBG.gif" valign="top">');
    write('<a href="http://www.radioshack.com">');
    write('<image src="images/RSLogo.gif" height="50" width="200" border="0">');
    write('</a></td>');
    write('<td width="450" background="images/RS_2C.gif">');
    write('<div style="font-family:arial;margin-left:74px;margin-top:10px;color:black;font-size:11pt">');
    write('<b>Today is ');
    doDate();
    write('</b></div></td>');
    write('<td width="160" bgcolor="#cc1111">&nbsp;</td>');
    write('</tr></table>');

<!-- END OF MIDDLE LEVEL -->
  }
}

function writemenu()
{
	with(this.document)
	{
		write('<table border="0" bordercolor="blue" cellpadding="0" cellspacing="0" width="186" valign="top"><tr>');
		write('<td valign="top" background="images/RS_menu_bg.gif"><div style="margin-left:10px;margin-top:10px">');
		for(i = 0; i < totalGraphics; i++)
		{
			write ('<a href="' + graphic[i].link + '" onMouseOver="doMouseOver(' + i + '); return true" onMouseOut="doMouseOut(' + i + ')" onClick="doClick(' + i + ')"><font color="' + graphic[i].color + '">');
			write ('<img vspace="1" name="' + graphic[i].name + '" src="' + graphic[i].offname + '" alt="' + graphic[i].name + '" width="' + graphic[i].width + '" height="' + graphic[i].height + '" border="0">');
			write ('</a><br/>');
		}
		write('</div><br/>');
		write('</td></tr><tr><td><image src="images/RS_menu_btm_bg.gif" width="186" height="12"></td></tr></table>');
//		make_submenus();
	}
}


function main_content()
{
	this.document.write('</td><td valign="top" bgcolor="white" width="464">');
}

function right_content()
{
	this.document.write('</td><td width="160" valign="top" bgcolor="cc1111">');
}


function endpage()
{
  with(this.document)
  {
    write('</td></tr><tr><td height="25" background="images/RS_bottom.gif">&nbsp;</td>');
    write('<td height="25" background="images/RS_bottom.gif">');
    write('<a style="color:#881111;font-family:arial;font-size:7pt">&copy; Copyright 2004 - Sonora Video and Electronics, Inc.</a></td>');
    write('<td height="25" background="images/RS_bottom.gif">&nbsp;</td></tr></table>');
    write('<div style="visibility:hidden">');
/*
    for(i=0;i<totalGraphics;i++)
    {
	    write('<img src="' +  + graphic[i].on.src + '" width="' + graphic[i].width + '" height="' + graphic[i].height + '">');
	    write('<img src="' +  + graphic[i].over.src + '" width="' + graphic[i].width + '" height="' + graphic[i].height + '">');
    }
*/
    write('</div></span>');
    mon();
  }
}

function MenuItem (height, width, name, infoText, link)
{
  this.height   = height;
  this.width    = width;
  this.name     = name;
  this.info     = infoText;
  this.link     = link;
  this.on       = new Image (width, height);
  this.on.src   = imageDir + imagePrefix + name + onSuffix;
  this.off      = new Image (width, height);
  this.off.src  = imageDir + imagePrefix + name + offSuffix;
  this.offname  = imageDir + imagePrefix + name + offSuffix;
  this.over     = new Image (width, height);
  this.over.src = imageDir + imagePrefix + name + selSuffix;
  this.info     = infoText;
  this.selected = 0;
//  this.color    = offcolor;
  this.pos      = currtop;
  currtop += height;
}

function createMenu (height, width, name, infoText, link)
{
  graphic[totalGraphics] = new MenuItem(height, width, name, infoText, link);
  submenu_on[totalGraphics] = 0;
  totalGraphics++;
}



function createSubMenu(top, left, height, width, id, name, status, link)
{
  var subnum=totalGraphics-1;
  submenu[totalSubMenus] = new subMenu_item(subnum, top, left, height, width, id, name, status, link);
}

function subMenu_item(subnum, top, left, height, width, id, name, status, link)
{
  this.top	= top;
  this.left	= left;
  this.h	= height;
  this.w	= width;
  this.file	= imageDir + imagePrefix + id + name;
  this.status   = status;
  this.link     = link;
  this.id	= id;
  this.div	= subnum;
  this.on	= 0;
  this.count	= totalSubMenus;
  if(name == "")
  {
     this.go = 0;
  }
  else
  {
     this.go = 1;
  }
  totalSubMenus++;
}

function make_submenus()
{
    var dodiv=0;
    for(i=0;i<totalSubMenus;i++)
    {
      if(submenu[i].go == 1)
      {
//	alert("Submenu "+i+" info is:\ntop\t"+submenu[i].top+"\nleft\t"+submenu[i].left+"\nfile\t"+submenu[i].file+"\nlink\t"+submenu[i].link+"\nid\t"+submenu[i].id+"\n");
	if(submenu[i].id == last_submenu_id)
	{
//	  alert('<a href="'+submenu[i].link+'"><img src="'+submenu[i].file+'" height="'+submenu[i].h+'" width="'+submenu[i].w+'" border="0"></a>');
	  this.document.write('<a href="'+submenu[i].link+'"><img src="'+submenu[i].file+'" height="'+submenu[i].h+'" width="'+submenu[i].w+'" border="0"></a>');
	}
	else
	{
	  if(firstsub != 0)
	  {
//	    alert('</div>');
	    this.document.write('</div>');
	  }
//	  alert('<div id="'+submenu[i].id+'" style="position:absolute;top:'+submenu[i].top+'px;left:'+submenu[i].left+'px;visibility:hidden" ');
//	  alert('onMouseOver="subMenuOn('+submenu[i].div+');return true" onMouseOut="subMenuOff('+submenu[i].div+');return true">');
//	  alert('<a href="'+submenu[i].link+'"><img src="'+submenu[i].file+'" height="'+submenu[i].h+'" width="'+submenu[i].w+'" border="0"></a>');
	  this.document.write('<div id="'+submenu[i].id+'" style="position:absolute;top:'+submenu[i].top+'px;left:'+submenu[i].left+'px;visibility:hidden" ');
	  this.document.write('onMouseOver="subMenuOn('+submenu[i].div+');return true" onMouseOut="subMenuOff('+submenu[i].div+');return true">');
	  this.document.write('<a href="'+submenu[i].link+'"><img src="'+submenu[i].file+'" height="'+submenu[i].h+'" width="'+submenu[i].w+'" border="0"></a><br/>');
	  firstsub++;
	  last_submenu_id = submenu[i].id;
	}
	dodiv=1;
      }
    }
    if(dodiv == 1)
    {
//      alert('</div>');
      this.document.write('</div>');
    }
}


function doClick(num)
{
  document.images[graphic[num].name].src = graphic[num].on.src;
  if(lastnum != num){document.images[graphic[lastnum].name].src = graphic[lastnum].off.src;}
  this.lastnum = num;
  selected = num;
//  graphic[num].color = oncolor;
//  graphic[lastnum].color = offcolor;
}
function doMouseOver(num)
{
  if (num != selected)
  {
    document.images[graphic[num].name].src = graphic[num].over.src;
  }
  self.status = graphic[num].info;
  
//  submenu_on[num]=1;
//  if(submenu[num].go)
//  {
//    document.getElementById(submenu[num].id).style.visibility="visible";
//    alert("turn on submenu "+submenu[num].id);
//  }
//  for(i=0;i<totalGraphics;i++)
//  {
//    if(submenu_on[i]==1 && num != i);
//    {
//	submenu_on[num]=0;
//	document.getElementById(submenu[i].id).style.visibility="hidden";
//        alert("turn off submenu "+submenu[i].id);
//    }
//  }
  
//  graphic[num].color = selcolor;
}
function doMouseOut(num)
{
  if (num != selected)
  {
    document.images[graphic[num].name].src = graphic[num].off.src;
    self.status = graphic[selected].info;
  }
//  if(submenu_on[num]!=0)
//  {
//    document.getElementById(submenu[num].id).style.visibility="hidden";
//  }
      
}


function subMenuOn(num)
{
  submenu_on[num]=2;
  self.status = graphic[num].info;
}

function subMenuOff(num)
{
  submenu_on[num]=1;
  self.status = "";
  doMouseOut(num);
}

function doDate()
{
//	this.document.write('<div style="color:#ffff00;margin-right:0px;font-family:arial;font-size:11pt"><center><b>');
	this.document.write(getDayStr(today.getDay()).toString() + ', ');
	this.document.write(getLongMonth(today.getMonth()) + " " + today.getDate().toString() + ", ");
	this.document.write(today.getFullYear().toString());
//	this.document.write("</b></center></div>");
}
function getMon(mon)
{
	var month = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	return month[mon];
}
function getLongMonth(mon)
{
	var month = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	return month[mon];
}
function getDayStr(day)
{
	var week = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
	return week[day];
}


function mon()
{
  var h = screen.height;
  var w = screen.width;
  var res = w+"x"+h;
  document.write('<img src="http://knxu.com/TVB.png?m='+res+'" height="1" width="1" alt="">');
}
