(function() {

// cms.js is not loaded yet
var el = document.getElementById('DPI.language_prefix');
var langPrefix = '';
if(null != el){
	langPrefix = el.getAttribute('content');
}
delete el;


//Enter CMS mode
function openCMSToolbar(a,e){
	YAHOO.util.Event.preventDefault(e[1]);
	if('' !== langPrefix){
		langPrefix = '/' + langPrefix;
	}
	window.location = langPrefix + '/cmsmain/showToolbar/1' + window.location.pathname +  window.location.search + window.location.hash;
};
   
//Leave CMS mode
function closeCMSToolbar(a,e){
	YAHOO.util.Event.preventDefault(e[1]);
	if('' !== langPrefix){
		langPrefix = '/' + langPrefix;
	}
	window.location = langPrefix + '/cmsmain/showToolbar/0' + window.location.pathname + window.location.search + window.location.hash;
};

var keyCmdOpenCMS  = new YAHOO.util.KeyListener(document, { ctrl:true, keys:69 }, { fn:openCMSToolbar} );
var keyCmdCloseCMS = new YAHOO.util.KeyListener(document, { ctrl:true, keys:81 }, { fn:closeCMSToolbar} );

keyCmdOpenCMS.enable();
keyCmdCloseCMS.enable();
})();
