
//popups 
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=1,statusbar=0,menubar=1,resizable=1,width=910,height=2000');");

}

function imgReset()	{
	var x = document.getElementsByName("myimage");
	var add_string_start = "images/"
	var add_string_end = "_left.gif";
	var add_string_end_on = "_left_on.gif";

	for (var i = 0; i < x.length; i++) 		{ 
		var y = x[i].src; 	
	
		r_length = y.length;				// marker: end of the string
		r_length_less = y.length - 5;		// marker: beginning of the string
		z=y.slice(r_length_less, r_length);	// slice the string based upon the markers
	
		//evaluate the string, does it need to be reset?
		if (z != 't.gif')	{
			y = y.split("/").pop();
			y = y.split(".").shift();
			y_on = add_string_start + y + add_string_end_on;	//determine the name for the new 'on' image
			y = add_string_start + y + add_string_end;			//determine the name for the new 'off' image
			x[i].src = y;										//next 3 lines make image assignments
			x[i].setAttribute("origsrc", y);					
			x[i].setAttribute("oversrc", y_on);
			
			
	
							}
		
		}
	
	
	
	
}

function divClose()		{
	
	var value = "mymenu";
	for (var i = 0; i <= 5; i++)	{
		var elem=document.getElementById(value+i)
	
		if (elem == null)	{
					continue;
							}	// end null check
	
		//close all open divs
		if (elem.style.display == "block")	{
			elem.style.display = "none";
			
											} // end if statement	
		
									}	// end for statement 
	
	
	
	
} // end divGrab

function testDivs(dd_id, img_id, img_1, img_2, img_3, img_4) 	{
	
	
	var elem = document.getElementById(dd_id);
	var img_elem = document.getElementById(img_id);
	
	
	
	// if the chosen button is open, it is assigned a new oversrc and origsrc just close it
	if (elem.style.display == "block")		{
		elem.style.display = "none";
		// change the images of the chosen button
		img_elem.src = img_2;
		img_elem.setAttribute("origsrc", img_1);
		img_elem.setAttribute("oversrc", img_2);
											}
	// if the chosen button is closed, all open buttons are closed and this particular button is opened
	else	{
	divClose();	// close all open Divs	
	imgReset();				// reset all image headers
	//open the chosen menu and swap its images
	elem.style.display = "block";
	img_elem.src = img_4;
	img_elem.setAttribute("origsrc", img_3);
	img_elem.setAttribute("oversrc", img_4);

	
			}  //end else statement
	
	
	
	
} //end function testDivs

function getElementsByClassName(oElm, strTagName, strClassName){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/-/g, "\-");
	var oRegExp = new RegExp("(^|\s)" + strClassName + "(\s|$)");
	var oElement;
	for(var i=0; i<arrElements.length; i++){
		oElement = arrElements[i];
		if(oRegExp.test(oElement.className)){
			arrReturnElements.push(oElement);
		}
	}
	
	
	return (arrReturnElements)
}





// swap images

function SimpleSwap(el,which){
   el.src=el.getAttribute(which||"origsrc"); 
}
 

function SimpleSwapSetup(){
  var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;
    // preload image
    // comment the next two lines to disable image pre-loading
     x[i].oversrc_img = new Image();
     x[i].oversrc_img.src=oversrc;
    // set event handlers
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    x[i].setAttribute("origsrc",x[i].src);
  }
}




//swap div

menu_status = new Array();
function showHide(theid){
    if (document.getElementById) {
    var switch_id = document.getElementById(theid);

        if(menu_status[theid] != 'show') {
           switch_id.className = 'show';
           menu_status[theid] = 'show';
        }else{
           switch_id.className = 'hide';
           menu_status[theid] = 'hide';
        }
    }
}

menu_statusShow = new Array();
function show(theid){
    if (document.getElementById) {
    var switch_id = document.getElementById(theid);

        
           switch_id.className = 'show';
           menu_statusShow[theid] = 'show';
       
    }
}

menu_statusHide = new Array();
function Hide(theid){
    if (document.getElementById) {
    var switch_id = document.getElementById(theid);

        
           switch_id.className = 'hide';
           menu_statusHide[theid] = 'hide';
       
    }
}







