// Ben Thum created 04/04/2004
// Scripts for managing Visibility so that I can create horizontal submenus



var startno=2;
var maxno=8;
var maxside=8;
var pgName="side_";
var lastMain="rita_1.htm";
var myHref;



function setMain(myHtm){
//	myHref=myHtm;
	setCookie("myLocation", myHtm, 0.05	)
	//lastMain=myHtm;
//	top.main.location.href=myHtm;
	parent.frames[2].location.href=myHtm;

	

}

function showSubMenu(mainName,subName,showno){

 //checkWidth("imgr");

var ss=mainName+"1";
// alert(ss+"\n"+mainName+"\n"+subName+"\n"+showno)
document.getElementById(ss).style.color = "black";
document.getElementById(ss).style.backgroundColor= "#FF6633";

	for (ix=startno;ix<=maxno;ix=ix+1)
		{
			ss=subName+ix;
			document.getElementById(ss).style.visibility = 'hidden';
			ss=mainName+ix;
			 document.getElementById(ss).style.color = "black";
			document.getElementById(ss).style.backgroundColor= "#FF6633";
		}

	if (showno>0){

		if (showno>1 && showno<8){
			ss=subName+showno;
			document.getElementById(ss).style.visibility = 'visible';
			}

		ss=mainName+showno;
		 document.getElementById(ss).style.color = "#FF6633";
		document.getElementById(ss).style.backgroundColor = "white";
	}

}



function hideSide(){
//  parent.frames[2].location.href="http://www.siacad.com";
//	alert("HIDE START");
//	parent.frames[2].innerWidth=100;
// alert(parent.frames[2].innerWidth);
	
//	alert(parent.frames[2].location);
//	alert(parent.frames[2].location);
//	alert(myHref);
	
//	alert(lastMain);
//	alert(getCookie("myLocation"));

	top.location.href="index2.htm";

}

function showSide(){
	// parent.frames[0].location.reload();
	top.location.href="index.htm";
}




function doHeader2(myTitle,urlName,returnUrl,collapseButton,currentNo,totalNo){

	var xprev=urlName+parseInt(totalNo)+".htm";			// force to last page

	if (currentNo>1){
			xprev=urlName+parseInt(currentNo-1)+".htm";		// set previous page
		}

	var xnext=urlName+"1.htm";					//  force to first page

	if (currentNo<totalNo){
			 xnext=urlName+parseInt(currentNo+1)+".htm";	// set next page
		}

	//  alert(xp+"\n\n"+xn+"\n\n"+maxside+"\n\n"+pgno);

	var ss='<table width="100%" height="22" cellpadding="0" cellspacing="0" >';
	document.write(ss);

	document.write('<tr class="header1">');

	if (collapseButton==1){
		document.write('<td width="12" valign="center">');
		document.write('<a   href="#" onClick="hideSide();"   >');
		document.write(' <img src="images/minimize.gif" alt="Hide Side Bar"  name="mini" border="0" align="right" >');
		document.write(' </a>');
		document.write('</td>');
		}


	document.write('<td>');
	if (returnUrl==""){

		document.write(myTitle);

	}
	else
		{
		document.write('<a href="'+returnUrl+'.htm" >');
		document.write(myTitle);
		document.write('</a>');
		}
	if (totalNo>0){
	document.write('</td>');
	document.write('<td width="10" align="right" >');
	document.write('<a href="'+xprev+'"  >&lt</a>');
	document.write('</td>');
	document.write('<td width="10" align="left">');
	document.write('<a href="'+xnext+'" >&gt</a>');
	document.write('</td>');
	}


	document.write('</tr>');
	document.write('</table>');

}





function checkWidth(theID){


if(navigator.appName == "Netscape"){

windowwidth = window.innerWidth;
windowheight = window.innerHeight;

}else if(navigator.appName == "Microsoft Internet Explorer"){

windowwidth = document.body.clientWidth;
windowheight = document.body.clientHeight;

}else{

windowwidth = "0";

}

if (windowwidth>0){
	var xx=windowwidth-325;
	var theElement=document.getElementById(theID).style.left;
//	document.getElementById(theID).style.top=yy+"px";
	document.getElementById(theID).style.left=xx+"px";
	var theElement=document.getElementById("headline").style.left;
	xx=windowwidth-325;
	document.getElementById("headline").style.left=xx+"px";

}


// alert(windowwidth);

}

function goPage(myUrl,mySeconds){

	// var ss="http://www.siacad.com/sia/"+myUrl;
	var millisecond=mySeconds*2000;
	var ss=myUrl;
	window.setTimeout("window.location='"+ss+"';",millisecond);

}

function reLoadMain(){
	alert("Reload");
	// parent.frames[0].location.reload();

}

function getCookie(NameOfCookie){
    if (document.cookie.length > 0) {              
    begin = document.cookie.indexOf(NameOfCookie+"=");       
    if (begin != -1) {           
      begin += NameOfCookie.length+1;       
      end = document.cookie.indexOf(";", begin);
      if (end == -1) end = document.cookie.length;
        return unescape(document.cookie.substring(begin, end));
    } 
  }
  return null;
}

function setCookie(NameOfCookie, value, expiredays) {
var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));

  document.cookie = NameOfCookie + "=" + escape(value) + 
  ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

function delCookie (NameOfCookie) {
  if (getCookie(NameOfCookie)) {
    document.cookie = NameOfCookie + "=" +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function DoTheCookieStuff()
{
username=getCookie('username');
if (username!=null) {alert('Hi there '+username+' - Good to see you again!')}
else {username=prompt('Hi - this is your first visit to my page - please enter your name.',"");setCookie('username',username,365)}
}










