window.addEvent('domready', function(){

	var siteAccordion = new Fx.Accordion($$('.e7p_div_autoshow_title'), $$('.e7p_div_autoshow_content'), {
		display:-1,
		alwaysHide: true
	});
	if($('sitecout')){ var sitec = $('sitecout'); } else { var sitec = $('sitecoutgp'); }
	$('dd-menu').addEvent('mouseenter', function(){
//		sitec.get('tween', {property: 'opacity', duration: 500}).start(0.3);
	});
	$('dd-menu').addEvent('mouseleave', function(){
//		sitec.get('tween', {property: 'opacity', duration: 'long'}).start(1);
	});

/*	$('dd-location').addEvent('mouseenter', function(){
		sitec.get('tween', {property: 'opacity', duration: 200}).start(0.3);
	});
	$('dd-location').addEvent('mouseleave', function(){
		sitec.get('tween', {property: 'opacity', duration: 500}).start(1);
	});*/
	if(Browser.Engine.trident && Browser.Engine.name=='trident' && Browser.Engine.version<=4){
		iexplorer6Resize();
		iexplorer6PngFix();
	};

	var i=0;
	for (var key in hoverImages) {
		var ele=$(key);
		if (ele) {
			if (ele.hasClass('e7p_img_container_img')) {
				var bgEle = new Element('div', {'styles': {
					'background-image': 'url(' + hoverImages[key][1] + ')'
				}});
				bgEle.inject(ele, 'before');
				ele.inject(bgEle,'top');

				var fx = new Fx.Tween(ele,{duration:5000});
				startFx.delay(i*1000,ele,fx);
				i++;
			} else {
				ele.addEvent('mouseenter',function(img) {
					this.setProperty('src',img);
				}.bind(ele,[hoverImages[key][1]]));
				ele.addEvent('mouseleave',function(img) {
					this.setProperty('src',img);
				}.bind(ele,[hoverImages[key][0]]));
			}

		}
	}
});


window.addEvent('scroll', function() { iexplorer6Resize(); });
window.addEvent('resize', function() { iexplorer6Resize(); });
iexplorer6Resize = function() {
	if(Browser.Engine.trident && Browser.Engine.name=='trident' && Browser.Engine.version<=4){
		var scrolli = $('bodyID').getScroll();
		if($('sitecout')){
			var sitec = $('sitecout').getCoordinates();
			var headout = $('headout');
			var footerout = $('footerout');
			var heightclient = 189;
			var heighthead = 154;
			var heightfoot = 35;
		} else {
			var sitec = $('sitecoutgp').getCoordinates();
			var headout = $('headoutgp');
			var footerout = $('footeroutgp');
			var heightclient = 189;
			var heighthead = 154;
			var heightfoot = 35;
		}
		if(sitec.height>=document.body.clientHeight-heightclient){ $('bodyimgdiv').setStyle('height',sitec.height+heighthead);
		} else { $('bodyimgdiv').setStyle('height',document.body.clientHeight); }
		$('bodyimg').setStyle('top',scrolli.y+heighthead);
		headout.setStyle('top',scrolli.y);
		footerout.setStyle('top',scrolli.y+document.body.clientHeight-heightfoot);
	};
}
iexplorer6PngFix = function() {
	for(var i=0; i<document.images.length; i++) {
		var img = document.images[i]
		var imgName = img.src.toUpperCase()
		if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {

			var imgID = (img.id) ? "id='" + img.id + "' " : ""

			var imgClass = (img.className) ? "class='" + img.className + "' " : ""
			var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
			var imgStyle = "display:block;"
			if (img.align == "left") imgStyle = "float:left;" + imgStyle
			if (img.align == "right") imgStyle = "float:right;" + imgStyle
			if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
			var strNewHTML = "<div " + imgID + imgClass + imgTitle
			+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
			+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
			+ "(src=\'" + img.src + "\', sizingMethod='image');\"></div>";
			img.outerHTML = strNewHTML;
			//$('headout').appendText(document.images[i].width+'x'+document.images[i].height+';');
			i = i-1
		}
	}
};
var topMenu = new UvumiDropdown('dd-menu',{
	duration:150,
	delay:300,
	transition:Fx.Transitions.linear,
	clickToOpen:false
});

var locMenu = new UvumiDropdown('dd-location',{
	duration:150,
	delay:300,
	clickToOpen:false
});

function startFx(fx) {
	fx.start('opacity', 0).chain(function() {
		this.start('opacity', 1);
	}).chain(function() {
		startFx(this);
	});
}


