/************************************** *********** COMMON SCRIPTS ************ **************************************/ window.addEvents({ 'domready':function(){ if($('main_image')){ var calendar = new CrossFade('calendar_gallery','calendar_element', { delay:5000 }); var news = new CrossFade('news_gallery','news_element', { delay:5000 }); var presidents = new CrossFade('column1Content','presidentsCircle', { delay:5000 }); }else{ var elemArray = $$('div.sub_col_tab_right'); var matchHeight = parseInt($('sub_col2').getStyle('height')) + 13; if(matchHeight < 239 || matchHeight > 300) matchHeight = 239; var height = matchHeight - ((parseInt(elemArray[0].getStyle('height')) + parseInt(elemArray[0].getStyle('padding-top')) + parseInt(elemArray[0].getStyle('padding-bottom'))) * elemArray.length); /* var accordion = new Accordion('div.sub_col_tab_left', 'div.sub_col_content_left', { alwaysHide: true, opacity: false, show: menuOpen, onActive: function(toggler, element){ toggler.setStyle('background','url(/CMS/images/minus.gif) no-repeat'); }, onBackground: function(toggler, element){ toggler.setStyle('background','url(/CMS/images/plus.gif) no-repeat'); } }, $('sub_col1')); */ var accordion_right = new Accordion('div.sub_col_tab_right', 'div.sub_col_content_right', { show:0, alwaysHide:false, opacity:false }, $('sub_col3')); } if($('product_detail_image_main')){ var primary_image = $('product_detail_image_main').src; $$('.product_thumb').each(function(el){ el.addEvents({ 'mouseenter': function(){ $('product_detail_image_main').src = this.src; }, 'mouseleave': function(){ $('product_detail_image_main').src = primary_image; } }); }); } if($('Same')){ $('Same').addEvent('click',function(){ if(this.checked == true){ $('shippingInfo').setStyle('display','none'); }else{ $('shippingInfo').setStyle('display','block'); } }); } if($('survey_submit')){ $('surveyConfirmation').setOpacity(0); $('survey_submit').addEvent('click',function(e){ var myFx = new Fx.Style('survey','opacity').start(0); var myFx2 = new Fx.Style('surveyConfirmation','opacity').start(1); }); } $$('.ext').each(function(el){ el.addEvent('click',function(e){ e = new Event(e).stop(); externalSite(el.href); }); }); var externalSite = function(href){ var time = 400; var overlay = new Element('div',{ 'events':{ 'click':function(){ closeOverlay(); } }, 'styles':{ 'position':'fixed', 'width':'100%', 'height':'100%', 'background-color':'#1d1d1d', 'left':'0', 'top':'0', 'z-index':'999998' }, 'id':'ext_overlay' }); var container = new Element('div',{ 'styles':{ 'width':'300px', 'background':'#ffffff', 'top':(window.getHeight() * .5) - 150, 'left':'50%', 'margin-left':'-150px', 'z-index':'999999', 'position':'fixed', 'padding':'10px', 'border':'2px solid #0053a1' }, 'id':'ext_container' }); var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/; if(IE6){ overlay.setStyle('position','absolute'); container.setStyle('position','absolute'); } var closeOverlay = function(){ var showContainer = new Fx.Styles(container,{ transition: Fx.Transitions.Quad.easeOut, duration: time }).start({ 'opacity':0, 'top':(window.getHeight() * .5) - 150 }); var hideOverlay = new Fx.Style(overlay,'opacity',{ transition: Fx.Transitions.Sine.easeOut, duration: time, onComplete:function(){ $('ext_container').empty(); $('ext_container').remove(); $('ext_overlay').empty(); $('ext_overlay').remove(); } }).start(0); } var containerBody = '
Leaving ElCentroChamber.org
By clicking the "Continue" button below, you\'ll be leaving the El Centro Chamber of Commerce website. '; containerBody += 'The content of ' + href + ' is not related to, '; containerBody += 'nor has it been approved by the El Centro Chamber of Commerce.
'; container.setHTML(containerBody); var cancelButton = new Element('a',{ 'id':'ext_cancel', 'class':'ext_button', 'events':{ 'click':function(){ closeOverlay(); } } }); cancelButton.setText('Cancel'); var continueButton = new Element('a',{ 'id':'ext_continue', 'class':'ext_button', 'events':{ 'click':function(){ var myAjax = new Ajax('/ajax.php', { method: 'post', data: { 'URL':href }, onComplete:function(){ window.location = href; } }).request(); } } }); continueButton.setText('Continue'); container.adopt(cancelButton); container.adopt(continueButton); container.setOpacity(0).inject(document.body,'top'); overlay.setOpacity(0).inject(document.body,'top'); var showOverlay = new Fx.Style(overlay,'opacity',{ transition: Fx.Transitions.Sine.easeOut, duration: time }).start(.5); var showContainer = new Fx.Styles(container,{ transition: Fx.Transitions.Quad.easeOut, duration: time }).start({ 'opacity':1, 'top':(window.getHeight() * .5) - 200 }); } }, 'load':function(){ //* if($('main_image')){ var so = new SWFObject("/swf/ecc_main.swf", "ecc_main", "785", "227", "8", "#ffffff"); so.addParam("wmode", "transparent"); so.write("main_image"); } // */ } }); function getFlashMovie(movieName) { var isIE = navigator.appName.indexOf("Microsoft") != -1; return (isIE) ? window[movieName] : document[movieName]; } function changeVideo(text) { getFlashMovie("conveyor_flv_player").sendTextToFlash(text); window.location = '#video_player'; } var CrossFade = new Class({ options: { startElem: 0, delay: 5000, speed: 800 }, initialize: function(wrapper,class_name,options){ this.setOptions(options); this.wrapper = wrapper; this.class_name = class_name; this.elems = $$('.' + class_name) this.i = this.options.startElem; this.firstItem = true; this.fadeAgain = false; this.moving = false; this.crossfade = ''; this.events(this); this.fade(); $$('.' + class_name).setOpacity(0); $$('.' + class_name).setStyle('position','absolute'); }, fade: function(){ if(this.moving == false){ if(this.firstItem == true){ this.elems[this.i].setOpacity(0); this.elems[this.i].setStyles({ 'display' : 'block', 'visibility' : 'visible' }); this.fadeEffect(0,1,this); this.firstItem = false; this.crossfade = this.fade.periodical(this.options.delay, this); }else { this.fadeEffect(1,0,this); this.i++; if (this.i == (this.elems.length)) this.i = 0; this.elems[this.i].setOpacity(0); this.elems[this.i].setStyles({ 'display' : 'block', 'visibility' : 'visible' }); this.fadeEffect(0,1,this); } } if(this.fadeAgain == true){ this.crossfade = this.fade.periodical(this.options.delay, this); this.fadeAgain = false; } }, fadeEffect: function(start,end,obj){ obj.moving = true; fadeFx = new Fx.Style(this.elems[this.i], 'opacity', { duration: this.options.speed, transition: Fx.Transitions.Quart.easeInOut, onComplete: function(){ obj.moving = false; } }); fadeFx.start(start,end); }, events: function(obj){ $(obj.wrapper).addEvents({ 'mouseenter' : function(){ $clear(obj.crossfade); }, 'mouseleave' : function(){ obj.fadeAgain = true; obj.fade(); } }); } }); CrossFade.implement(new Options, new Events);