/**************************************************
 * AUSTROZOOM.AT Javascript Non-GWT Effects
 * Last Changes 2011-07-08
 **************************************************/
   
////////////  Global variables  ////////////
 
var buttonOver = panelOver = panelVisible = 0;
var mapButtonOver = mapPanelOver = mapPanelVisible = 0;
var panel, iconEffect, panelEffect, subpanelEffect, imageTextAnimationTimer, mapTypePanelTimer;
var infoWindowContent = 'welcome';
var panelAnimationProgress = 0;
var friendlyURL = false;

////////////  Settings  //////////
var infoWindowHeight = 550;     // [px]
var welcomeWindowHeight = 50;   // [px]
var messageHeight = 200;        // [px]
var addressWindowHeight = 188;  // [px]
var webcamWindowHeight = 410;   // [px]
var trafficWindowHeight = 150;  // [px]
var panelEffectDuration = 0.5;  // [s]
var buttonSize = 25;            // [px]
var imageEffectDuration = 2;    // [s]
var imageEffectInterval = 10;   // [s]

// Panel array
var panelArray = new Array();
// PANEL ARRAY ITEM = { Popup class, Popup content class, Popup content size, Open/close button, Panel tatus (open/closed), Position }
panelArray[0] = new Array('.filter-popup', '.simple-content', 350, '.main-category-panel-control', 1, 'left');
panelArray[1] = new Array('.top-search-popup', '.filter-top-panel', 350, '.search-panel-control', 1, 'left');
panelArray[2] = new Array('.map-control-popup', '.map-control-simple-panel', 90, '.map-control-popup-button', 1, 'right');
panelArray[3] = new Array('.info-window-popup', '.info-window-panel', 525,'.info-control-button', 1, 'bottom');
panelArray[4] = new Array('.social-popup', '.social-simple-panel', 164,'.social-bt', 1, 'top');
panelArray[5] = new Array('.map-type-window', '.map-type-window div', 166, null, 0, 'right');
panelArray[6] = new Array('.times-popup', '.times-simple-content', 65, '.times-panel-control', 1, 'top');

// friendly url check
var furl = window.location.hash;
if(furl.length > 1)
	friendlyURL = true;

// 3,2,1 START!
check_dom();

////////////  CHECK DOM  ////////////
 
// If DOM is complete => then call js_effects()
function check_dom(){
	var elm = $$('.map-panel .x-panel-bwrap .x-panel-body .x-component .gmnoprint a');
	if(elm[0] == undefined) 
		setTimeout('check_dom()',1000);
	else 
		setTimeout('js_effects()',500);//js_effects();
}

////////////  Main function with JS effects  //////////// 

function js_effects(){
	// -----------------------------------------------
	// Panel animations 
	panelArray.each( function(item, index){
		// button click event
		var elm = $$(item[3]);
		openCloseBt = elm[0];
		if(openCloseBt != undefined){
			// Button click event
			openCloseBt.observe('click', function(){
					slidePanel(index);
			});
		}
	} );
	//init some panels
	initPanel(1);
	initPanel(2);
	initPanel(4);
	initPanel(6);
	mapTypePanel();
	// normal init 
	if(!friendlyURL){
		initPanel(0);
		initPanel(3);
		setTimeout(function(){
			slidePanel(0);
		}, 1000);
	}
	// init on friendly url start
	else{
		var p = $$(panelArray[0][0]); var panel = p[0]; 
		panel.setStyle('visibility:visible;');
		var p = $$(panelArray[3][0]); var panel = p[0]; 
		panel.setStyle('visibility:visible;');
	}
	setTimeout(function(){
		slidePanel(1);
		slidePanel(2);
	}, 1000);
	
	// -----------------------------------------------
	// Subpanel appear & fade effect
	var bt1 = $$('.bt30');
	// if button in mainpanel exists - register events
	if(bt1.length > 0){
		registerButtonEvents();
	}
	
	// -----------------------------------------------
	// Partner window
	$('partner-link').observe('click', function(event){
		Event.stop(event);
		partnersWindow();
	} );
	if($('partner-window').getStyle('display') == 'block' ){
		$('partner-close-button').observe('click', function(){
			$('partner-window').hide(); 
		} );
	}
	
	// -----------------------------------------------
	// Google logo
	$$('.map-panel .x-panel-bwrap .x-panel-body .x-component .gmnoprint a').each(function(element){
		element.setStyle({marginLeft:'122px'});
	} );
	$$('.gmnoprint[jstcache="0"]').each(function(element){
		element.setStyle({left:'196px'});
	} );
}

function mapTypePanel(){
	
	var p = $$(panelArray[5][0]); var panel = p[0];  
	var p = $$(panelArray[5][1]); var contentPanel = p[0];
	var open = panelArray[5][4];
	var pos = panelArray[5][5];
	
	panel.makeClipping();  
	// initial closing effect
	new Effect.Parallel([
		new Effect.Morph(contentPanel, {sync:true, style:'width:1px;'}),
		new Effect.Move(panel.firstChild, {sync:true, x:1, mode: 'absolute'})
	], {duration:0,
	afterFinish:function(){
		panel.setStyle('visibility:visible;');
	} });
	// set closed panel status
	panelArray[5][4] = 0;
	
	// Map type button events
	var a = $$('.maptypebt'); var mapTypeButton = a[0]; 
	if(mapTypeButton != undefined){
		mapTypeButton.observe('mouseover', function(){
			mapButtonOver = 1;
			setTimeout(checkMapTypePanel,50);	
		});
		mapTypeButton.observe('mouseout', function(){
			mapButtonOver = 0;
			setTimeout(checkMapTypePanel,500);
		});
	}
	
	// Map type window events
	var a = $$('.map-type-window'); var mapTypeWindow = a[0];
	mapTypeWindow.observe('mouseout', function(){
		mapPanelOver = 0;
		setTimeout(checkMapTypePanel,500);
	});
	mapTypeWindow.observe('mouseover', function(){
		mapPanelOver = 1;
		setTimeout(checkMapTypePanel,50);
		
	});
	var mapTypeButtons = $$('.map-type-window button'); 
	mapTypeButtons.each(function(element){
		element.observe('click', mapTypePanelClose);
	}  );
}

function checkMapTypePanel(){
	if((mapButtonOver == 1 || mapPanelOver == 1) && panelArray[5][4] == 0)mapTypePanelOpen();
	if((mapButtonOver == 0 && mapPanelOver == 0) && panelArray[5][4] == 1)mapTypePanelClose();
	if(mapButtonOver == 0 && mapPanelOver == 0 && panelArray[5][4] == 0){
		panelArray[5][4] == 1;
		mapTypePanelClose();
	}		
}

function mapTypePanelOpen(){
	clearTimeout(mapTypePanelTimer);
	if(panelArray[5][4] != 1){
		panelArray[5][4] = 0;
		if(panelEffect.currentFrame > 40)
		slidePanel(5);
	}
	setTimeout(checkMapTypePanel, 1000);
}

function mapTypePanelClose(){
	clearTimeout(mapTypePanelTimer);
	a = $$('.map-type-window');
	mapTypeWindow = a[0];
	if(panelArray[5][4] != 0){
		panelArray[5][4] = 1;
		if(panelEffect.currentFrame > 40)
		slidePanel(5);
	}
}

////////////  PANEL SLIDE EFFECTS  ////////////

function initPanel(index){
	// panel properties -> elementArray
	var elementArray = panelArray[index];
	var p = $$(elementArray[0]); var panel = p[0]; 
	var p = $$(elementArray[3]); var button = p[0]; 
	var p = $$(elementArray[1]); var contentPanel = p[0];
	var open = elementArray[4];
	var pos = elementArray[5];
	
	panel.makeClipping();  
	if(pos == 'left' || pos == 'right'){
		if(pos == 'left') effectDirection = 1;
		if(pos == 'right') effectDirection = -1;
		new Effect.Parallel([
			new Effect.Morph(contentPanel, {sync:true, style:'width:1px;'}),
			new Effect.Move(panel.firstChild, {sync:true, x:(-1*effectDirection), mode: 'absolute'})
		], {duration:0,
		afterFinish:function(){
			panel.setStyle('visibility:visible;');
		} });
	}
	else{
		if(pos == 'top') effectDirection = 1;
		if(pos == 'bottom') effectDirection = -1;
		new Effect.Parallel([
			new Effect.Morph(contentPanel, {sync:true, style:'height:1px;'}),
			new Effect.Move(panel.firstChild, {sync:true, y:(-1*effectDirection), mode: 'absolute'})
		], {duration:0, 
		afterFinish:function(){
			panel.setStyle('visibility:visible;');
		} });
		
	}
	
	// set closed button style
	button.addClassName('closed');
	// set closed panel status
	panelArray[index][4] = 0;
}

// Panel slide animation - main function
function slidePanel(index){
	// panel properties -> elementArray
	var elementArray = panelArray[index];
	// panel
	var p = $$(elementArray[0]);
	var panel = p[0];
	// open/close button 
	var p = $$(elementArray[3]);
	var button = p[0];
	// content panel 
	var p = $$(elementArray[1]);
	var contentPanel = p[0];
	var effectDirection;
	
	if(index == 2 && elementArray[4] == 1 && panelArray[5][4] == 1){
		mapTypePanelClose();
	} 
	
	if(elementArray[5] == 'left'){
		effectDirection =  1;
		slidePanelHorizontal(index, effectDirection);
	}
	else if(elementArray[5] == 'right'){
		effectDirection = -1;
		slidePanelHorizontal(index, effectDirection);
	}
	else if(elementArray[5] == 'bottom' ){
		effectDirection = -1;
		slidePanelVertical(index, effectDirection);
	}
	else{
		effectDirection = 1;
		slidePanelVertical(index, effectDirection);
	}

}
// Panel horizontal slide animation
function slidePanelHorizontal(index, effectDirection){
	// panel properties -> elementArray
	var elementArray = panelArray[index];
	var p = $$(elementArray[0]);
	var panel = p[0]; 
	var p = $$(elementArray[3]);
	var button = p[0]; 
	var p = $$(elementArray[1]);
	var contentPanel = p[0];
	var open;
	// panel open-status variable
	open = elementArray[4];
		
	// panel content width 
	if(contentPanel.getWidth() > 10)
		panelArray[index][2] = contentPanel.getWidth();
	// panel width for animation (-25px button width)
	var width = panel.firstChild.getWidth() - buttonSize;
	// closing animation
	if(open == 1){
		panelAnimationProgress = 1;
		panel.makeClipping();  
		// move
		panelEffect = new Effect.Move(panel.firstChild, {x:(-(elementArray[2])*effectDirection), mode: 'absolute', duration:panelEffectDuration, afterFinish: function(){
			// after move -> restore position + change width to 1px - parallel
			new Effect.Parallel([
				new Effect.Morph(contentPanel, {sync:true, style:'width:1px;'}),
				new Effect.Move(panel.firstChild, {sync:true, x:(-1*effectDirection), mode: 'absolute'})
			], {duration:0});
			// set closed button style
			if(button != undefined)
				button.addClassName('closed');
			// set closed panel status
			panelArray[index][4] = 0;
			panelAnimationProgress = 0;
		} });
	}
	// open animation
	else{
		panelAnimationProgress = 1;
		// move to position before closing + change width to original
		new Effect.Parallel([
			new Effect.Move(panel.firstChild, {sync:true, x:(-(elementArray[2])*effectDirection), mode: 'absolute'}),
			new Effect.Morph(contentPanel, {sync:true, style:'width:'+elementArray[2]+'px;'})
		], {duration:0});
		
		// move
		panelEffect = new Effect.Move(panel.firstChild, {x:0, mode: 'absolute', delay:0.1, duration: panelEffectDuration, afterFinish: function(){
			if(index != 5)
				panel.undoClipping();
			// set open panel status
			panelArray[index][4] = 1;
			panelAnimationProgress = 0;	
			// set open button style
			if(button != undefined)
				button.removeClassName('closed');
		} });
	}
}
// Panel vertical slide animation
function slidePanelVertical(index, effectDirection){
	var elementArray = panelArray[index];
	var p = $$(elementArray[0]);
	var panel = p[0]; 
	var p = $$(elementArray[3]);
	var button = p[0]; 
	var p = $$(elementArray[1]);
	var contentPanel = p[0];
	var open;
	// panel open-status variable
	open = elementArray[4];
	
	// panel content height
	if(contentPanel.getHeight() > 10)
        animationHeight = contentPanel.getHeight();
	else
        animationHeight = elementArray[2];
	
	// panel width for animation (-25px button height)
	var height = panel.firstChild.getHeight() - buttonSize;
	// closing animation
	if(open == 1){
		panelAnimationProgress = 1;
		panel.makeClipping();  
		panelEffect = new Effect.Move(panel.firstChild, {y:(-(animationHeight)*effectDirection), mode: 'absolute', duration: panelEffectDuration, afterFinish: function(){
			
			new Effect.Parallel([
				new Effect.Morph(contentPanel, {sync:true, style:'height:1px;', duration:0}),
				new Effect.Move(panel.firstChild, {sync:true, y:(-1*effectDirection), mode: 'absolute', duration:0})
			], {duration:0});
			
			if(button != undefined)
				button.addClassName('closed');
			
			panelArray[index][4] = 0;
			panelAnimationProgress = 0;
		} });
	}
	// open animation
	else{
		panelAnimationProgress = 1;
		new Effect.Parallel([
			new Effect.Move(panel.firstChild, {sync:true, y:(-(animationHeight)*effectDirection), mode: 'absolute', duration:0}),
			new Effect.Morph(contentPanel, {sync:true, style:'height:'+animationHeight+'px;', duration:0})
		], {duration:0});
		
		panelEffect = new Effect.Move(panel.firstChild, {y:0, mode: 'absolute', delay:0.1, duration: panelEffectDuration, afterFinish: function(){
			panel.undoClipping();
			
			panelArray[index][4] = 1;
			panelAnimationProgress = 0;
			
			if(button != undefined)
				button.removeClassName('closed');
		} });
	}
}

// Test if POI window is open - for GWT
function isOpenPOI(){
	if(panelArray[3][4] && infoWindowContent == 'info'){
		return true;
	}
	else{
		return false;
	}
}

// Open infowindow popup function (after click on marker) - for GWT
function openInfoPopup(){
	clearInterval(imageTextAnimationTimer);
		
	var itemArray = panelArray[3];
	itemArray[2] = infoWindowHeight;
	// open panel if is closed only
	if(itemArray[4] == 0){
		// args = panelArray item, panelArray item index
		setTimeout(function(){slidePanel(3)},300);
	}
	// if panel is not closed -> resize to infowindow height only
	else if(infoWindowContent == 'start' || infoWindowContent == 'address' ||  infoWindowContent == 'webcam' ||  infoWindowContent == 'traffic'){
		p = $$(itemArray[1]);
		contentPanel = p[0];
		
		new Effect.Morph(contentPanel, {style:'height: ' + infoWindowHeight + 'px', delay:0.5, duration: panelEffectDuration*2, afterFinish: function(){
		
		} });
	}
	infoWindowContent = 'info';
	setTimeout(imageTextInit,500);
}
// Resize infowindow to startup window height - for GWT
function resizeInfoPopup(){
	var itemArray = panelArray[3];
	panelArray[3][2] = welcomeWindowHeight;
	
	clearInterval(imageTextAnimationTimer);
	
	if(itemArray[4] == 1){
		//closeInfoPopup();
	}
	infoWindowContent = 'start';
}
// Close infowindow - for GWT
function closeInfoPopup(){
	clearInterval(imageTextAnimationTimer);
	
	if(panelArray[3][4] == 1){
		setTimeout(function(){slidePanel(3);},200);
	}
}
// Open message/alert in infowindow - for GWT
function openMessage(){
	var itemArray = panelArray[3];
	panelArray[3][2] = messageHeight;
	// open panel if is closed only
	if(itemArray[4] == 0){
		// args = panelArray item, panelArray item index
		setTimeout(function(){slidePanel(3)},300);
	}
	// if panel is not closed -> resize to infowindow height only
	else if(infoWindowContent == 'start' || infoWindowContent == 'info' ){
		p = $$(itemArray[1]);
		contentPanel = p[0];
		contentPanel.fade({duration: 0, from:1, to:0.01});
		new Effect.Morph(contentPanel, {style:'height: ' + messageHeight + 'px', delay:0.5, duration: panelEffectDuration, afterFinish: function(){
			contentPanel.fade({duration: 0.5, from:0.01, to:1});
		} });
	}
	infoWindowContent = 'message';
}

//Close message/alert in infowindow - for GWT
function closeMessage(){
    var itemArray = panelArray[3];
    panelArray[3][2] = welcomeWindowHeight;
    setTimeout(function(){slidePanel(3);},200);
    infoWindowContent = 'start';
}

// Open address window in infowindow - for GWT
function openAddressPanel(){
  var itemArray = panelArray[3];
	panelArray[3][2] = addressWindowHeight;
	// open panel if is closed only
	if(itemArray[4] == 0){
		// args = panelArray item, panelArray item index
		setTimeout(function(){slidePanel(3)},300);
	}
	// if panel is not closed -> resize to infowindow height only
	else if(infoWindowContent == 'start' || infoWindowContent == 'info' ||  infoWindowContent == 'webcam' ||  infoWindowContent == 'traffic'){
		p = $$(itemArray[1]);
		contentPanel = p[0];
		contentPanel.fade({duration: 0, from:1, to:0.01});
		new Effect.Morph(contentPanel, {style:'height: ' + addressWindowHeight + 'px', delay:0.5, duration: panelEffectDuration, afterFinish: function(){
			contentPanel.fade({duration: 0.5, from:0.01, to:1});
		} });
	}
	infoWindowContent = 'address';
}

// Close address window in infowindow - for GWT
function closeAddressPanel(){
  var itemArray = panelArray[3];
  panelArray[3][2] = addressWindowHeight;
  setTimeout(function(){slidePanel(3);},200);
  infoWindowContent = 'start';
}

// Open traffic window in infowindow - for GWT
function openTrafficPanel(){
  var itemArray = panelArray[3];
	panelArray[3][2] = trafficWindowHeight;
	// open panel if is closed only
	if(itemArray[4] == 0){
		// args = panelArray item, panelArray item index
		setTimeout(function(){slidePanel(3)},300);
	}
	// if panel is not closed -> resize to infowindow height only
	else if(infoWindowContent == 'info' || infoWindowContent == 'address' ||  infoWindowContent == 'webcam'){
		p = $$(itemArray[1]);
		contentPanel = p[0];
		contentPanel.fade({duration: 0, from:1, to:0.01});
		new Effect.Morph(contentPanel, {style:'height: ' + trafficWindowHeight + 'px', delay:0.5, duration: panelEffectDuration, afterFinish: function(){
			contentPanel.fade({duration: 0.5, from:0.01, to:1});
		} });
	}
	infoWindowContent = 'traffic';
}

// Open webcam window in infowindow - for GWT
function openWebcamPanel(){
  var itemArray = panelArray[3];
	panelArray[3][2] = webcamWindowHeight;
	// open panel if is closed only
	if(itemArray[4] == 0){
		// args = panelArray item, panelArray item index
		setTimeout(function(){slidePanel(3)},300);
	}
	// if panel is not closed -> resize to infowindow height only
	else if(infoWindowContent == 'info' || infoWindowContent == 'address' || infoWindowContent == 'traffic' ){
		p = $$(itemArray[1]);
		contentPanel = p[0];
		contentPanel.fade({duration: 0, from:1, to:0.01});
		new Effect.Morph(contentPanel, {style:'height: ' + webcamWindowHeight + 'px', delay:0.5, duration: panelEffectDuration, afterFinish: function(){
			contentPanel.fade({duration: 0.5, from:0.01, to:1});
		} });
	}
	infoWindowContent = 'webcam';
}



// Actions after startup timeout - for GWT
function startupTimeout(){
	/*closeInfoPopup();
	setTimeout(function(){
		slidePanel(0);
		slidePanel(1);
		slidePanel(2);
		slidePanel(6);
	},500);
	*/
}

function openPartnerWindow(){
	partnersWindow();
}

function openFilterPanel(){
	if(panelArray[0][4] == 0){
		slidePanel(0);
	}
}

////////////  FREE POI-IMAGE TEXT FADING  ////////////

// Free image text fading animation INIT (POI Infowindow Grunddaten/Uebersicht) 
function imageTextInit(){
	// free image element -> image
	var elm = $$('.unpaid .logo2');
	var image = elm[0];
	if(elm[0] == undefined)
		return;
	
	if($('free-pic') != null){
        imageHeight = image.getLayout().get('height');
		imageWidth = image.getLayout().get('width');
		if(imageHeight == 0 && imageWidth == 0){
            setTimeout(imageTextInit,250);   
            return;
        }
		$('register-animation').setStyle({height: imageHeight + 'px', width: imageWidth + 'px', visibility: 'visible'});
		$('register-text').setStyle({height: imageHeight + 'px', width: imageWidth + 'px'});
		$('register-overlay').setStyle({height: imageHeight + 'px', width: imageWidth + 'px'});
		$('register-overlay').setOpacity(0.5);
        imageTextAnimationTimer = setInterval(imageTextAnimation, imageEffectInterval*1000);				
	}
	else{
		clearInterval(imageTextAnimationTimer);
	}
}
// Free image text fading animation
function imageTextAnimation(){
	var textElm = $('register-animation');
	if(textElm == null){
		return;
	}
	opacity = textElm.getOpacity();
	if(opacity > 0.5){
		textElm.fade({duration: imageEffectDuration, from:1, to:0.01});
	}
	else{
		textElm.fade({duration: imageEffectDuration, from:0.01, to:1});
	}
}

////////////  SUBPANEL EFFECTS  ////////////

// Register mainpanel buttons events - for subpanel effects
function registerButtonEvents(){
	var bt1 = $$('.bt30');
	var bt2 = $$('.bt24');
	var bt3 = $$('.bt32');
	buttons = new Array(bt1[0], bt2[0], bt3[0]);
	if(bt1.length > 0 && bt2.length > 0){
		buttons.each(function(element){
			element.observe('mouseover', function(){
				buttonOver = 1;
				var p = $$('.actual');
				panel = p[0];
				registerPanelEvents();
				setTimeout('checkSubpanel()',50);
			});
			
			element.observe('mouseout', function(){	
				buttonOver = 0;
				setTimeout('checkSubpanel()',500);
			});	
		});
	}
}

// Register subpanel events - if it is visible only
function registerPanelEvents(){
	// mouseover
	panel.observe('mouseover', function(){
		panelOver = 1;
		checkSubpanel();
	});
	// mouseout
	panel.observe('mouseout', function(){
		panelOver = 0;
		setTimeout('checkSubpanel()',50)
	});
	// click
	panel.observe('click', function(){
		panelOver = 0;
		setTimeout('checkSubpanel()',250)
	});
}

// Check, if subpanel needs to fade or to appear 
function checkSubpanel(){
	if((buttonOver == 1 || panelOver == 1) && panelVisible == 0)subpanelAppear();
	if((buttonOver == 0 && panelOver == 0) && panelVisible == 1)subpanelFade();	
}

// Subpanel appear effect
function subpanelAppear(){
	panelVisible = 1;
	if(subpanelEffect) subpanelEffect.cancel();
	if(iconEffect) iconEffect.cancel();
	$$('.filter-categories-panel').each(function(element){
		new Effect.Appear(element, {duration:0, from:1, to:1});
	});
	// hide panel instantly 
	new Effect.Fade(panel, {duration:0, afterFinish: function(){
		// appear panel 
		subpanelEffect = new Effect.Appear(panel, {duration:0.2, delay:0.2});
		$$('.filter-categories-panel').each(function(element){
			// fade main-panel buttons
			iconEffect = new Effect.Fade(element, {duration:0.25, from:1.0, to:0.3});
		});
	} }); 
}

// Subpanel fade effect
function subpanelFade(){	
	panelVisible = 0;
	if(subpanelEffect) subpanelEffect.cancel();
	if(iconEffect) iconEffect.cancel();
	if(panel != undefined){
		new Effect.Appear(panel, {duration:0, from:1, to:1, afterFinish:function(){
			// fade panel
			subpanelEffect = new Effect.Fade(panel, {duration:0.2});
		} });
		$$('.filter-categories-panel').each(function(element){
			// appear main-panel buttons
			iconEffect = new Effect.Appear(element, {duration:0.25, delay:0.2, from:0.3, to:1});
		});	
	}	
}

////////////  PARTNERS WINDOW  ////////////

function partnersWindow(){
	$('partner-window').style.display = 'block';
	var screen = document.viewport.getDimensions();
	var windowTop = (screen.height - 460) / 2;
	var windowLeft = (screen.width - 950) / 2; 
	
	$('pw-window').setStyle({
		top: windowTop + 'px',
		left: windowLeft + 'px'
	});
	$('pw-shadow').setStyle({
		top: (windowTop + 3) + 'px',
		left: (windowLeft - 4) + 'px'
	});
	$('pw-overlay').setStyle({
		width: screen.width + 'px', 
		height: screen.height + 'px'
	});
	
	$('partner-close-button').observe('mouseover', function(){
		$('partner-close-button').addClassName('x-tool-close-over');
	} );
	$('partner-close-button').observe('mouseout', function(){
		$('partner-close-button').removeClassName('x-tool-close-over');
	} );
	$('partner-close-button').observe('click', function(){
		$('partner-window').hide(); 
		
	} );
}


