var Rotator=new Class({Implements:[Options,Events],options:{slideInterval:4000,transitionDuration:1000,startIndex:0,autoplay:true},initialize:function(B,A){this.setOptions(A);this.slides=$$(B);this.createFx();this.showSlide(this.options.startIndex);if(this.slides.length<2){this.options.autoplay=false}if(this.options.autoplay){this.autoplay()}return this},toElement:function(){return this.container},createFx:function(){if(!this.slideFx){this.slideFx=new Fx.Elements(this.slides,{duration:this.options.transitionDuration})}this.slides.each(function(A){A.setStyle("opacity",0)})},showSlide:function(B){var A={};this.slides.each(function(C,D){if(D==B&&D!=this.currentSlide){A[D.toString()]={opacity:1}}else{A[D.toString()]={opacity:0}}},this);this.fireEvent("onShowSlide",B);this.currentSlide=B;this.slideFx.start(A);return this},autoplay:function(){this.slideshowInt=this.rotate.periodical(this.options.slideInterval,this);this.fireEvent("onAutoPlay");return this},stop:function(){$clear(this.slideshowInt);this.fireEvent("onStop");return this},rotate:function(){current=this.currentSlide;next=(current+1>=this.slides.length)?0:current+1;this.showSlide(next);this.fireEvent("onRotate",next);return this}});

window.addEvent('domready', function(){

	var myAccordion = new Accordion($('accordion'), 'h3.toggler', 'div.element', {
		opacity: false,
		onActive: function(toggler, element){
			toggler.setStyle('color', '#41464D');
		}
	});
	
	var rotator = new Rotator('.rotate',{
	slideInterval:5000, 	//Length of showing each element, in milliseconds
	transitionDuration:2000 //Length crossfading transition, in milliseconds
	});
	
	$('share').setStyle('height','auto');
	var mySlide = new Fx.Slide('share').hide();  //starts the panel in closed state  

    $('toggleShare').addEvent('click', function(e){
		e = new Event(e);
		mySlide.toggle();
		e.stop();
	});
	
	var fields = {
                        your_email:           'Required Email',
                        friend_email:            'Required Email'
                };
                var val = new validate('form1', fields, {
                        useAjaxSubmit:true,
                        AjaxSubmitOptions: {
                                evalScripts: true,

                                onComplete: function(response) {
                                        $('log').set('aspx',response);
                                }
                        }
                });

});

startList = function() {
if (document.all&&document.getElementById) {
cssdropdownRoot = document.getElementById("nav");
for (x=0; x<cssdropdownRoot.childNodes.length; x++) {
node = cssdropdownRoot.childNodes[x];
if (node.nodeName=="h3") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
}

if (window.attachEvent)
window.attachEvent("onload", startList)
else
window.onload=startList;

function popUp(winURL)
	{
	newwin = window.open( winURL );
	}

window.onload = function() {
    document.body.onclick = function (e) {
        //alert((function(theObj){var retval ="";for(prop in theObj){retval+=prop+":"+theObj[prop]+"\n";}return retval;})(e.target));
        var theElement = ( (typeof e != "undefined") ? (e.target) : (event.srcElement) );
        var theElementTarget = theElement.getAttribute("target");
        var theLinkUrl = theElement.getAttribute("href");
        if( (theElementTarget == "_blank") && (theLinkUrl.substr(0,1) != "/") && (theLinkUrl.indexOf("/pdf/")<0) && !confirm("You are now leaving the Web site. Do you want to continue?") ) {
            // Cancel Event
            //try {e.preventDefault()} catch (var temp){}
            //try {e.stopPropagation()} catch (var temp) {}
            return false;
        }
    }
}


