// --------------------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------------------
// behaviours - Opens new browser window;
// depends: 	jQuery library;
// author:		ah;
// --------------------------------------------------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------------------------------------------------

// -- define namespace;
if (typeof Barclaycard !== 'object') var Barclaycard={};

Barclaycard.newWindow = new (function(){
	
	var params = 'width=750,height=570,scrollbars=1';
	var params_video = 'width=784,height=800,scrollbars=1';
	this.openWindow = function(url) {
		window.open(url,'BarclaycardPopup', params);
	};
	
	
	this.openSizedWindow = function(url, name, setParams) {
		window.open(url, name, setParams);
	};
	
	this.openStandardWindow = function(url) {
		window.open(url,''); //name removed so it doesn't open in same window
	};	
	
	this.onReady = function() {
		
		$('a.newWindow, a.newSizedWindow, a.btnNewWindow, a.external, a.pdf, a.getPdf, a.newVideoWindow').each(function(){
			$(this).append('<span class="newWindowTitle">(Opens in a new window)</span>');
		});
		
		$('a.newSizedWindow').click(function(){
			window.open(this.href,'BarclaycardPopup', params);
			return false;
		});
		$('a.newVideoWindow').click(function(){
			window.open(this.href,'BarclaycardPopup', params_video);
			return false;
		});

		$('a.newWindow, a.btnNewWindow, a.external, a.pdf, a.getPdf, a.faqs').each(function(){
			$(this).attr('target','_blank');
		});

		$('a.closeWindow').click(function(){
			window.close();
			return false;	
		});
		
	};

});

$(document).ready(function(){Barclaycard.newWindow.onReady();});

// --------------------------------------------------------------------------------------------------------------------------------
// --- end of file --- 
// -------------------------------------------------------------------------------------------------------------------------------
