window.addEvent('domready', function() {
	//create our Accordion instance
	var myAccordion = new Accordion($('accordion'), 'div.texthead', 'div.textbox', {
		opacity: true,
		onActive: function(toggler, element){
			toggler.setStyle('color', '#DAA520');
		},
		onBackground: function(toggler, element){
			toggler.setStyle('color', '#DAA520');
		}
	});
	
	var textheads = $$('div.texthead', 'div.widetexthead')
	
	textheads.addEvents({
	    'mouseover': function(){
          this.style.backgroundColor = "#DAA520";
		  this.style.color = "#333426";
          this.style.cursor = "pointer";
          },
        'mouseout' : function(){
          this.style.backgroundColor = "#333426";
		  this.style.color = "#DAA520";
          this.style.cursor = "auto";}
    });
    
/*	var myAccordion2 = new Accordion($('accordion_news'), 'div.texthead_news', 'div.textbox_news', {
		opacity: false,
		onActive: function(toggler, element){
			toggler.setStyle('color', '#993333');
		},
		onBackground: function(toggler, element){
			toggler.setStyle('color', '#007e64');
		}
	});
	*/
//wide accordion
	var myAccordion3 = new Accordion($('wideaccordion'), 'div.widetexthead', 'div.widetextbox', {
		opacity: true,
		onActive: function(toggler, element){
			toggler.setStyle('color', '#FF6666');
		},
		onBackground: function(toggler, element){
			toggler.setStyle('color', '#769912');
		}
	});
	
	$$('.tooltip').each(function(element,index) {  
    var content = element.get('title').split('::');  
         element.store('tip:title', content[0]);  
         element.store('tip:text', content[1]);  
	});

	//create the tooltips
	var tooltip = new Tips('.tooltip',{
		className: 'tooltip',
			fixed: false,
	    showDelay:50,
        hideDelay:50
	});

	/*
	tooltip.addEvents({  
		'show': function(tip) {  
			tip.fade('show');  
		},
		
		'hide': function(tip) {  
			tip.fade('out');  
		}  
	});
	*/
	
	
	a = new Array(1,0,0,1,0,0,1,0,1,0,1,1,1,2,2,2,3,3,4,4,5,4,4,3,3,2,2,2,1,1,1,1,0,1,0,0,1,0,1,0);
	hor = new Array;
	htemp = 165; // margin-left = -160px;
	for (var i=0; i<a.length; i++){
		htemp += a[i];
		hor[i] = "'-" + htemp + "px'";
	}
		
	b = new Array(0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0);
	ver = new Array;
	vtemp = 5; // padding-bottom = 5px;
	for (var i=0; i<b.length; i++){
		vtemp -= b[i];
		ver[i] = "'" + vtemp + "px'";
	}
	
	var stops = $$('img.knob');
	
	for(var label=0; label<stops.length; label++){
		stops[label].id = 'in'+label;
	}

	stops.addEvents({
		'click' : function(){
			if(this.id=="out"){
				this.id="temp";
				setTimeout("pushitin()",30);
			}
			else{
				this.id = "temp";
				setTimeout("pullitout()",30);
			}
		},
		
		'mouseover': function(){
          this.style.cursor = "pointer";
        },
		  
        'mouseout' : function(){
          this.style.cursor = "auto";
		}
	});
	
}); // onLoad

var c = -1;
var d = 40;

function pullitout(){
	var pull = document.getElementById("temp");
	
	if (c++<a.length){
		pull.style.marginLeft = eval(hor[c]);
		pull.style.paddingBottom = eval(ver[c]);
		if (c!=a.length-1){
			setTimeout("pullitout()",20);	
		}
		else{
			pull.id = "out";
			c=0;
		}
	}
};	

function pushitin(){
var stop = document.getElementById("temp");
	if (d-->0){
		stop.style.marginLeft = eval(hor[d]);
		stop.style.paddingBottom = eval(ver[d]);

		if (d==0){
			stop.id = "in";
			d=39;
		}
		else{
			setTimeout("pushitin()",20);
		}
	}
};

var newWind;
function regform(i){
  if(!newWind || newWind.closed)
    {newWind=window.open("http://www.ypsipipes.org/register.php","lank","toolbar=no, location=no, directories=no, status=no, menubar=no, status=no, titlebar=no, scrollbars=yes, resizable=no, copyhistory=no, width=500, height=760");
    }
  else{
    newWind.focus();}
}


if (document.images) {
		img1_on =new Image(); img1_on.src ="/img/nav_01_on.gif"; 
		img1_off=new Image(); img1_off.src="/img/nav_01_off.gif"; 

		img2_on =new Image(); img2_on.src ="/img/nav_02_on.gif"; 
		img2_off=new Image(); img2_off.src="/img/nav_02_off.gif"; 

		img3_on =new Image(); img3_on.src ="/img/nav_03_on.gif"; 
		img3_off=new Image(); img3_off.src="/img/nav_03_off.gif"; 

		img4_on =new Image(); img4_on.src ="/img/nav_04_on.gif"; 
		img4_off=new Image(); img4_off.src="/img/nav_04_off.gif"; 

		img5_on =new Image(); img5_on.src ="/img/nav_05_on.gif"; 
		img5_off=new Image(); img5_off.src="/img/nav_05_off.gif";

		img6_on =new Image(); img6_on.src ="/img/nav_06_on.gif"; 
		img6_off=new Image(); img6_off.src="/img/nav_06_off.gif"; 
		
}

function movr(k) {
	if (document.images){
	  document.getElementById("img"+k).src=eval('img'+k+'_on.src');
   document.getElementById("img"+k).blur();
    }
}

function mout(k) {
	if (document.images){
    document.getElementById("img"+k).src=eval('img'+k+'_off.src');
    document.getElementById("img"+k).blur();
    }
}

function mdwn(k) {
	if (document.images){
    document.getElementById("img"+k).src=eval('img'+k+'_off.src');
    document.getElementById("img"+k).blur();
    }
}

function mup(k) {
	if (document.images){
    document.getElementById("img"+k).src=eval('img'+k+'_on.src');
    document.getElementById("img"+k).blur();
    }
}

function changeCursor(i) {
	if(i=='1'){
		document.anchor.style.cursor="pointer";
	}
	else{
		document.anchor.style.cursor="auto";
	}
}