// home page java script

function absoluteTop (node) {
var top = 0;
while (node.offsetParent) {
top += node.offsetTop;
node = node.offsetParent;
}
return top;
};


function weather(w){
	AjaxRequest.get(
	{
	    //'url':'https://www.snowlist.com/Weathertest.aspx?p='+w, 'onSuccess':function(req){document.getElementById('o').innerHTML = req.responseText;}
	 	 'url':'https://www.snowlist.com/Weathertest.aspx?p='+w, 'onSuccess':function(req){var rs =req.responseText; rs=rs.replace('form','span'); document.getElementById('o').innerHTML = rs;}
	 }
	);
	
	var at = absoluteTop('weatherDisplay');
	setTimeout("document.getElementById('weatherDisplay').innerHTML = document.getElementById('w').innerHTML;",500);
	setTimeout("document.getElementById('weatherDisplay').style.backgroundColor = '#eeeeee';",550);
//	setTimeout("document.getElementById('weatherDisplay').style.backgroundColor = '#ffff80';",1555);
//	setTimeout("document.getElementById('weatherDisplay').style.backgroundColor = 'transparent';",2555);
//	setTimeout("document.getElementById('weatherDisplay').style.backgroundColor = '#eeeeee';",3050);
//	setTimeout("document.getElementById('weatherDisplay').style.backgroundColor = '#ffff80';",3555);
	setTimeout("document.getElementById('weatherDisplay').style.backgroundColor = 'transparent';",4055);

} 
 

//avalanche 
function popup(){
	testwindow=window.open("avalanche/default.aspx", "mywindow", "location=1,status=1,scrollbars=0,width=500,height=500");
	testwindow.moveTo((screen.width/2)-200,(screen.height/2)-200);
}


function $(id){
	var result = arguments.length === 1 ? document.getElementById(id) : 0;
	if(!result) {
		result = [];
		for(var i = 0, j = arguments.length; i < j; i++)
			result.push(document.getElementById(arguments[i]));
	};
	return result;
};

function acc(el){
	function show(){

		//alert(this.id);
		if(this.id != 'id1Acc'){document.getElementById('id1AccImg').src = '/images/homepage/hdr_wintergear_178x21.gif';}
		if(this.id != 'id2Acc'){document.getElementById('id2AccImg').src = '/images/homepage/hdr_summergear_178x21.gif';}
		if(this.id != 'id3Acc'){document.getElementById('id3AccImg').src = '/images/homepage/hdr_mtnequipment_178x21.gif';}
		if(this.id != 'id4Acc'){document.getElementById('id4AccImg').src = '/images/homepage/hdr_employment_178x21.gif';}
		if(this.id != 'id5Acc'){document.getElementById('id5AccImg').src = '/images/homepage/hdr_services_178x21.gif';}
		if(this.id != 'id6Acc'){document.getElementById('id6AccImg').src = '/images/homepage/hdr_personals_178x21.gif';}

		this.style.display='';
		bytefx.size(this, {width:this.Width,height:this.Height}, 100);

		if(this.id=='id1Acc'){document.getElementById('id1AccImg').src = '/images/homepage/hdr_wintergear_178x21_d.gif';}
		if(this.id=='id2Acc'){document.getElementById('id2AccImg').src = '/images/homepage/hdr_summergear_178x21_d.gif';}
		if(this.id=='id3Acc'){document.getElementById('id3AccImg').src = '/images/homepage/hdr_mtnequipment_178x21_d.gif';}
		if(this.id=='id4Acc'){document.getElementById('id4AccImg').src = '/images/homepage/hdr_employment_178x21_d.gif';}
		if(this.id=='id5Acc'){document.getElementById('id5AccImg').src = '/images/homepage/hdr_services_178x21_d.gif';}
		if(this.id=='id6Acc'){document.getElementById('id6AccImg').src = '/images/homepage/hdr_personals_178x21_d.gif';}

	};
	function hide(){
		bytefx.size(this, {width:this.Width,height:1}, 100, function(){
			this.style.display = "none";
		});

		//alert(this.id);
		//if(this.id != 'id1Acc'){document.getElementById('id1AccImg').src = '/images/homepage/hdr_wintergear_178x21.gif';}

	};
//	function begin(){
//		//alert(this.id);
//		for(var j = 0; j < max; j++) {
//			if(j !== i)
//				el[j].hide();
//		};
//		this.show();
//	};
//	var	tmp, i = 0, max = el.length;
//	for(; i < max; i++) {
//		tmp = bytefx.$size(el[i]);
//		el[i].Height = tmp.height;
//		el[i].Width = tmp.width;
//		el[i].show = show;
//		el[i].hide = hide;
//		el[i].begin = begin;
//	};
//	return {
//		begin:function(idx){
//			if(!idx || idx >= el.length)
//				idx = 0;
//			el[idx].begin();
//		}
//	}
//};

onload=function(){
	for(var	tmp = $('id1Acc', 'id2Acc', 'id3Acc', 'id4Acc', 'id5Acc', 'id6Acc'), a = acc(tmp), i = 0; i < tmp.length; i++) {
		tmp[i].style.display = "none";
		a = tmp[i].parentNode.childNodes[0];
		if(!a.innerHTML)
			a = tmp[i].parentNode.childNodes[1];
		bytefx.$event(a, "onmouseover", function(){
			this.style.background = "#0D69C0";
		});
		bytefx.$event(a, "onmouseout", function(){
			this.style.background = "#474D5E";
		});
	};
	tmp[0].begin();
}

};



//var a = new Image(); a.src = 'images/homepage/more_gray_34x11.gif';
//var b = new Image(); b.src = 'images/homepage/more_gray_34x11_on.gif';
//var c = new Image(); c.src = 'ql/quick_links_button.gif';
//var d = new Image(); d.src = 'ql/quick_links_button_on.gif';
//var e = new Image(); e.src = 'ql/quick_links_button_plain.gif';
//var f = new Image(); f.src = 'ql/quick_links_button_plain_on.gif';
