//renk kontrol?
function styleColor(byId,id){
	 for(i=0;i<=3;i++){
         if(id==0){
		    document.getElementById('tab'+i).style.color='#FFFFFF';
         }
         else{
            document.getElementById('tabb'+i).style.color='#FFFFFF';
         }
		}
		if(byId!=null)
		document.getElementById(byId).style.color='#1c75b9';
}




//tab control
function upTabControl(classId,tabId,tabUpClass,tabNext,editClass,editId,tabPrevClass,tabPrevId,tabNextClass,tabNextId){

	var stretchers = document.getElementsByClassName(classId);
	var togglesPrev = document.getElementsByClassName(tabPrevClass);
	var togglesNext=document.getElementsByClassName(tabNextClass);
	var toggles = document.getElementsByClassName(tabUpClass);
	var togglesEdit = document.getElementsByClassName(editClass);
	var myAccordionef = new fx.Accordion(
		stretchers, {opacity: false, height: true, duration: 600}
	);
	//hash functions
	var found = false;
		if (!found) myAccordionef.showThisHideOpen(stretchers[0]);
	var ctrl=false;  
	styleColor(tabId+'0',tabNext);
	var dizi;
	
	
	//?st tab menu kontrolleri
	toggles.each(function(tabUpClass,i){
		document.getElementById(tabId+i).onclick=function(){ 
			  if(tabNext==1 && i==3){
			    document.getElementById('imageBox').style.display="inline";				
			  }
			  if(tabNext==1 && i<3){
			    document.getElementById('imageBox').style.display="inline";              
			  }
              styleColor(tabId+i,tabNext);
			  myAccordionef.showThisHideOpen(stretchers[i]);
              document.getElementById("ef_map_frame").style.display = "none"; 
			  
			  if(tabNext<=0 && i<1){
			     document.getElementById("ef_map_frame").style.display = "block"; 
			  }
			  
     		  }
		});
	
	
	//d?zelt
	if(editClass!=null)
	togglesEdit.each(function(editClass,i){
		document.getElementById(editId+i).onclick=function(){ 
			  styleColor(tabId+i,tabNext);
			  myAccordionef.showThisHideOpen(stretchers[i]);
			  
			}
		});
		
	
	//?nceki tabPrevClass
	if(tabPrevClass!=null)
	togglesPrev.each(function(tabPrevClass,i){
		document.getElementById(tabPrevId+i).onclick=function(){ 
			  styleColor(tabId+i,tabNext);
			  myAccordionef.showThisHideOpen(stretchers[i]);
			  if(tabNext<=0 && i<1){
			     document.getElementById("ef_map_frame").style.display = "block"; 
			  }
			}
		});
		
		//?nceki tabPrevClass
	if(tabNextClass!=null)
	togglesNext.each(function(tabNextClass,i){
		document.getElementById(tabNextId+i).onclick=function(){ 
			  styleColor(tabId+(i+1),tabNext);
			  myAccordionef.showThisHideOpen(stretchers[i+1]);
			  document.getElementById("ef_map_frame").style.display = "block"; 
			  /*if(tabNext==1 && i==2){
			    document.getElementById('imageBox').style.display="inline";
			  }*/
			}
		});



//sonraki butonlar? i?in kontrol
if(tabNext<=0 || tabNext==0){

	document.getElementById('sonraki1').onclick=function(){
		dizi=xajax.getFormValues('formEvmiminFiyati');		
		//ajaxdan gelen veri
		var myValue = xajax.call("efTabControl", {mode:'synchronous',parameters:['tab1',dizi]});		
		alertcontrol(myValue);		
		//gelen de?ere g?re ilerleme
		if(myValue=='true'){
			styleColor('tab1',0);
			myAccordionef.showThisHideOpen(stretchers[1]);	
			document.getElementById("ef_map_frame").style.display="none";
		}//if
		
	}//function
	
	
	document.getElementById('sonraki2').onclick=function(){
		dizi=xajax.getFormValues('formEvmiminFiyati'); 
		//ajaxdan gelen veri
		var myValue = xajax.call("efTabControl", {mode:'synchronous',parameters:['tab1',dizi]});
		alertcontrol(myValue);
		//gelen de?ere g?re ilerleme
		if(myValue=='true'){
			styleColor('tab2',0);
			myAccordionef.showThisHideOpen(stretchers[2]);
		}//if
		else{
			styleColor('tab0',0);
			myAccordionef.showThisHideOpen(stretchers[0]);
		}//else
	}//function

	document.getElementById('sonraki3').onclick=function(){
		dizi=xajax.getFormValues('formEvmiminFiyati'); 
		//ajaxdan gelen veri
		var myValue = xajax.call("efTabControl", {mode:'synchronous',parameters:['tab1',dizi]});
		alertcontrol(myValue);
		//gelen de?ere g?re ilerleme
		if(myValue=='true'){
			myValue = xajax.call("efTabControl", {mode:'synchronous',parameters:['tab3',dizi]});
			alertcontrol(myValue);
			if(myValue=='true'){
				styleColor('tab3',0);
				myAccordionef.showThisHideOpen(stretchers[3]);
			}//if
		} //if
		else{
			styleColor('tab0',0);
			myAccordionef.showThisHideOpen(stretchers[0]);
		}//else
	}//function
   
	

	//?n izleme i?in yaz?lmas? gereken komutlar
	document.getElementById('onIzleme').onclick=function(){
	dizi=xajax.getFormValues('formEvmiminFiyati'); 
		//ajaxdan gelen veri
		var myValue = xajax.call('efTabControl', {mode:'synchronous',parameters:['tab1',dizi]});
		alertcontrol(myValue);
		//gelen de?ere g?re ilerleme
		if(myValue=='true'){
			myValue = xajax.call('efTabControl', {mode:'synchronous',parameters:['tab3',dizi]});
			alertcontrol(myValue);
			if(myValue=='true'){
				myValue = xajax.call('efTabControl', {mode:'synchronous',parameters:['tab4',dizi]});
				alertcontrol(myValue);   
				if(myValue=='true'){
					//if(myValue=='true'){
						  // if(document.getElementById('kontrat').checked==true){
							styleColor(null,0); 
							myAccordionef.showThisHideOpen(stretchers[4]);    
							xajax.call('efOnIzleme', {mode:'synchronous',parameters:[dizi]});
						  // }//if
						  // else{
							//	alert('Lütfen üyelik sözleşmesini okuyup onaylayınız.'); 
						  // }  
						//}//if
				}else{
					styleColor(null,0); 
					myAccordionef.showThisHideOpen(stretchers[3]); 	
				}
			}//if        
			else{
				styleColor('tab2',0);
				myAccordionef.showThisHideOpen(stretchers[2]);
			  }//else
		} //if
		else{
		styleColor('tab0',0);
		myAccordionef.showThisHideOpen(stretchers[0]);
		}//else
	}
}
}
