chrome.webRequest.onBeforeRequest.addListener(function(details) {
    if (details.url.indexOf('.application') != -1) {
		var el = document.createElement('a');
		el.href = details.url;
        if (el.pathname.match(/\.application$/)) {
		    chrome.runtime.sendNativeMessage('menarva.utils.clickonceforgooglechrome',
		      { clickonce: details.url });
		    return {redirectUrl: 'javascript:void(0)'};
        }
	}
}, { urls: ['http://*/*', 'https://*/*'] }, ['blocking']);

chrome.runtime.onInstalled.addListener(function(details) {
	if (details.reason == 'install' || details.reason == 'update'){
		if(navigator.language == 'he')
		{
			url = chrome.extension.getURL('install/plugin_HE.html');
		}
		else
		{
			url = chrome.extension.getURL('install/plugin.html');
		}
		chrome.tabs.create({'url': url});
	}
});
