//http://yuilibrary.com/gallery/show/overlay-modal//
var suwichOverlay = null;
YUI({
		
	modules: {
		'gallery-overlay-extras': {
			fullpath	: 'js/yui-gallery/gallery-overlay-extras-min.js',
			requires	: ['node','overlay','plugin', 'widget-anim','event-focus']
		}
	}

}).use('gallery-overlay-extras', 'dd-constrain', function(Y){

	suwichOverlay = new Y.Overlay({
		
		srcNode		: '#suwichmodalpopupoverlay',
		width		: '540px',
		height		: '300px',
		zIndex		: 100,
		centered	: true,
		constrain	: true,
		render		: true,
		visible		: false,
		plugins		: [
			
			{ fn: Y.Plugin.OverlayModal },
			{ fn: Y.Plugin.OverlayKeepaligned },
			{ fn: Y.Plugin.OverlayAutohide }

		]
							
	});
	
	// make overlay draggable
	(new Y.DD.Drag({
		
		node	: suwichOverlay.get('boundingBox'),
		handles	: ['.yui3-widget-hd']
		
	})).plug(Y.Plugin.DDConstrained, { constrain2view : true });

});



var newsgalleryOverlay = null;
YUI({
		
	modules: {
		'gallery-overlay-extras': {
			fullpath	: 'js/yui-gallery/gallery-overlay-extras-min.js',
			requires	: ['node','overlay','plugin', 'widget-anim','event-focus']
		}
	}

}).use('gallery-overlay-extras', 'dd-constrain', function(Y){

	newsgalleryOverlay = new Y.Overlay({
		
		srcNode		: '#newsgallerypopupoverlay',
		width		: '900px',
		height		: '600px',
		zIndex		: 100,
		centered	: true,
		constrain	: true,
		render		: true,
		visible		: false,
		plugins		: [
			
			{ fn: Y.Plugin.OverlayModal },
			{ fn: Y.Plugin.OverlayKeepaligned },
			{ fn: Y.Plugin.OverlayAutohide }

		]
							
	});
	
	// make overlay draggable
	(new Y.DD.Drag({
		
		node	: newsgalleryOverlay.get('boundingBox'),
		handles	: ['.yui3-widget-hd']
		
	})).plug(Y.Plugin.DDConstrained, { constrain2view : true });

});


function showmodalpopup(headertxt, module, page, param)
{
	document.getElementById('suwichmodalpopupoverlay_head').innerHTML = headertxt;
	document.getElementById('suwichmodalpopupoverlay_body').innerHTML = '<img src=\"images/icons/loading.gif\"/> content is loading<br/>please wait ...';
	ChangePage(module, page, 'suwichmodalpopupoverlay_body', param);
	//var div = suwichOverlay.Node.get("#suwichmodalpopupoverlay_head");
	//div.set("innerHTML", headertxt);
	suwichOverlay.show();	
	//suwichOverlay.modal.mask();
	window.scrollBy(1,1); 
	window.scrollBy(-1,-1); 
}

function shownewsgallerypopup(headertxt, module, page, param)
{
	document.getElementById('newsgallerypopupoverlay_head').innerHTML = headertxt;
	document.getElementById('newsgallerypopupoverlay_body').innerHTML = '<img src=\"images/icons/loading.gif\"/> content is loading<br/>please wait ...';
	ChangePage(module, page, 'newsgallerypopupoverlay_body', param);
	//var div = suwichOverlay.Node.get("#suwichmodalpopupoverlay_head");
	//div.set("innerHTML", headertxt);
	newsgalleryOverlay.show();	
	//suwichOverlay.modal.mask();
	window.scrollBy(1,1); 
	window.scrollBy(-1,-1); 
}

