/**
 * @author mwarren in order to make overlays nonobtrusive as requested by DFS
 */
 
 
 	mcd.dom.ready(function(){

			mcd.Overlay.manager.init({
				
				'virtual-tour-overlay' : {
					position : {
						'x' : 200,
						'y' : 200
					},					
					terminators: {
						'virtual-tour-overlay-close' : function () { return true; }
					}
				},
		
				'identity-theft-protection-overlay' : {
					position : {
						'x' : 200,
						'y' : 200
					},					
					terminators: {
						'identity-theft-protection-overlay-close' : function () { return true; }
					}
				},
				
				'client-testimonials-overlay' : {
					position : {
						'x' : 200,
						'y' : 0
					},					
					terminators: {
						'client-testimonials-overlay-close' : function () { return true; }
					}
				}		
			});
			
			
			// resize control
	        mcd.event.add(window, 'resize', function (event) {
	        	resetWindow();
	        }, this);
	       
			// on click check window size 
	        mcd.event.add('resize-vt', 'click', function (event) {
	        	resetWindow();
	        }, this);    
	        mcd.event.add('resize-identity', 'click', function (event) {
	        	resetWindow();
	        }, this);
	        mcd.event.add('resize-testimonials', 'click', function (event) {
	        	resetWindow();
	        }, this);        
	        
	        
	       /*
	        * resize window function
	        */
	        
	        var resetWindow = function() {

	                try {
	                    var viewportHeight = mcd.dom.getViewportHeight();
	                    var viewportWidth = mcd.dom.getViewportWidth();
	     
	                    // grab all open overlays
	                    var oo = mcd.dom.getElementsByAttribute('class', 'overlay-large', document.body , 'div', true);
						var shim = mcd.dom.getElementsByAttribute('class', 'overlay-shim', document.body , 'iframe', true);
	                    if ((viewportHeight < 700) || (viewportWidth < 900)) {
	
	                        for(var i=0; i<oo.length; i++) {
	
	                        	oo[i].style.top = '0px';
	                        	oo[i].style.left = '0px';
	                        	oo[i].style.marginLeft = '0px';
	                        	oo[i].style.marginTop = '0px';   
								//placement of iframes
								shim[i].style.top = '0px';
	                        	shim[i].style.left = '0px';
	                        	shim[i].style.marginLeft = '0px';
	                        	shim[i].style.marginTop = '0px';                      	   
	                        }
	                    }

	                } catch (exception) {}
	              	
	        };
					
		});	