// JavaScript Document
//<!--
/////////////////////////////////////////layerManager/////////////////////////////////////////
var allDivs = ['aboutUsHistory', 'aboutUsGoals', 'aboutUsStaff',
			'publicationAndResearch', 'publicationAndResearchArticles', 'publicationAndResearchBooks', 'booksContent',
			'educationHistory', 'educationApproach', 'educationClasses',
			'newsCharsu', 'newsIran', 'newsWorld',
			'projectsAndGroups', 'groups', 'projects', 'groupsContent', 'projectsContent',
			'membership',
			'contactUs',
			'links',
			'resumeContainer'/*, 'charsuIntroText',*/],
	opacityOfAllDivs = {},
	waitMassage='<span class="farTextLong">&nbsp;&nbsp; ...لطفاً صبر کنید</span>';
	//waitMassage='<img src="images/loading_06.gif">';
for (var i=0, div; div=allDivs[i]; i++) opacityOfAllDivs[div]=0
function SS_hideOthersAndShowThis(obj){
	if (!obj) return false
	if (obj!='publicationAndResearchArticles' && obj!='publicationAndResearchBooks')
		MM_dragLayer(obj,'',0,0,0,0,false,false,-1,-1,-1,-1,false,false,0,'',false,'')
	waitMassage = (obj=='groups' || obj=='projects')?
		'<span class="farTextLong">لطفا صبر کنید... &nbsp;&nbsp;</span>' :
		'<span class="farTextLong">&nbsp;&nbsp; ...لطفاً صبر کنید</span>'
	///////////////vars////////////////
	var	factor,
		fadeSpeed=200,
		ob=document.getElementById(obj);
	////////////////////showLoading///////////////////////
	var opacity=(opacityOfAllDivs[obj])? opacityOfAllDivs[obj] : 0;
	if (opacity<1){
		if  (obj!='educationApproach' && 
			obj!='aboutUsGoals' && 
			obj!='aboutUsHistory' && 
			obj!='educationClasses' &&
			obj!='resumeContainer' && 
			obj!='newsCharsu')
			MM_setTextOfLayer(obj,'',waitMassage)
		else if (obj!='educationClasses') 
			MM_setTextOfLayer(obj+'01','',waitMassage)
	}
	if (opacity>0) ob.style.visibility='visible'
	if (obj=='publicationAndResearchArticles' || obj=='publicationAndResearchBooks' || obj=='aboutUsStaff') ob.style.visibility='visible'
	MM_effectAppearFade(ob, fadeSpeed/1, opacityOfAllDivs[obj], 100, false);
	opacityOfAllDivs[obj]=100;
	ob.style.zIndex=4;
	for (var i=0, div; div=allDivs[i]; i++){
		var	el=document.getElementById(div),
			op=opacityOfAllDivs[div];
		if (op && el!=ob && el.style.visibility!='hidden' && obj!='groupsContent' && obj!='projectsContent'){
			factor=(opacityOfAllDivs[div]==100)? 5 : 1.75
			if (div=='links' || div=='booksContent'){
				factor=5;
				el.style.zIndex=2;
			} else {
				el.style.zIndex=3;
			}
			if (div!='publicationAndResearchBooks'){
				MM_effectAppearFade(el, fadeSpeed, op, op/factor, false);
				opacityOfAllDivs[div]=op/factor;
				op=opacityOfAllDivs[div];
			}
		}
		////////////////////////objects that change picAnim/////////////////////////
		if ((div=='publicationAndResearchBooks' || div=='publicationAndResearchArticles' || div=='aboutUsStaff' || op<1 ) && el!=ob && obj!='booksContent')
			el.style.visibility='hidden'
	}
	/////////////////educationClassesContainer///////////////////
	var ecc=document.getElementById('educationClassesContainer');
	ecc.style.zIndex=document.getElementById('educationClasses').style.zIndex;
	if (obj=='educationClasses'){
		document.getElementById('educationClasses').style.zIndex++;
		MM_effectAppearFade(ecc, fadeSpeed/1, opacityOfAllDivs['educationClasses'], 100, false);
		opacityOfAllDivs['educationClassesContainer']=100;
	} else if (opacityOfAllDivs['educationClassesContainer']){
		MM_effectAppearFade(ecc, fadeSpeed, opacityOfAllDivs['educationClassesContainer'], opacityOfAllDivs['educationClasses'], false);
		opacityOfAllDivs['educationClassesContainer']=opacityOfAllDivs['educationClasses'];
	}
	setNavButton(obj);
	return false
}

function setNavButton(obj){
	pageNavId = obj=='educationClasses'?
		document.getElementById('pageNavEducationClassesContainer') :
		document.getElementById('pageNav' + obj.slice(0,1).toUpperCase() + obj.slice(1,obj.length));
	
	if (pageNavId) {
		if(obj=='resumeContainer') obj='resume'
		var content='<a href="#" onclick="'+obj+'ContainerJ.showNextPanel(); return false;">'+'\n'+
					'<span class="pageFont" id='+"'"+obj+'Next'+"'"+'>► صفحه‌ی بعد</span></a>'+'\n'+
					'<span class="pageFont">&nbsp;&nbsp; | &nbsp;&nbsp;</span>'+'\n'+
					'<a href="#" onclick="'+obj+'ContainerJ.showPreviousPanel(); return false;">'+'\n'+
					'<span class="pageFont" id='+"'"+obj+'Prev'+"'"+'>صفحه‌ی قبل ◄</span></a>'+
					'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
		//alert(content);
		pageNavId.innerHTML = content;
	}
	return false
}
//-->

