var myWin = new Array();
var contentPos,sp0,sp1,sp2,sp3,sp4,sp5;

var active = false;

function activateNav(id) {
	try {
		if(active) {
			Windows.closeAll();
		}
		navArray = $$('#navigation a');
		navArray.each(function(node) {
			$(node.id).removeClassName('active');
		});
		$(id).addClassName('active');
		sp1.showFirstPanel();
		sp2.showFirstPanel();
		sp3.showFirstPanel();
		sp4.showFirstPanel();
		sp5.showFirstPanel();
		$('campaign').hide();
		$('campaignContent').hide();
	} catch(err) {}
}
function resetNav(showcampaign) {
	try {
		if(active) {
			Windows.closeAll();
		}
		navArray = $$('#navigation a');
		navArray.each(function(node) {
			$(node.id).removeClassName('active');
			sp1.showFirstPanel();
			sp2.showFirstPanel();
			sp3.showFirstPanel();
			sp4.showFirstPanel();
			sp5.showFirstPanel();
			if(showcampaign==1) {
				$('campaign').appear({ delay: 0.5 });
				$('campaignContent').appear({ delay: 0.5 });
			} else {
				$('campaign').hide();
				$('campaignContent').hide();
			}
		});
	} catch(err) {}
}
function concatObject(obj) {
	try {
		str='';
		for(prop in obj) {
			str+=prop + " value :"+ obj[prop]+"\n";
		}
		return(str);
	} catch(err) {}	
}
function closeMyWindow(id) {
	try {
		myWin[id].close();
	} catch(err) {}		
}
function modal(myUrl) {
	try {
		if(active) {
			myModal.close(myModal.getId());
		} else {
			contentPos = $('content').viewportOffset();
			myModal = new Window({  
				className: 'default',  
				height: 500,
				width: 640,
				url: myUrl,
				resizable: false,
				closable: true,
				minimizable: false,
				maximizable: false,
				draggable: false,			
				top:contentPos[1],
				left:contentPos[0],
				destroyOnClose: true,
				showEffectOptions: {duration:0.5},
				hideEffectOptions: {duration:0.5},
				onBeforeShow: function(){
					if($('languageSelector').visible()) { Effect.toggle('languageSelector','blind',{ duration: 0.4 }); }
					active = 'modal';
				},
				onClose: function(){
					active = false;
				}
			});
			myModal.show();
		}
	} catch(err) {}	
}
function repositionWindows() {
	try {
		contentPos = $('content').viewportOffset();
		modalArray = $$('a.modal');
		modalArray.each(function(node,index) {
			myWin['modal'+index].position(contentPos);
		
		});
	} catch(err) {}	
}
window.onresize = function() {
//	   repositionWindows();
};
document.observe('dom:loaded',function(){
	$('languageSelector').hide();
//	initWindows();
});
