// JavaScript Document

window.addEvent('domready', function(){
	var array1 = $$('.toggle');
	var array2 = $$('.expandimg');
    array1.each(function(q,index) {
		q.fx = new Fx.Slide(q.id + "_content",{duration:300});
		q.fx.hide();
		q.state = "close";
		
		q.addEvent('click', function(e){
			e = new Event(e);
			this.fx.toggle();
			e.stop();
			var IMGid = eval(array2[index]);
			var index1 = index;
			if (this.state == "close") {
				$(IMGid).style.backgroundImage ='url("http://www.solnetcom.com/image/minus_small1.gif")';
				this.state = "open";
				for (i=0; i<=5; i++) {
				   if (i==index1) {continue};
				   array1[i].fx.slideOut();
				   array1[i].state = "close";
				   var IMGid = eval(array2[i]);
				   $(IMGid).style.backgroundImage ='url("http://www.solnetcom.com/image/plus_small1.gif")';
				}
			} else {
				this.state = "close";
			    $(IMGid).style.backgroundImage ='url("http://www.solnetcom.com/image/plus_small1.gif")';
			}
		});
    });

	if (location.pathname.indexOf('router') > -1) { //判断是否当前网址是否与router相关
		array1[0].state = "open";
		array1[0].fx.toggle();
		var IMGid = eval(array2[0]);
		$(IMGid).style.backgroundImage ='url("http://www.solnetcom.com/image/minus_small1.gif")';
	}

	if (location.pathname.indexOf('whiteboard') > -1) { //判断是否当前网址是否与whiteboard相关
		array1[1].state = "open";
		array1[1].fx.toggle();
		var IMGid = eval(array2[1]);
		$(IMGid).style.backgroundImage ='url("http://www.solnetcom.com/image/minus_small1.gif")';
	}
	if (location.pathname.indexOf('repeater') > -1) { //判断是否当前网址是否与repeater相关
		array1[2].state = "open";
		array1[2].fx.toggle();
		var IMGid = eval(array2[2]);
		$(IMGid).style.backgroundImage ='url("http://www.solnetcom.com/image/minus_small1.gif")';
	}
	if (location.pathname.indexOf('booster') > -1) { //判断是否当前网址是否与booster相关
		array1[3].state = "open";
		array1[3].fx.toggle();
		var IMGid = eval(array2[3]);
		$(IMGid).style.backgroundImage ='url("http://www.solnetcom.com/image/minus_small1.gif")';
	}
	if (location.pathname.indexOf('payphone') > -1) { //判断是否当前网址是否与payphone相关
		array1[4].state = "open";
		array1[4].fx.toggle();
		var IMGid = eval(array2[4]);
		$(IMGid).style.backgroundImage ='url("http://www.solnetcom.com/image/minus_small1.gif")';
	}

	var accordion = new Accordion('h3.tab', 'div.box', {
		opacity: false,
		onActive: function(toggler, element){
			toggler.setStyle('background-position', '0% 0%');
		},
		
		onBackground: function(toggler, element){
			toggler.setStyle('background-position', '0% -25px');
		}
	}, $('accordion'));

});
			





		
 
