
var urlParams = {};
(function () {
    var e,
        a = /\+/g,  // Regex for replacing addition symbol with a space
        r = /([^&=]+)=?([^&]*)/g,
        d = function (s) { return decodeURIComponent(s.replace(a, " ")); },
        q = window.location.search.substring(1);

    while (e = r.exec(q))
       urlParams[d(e[1])] = d(e[2]);
})();

window.addEvent('domready', function() {
	AdeziuniLinks = $$('.eventAdeziuniLink');
	AdeziuniLinks.addEvent('click', deschideAdeziuneFrame);
	
	InviteLinks = $$('.eventInviteLink');
	InviteLinks.addEvent('click', deschideInviteFrame);
	
	CatalogLinks = $$('.eventCatalogLink');
	CatalogLinks.addEvent('click', deschideCatalogFrame);
});

function deschideInviteFrame() {
	lang = urlParams['limba2'];
	elid = this.id;
	elid = elid.substr(15);
	
	Ilight = new LightFace.IFrame({ height:760, width:700, url: 'http://www.romexpo.ro/newrmx/invitatie_frame.php?limba2='+lang+'&invitatie_id='+elid, title: 'On-line Invitation' }).addButton('Close', function() { this.close(); },'blue').open();	
}

function deschideInviteFrameNr(nr) {
	lang = urlParams['limba2'];
	elid = nr;	
	Ilight = new LightFace.IFrame({ height:760, width:700, url: 'http://www.romexpo.ro/newrmx/invitatie_frame.php?limba2='+lang+'&invitatie_id='+elid, title: 'On-line Invitation' }).addButton('Close', function() { this.close(); },'blue').open();	
}

function deschideAdeziuneFrame() {
	lang = urlParams['limba2'];
	elid = this.id;
	elid = elid.substr(17);
	Ilight = new LightFace.IFrame({ height:760, width:700, url: 'http://www.romexpo.ro/newrmx/adeziune_frame.php?limba2='+lang+'&adeziune_id='+elid, title: 'ROMEXPO S.A.' }).addButton('Close', function() { this.close(); },'blue').open();	
}

function deschideAdeziuneFrameNr(nr) {
	lang = urlParams['limba2'];
	elid = nr;
	Ilight = new LightFace.IFrame({ height:760, width:700, url: 'http://www.romexpo.ro/newrmx/adeziune_frame.php?limba2='+lang+'&adeziune_id='+elid, title: 'ROMEXPO S.A.' }).addButton('Close', function() { this.close(); },'blue').open();	
}

function deschideCatalogFrame() {
	lang = urlParams['limba2'];
	elid = this.id;
	elid = elid.substr(16);
	
	Ilight = new LightFace.IFrame({ height:760, width:700, url: 'http://www.romexpo.ro/newrmx/catalog_frame.php?limba2='+lang+'&catalog_id='+elid, title: 'ROMEXPO S.A.' }).addButton('Close', function() { this.close(); },'blue').open();	
}

function deschideCatalogFrameNr(nr) {
	lang = urlParams['limba2'];
	elid = nr;
	Ilight = new LightFace.IFrame({ height:760, width:700, url: 'http://www.romexpo.ro/newrmx/catalog_frame.php?limba2='+lang+'&catalog_id='+elid, title: 'ROMEXPO S.A.' }).addButton('Close', function() { this.close(); },'blue').open();	
}

function deschideDialogAdeziune() {
	elid = this.id;
	elid = elid.substr(17);
	
	ajaxFace = new LightFace.Request({
		url: 'newrmx/adeziune_contract.php?adeziune_id='+elid,
		width: 700,
		height: 760,
		buttons: [
		    { title: 'Ok', event: function() { alert('Ok..');}, color: 'green' },
			{ title: 'Close', event: function() { this.close(); }, color: 'blue' }
		],
		title: 'Adeziune Contract',
		resetOnScroll: false
	}).open();
}

