ActIdsArray = [0,0,0,0];
ActChilId = 0;
ActChLevel = 0;

ImgsPasv = ['Images/left-menu/main-menu-bg.gif',
						'Images/left-menu/sub-menu-bg.gif',
						'Images/left-menu/sub2-menu-bg.gif',
						'Images/left-menu/sub3-menu-bg.gif'];
ImgsActv = ['Images/left-menu/on-main-menu-bg.gif',
						'Images/left-menu/on-sub-menu-bg.gif',
						'Images/left-menu/on-sub2-menu-bg.gif',
						'Images/left-menu/on-sub3-menu-bg.gif'];
						
function KlikAgac( fId, sId, tId, qId ){

	CloseSecere(fId,sId,tId,qId);
	BuildSecere(fId,sId,tId,qId);
	ActChilId = 0;
	ActChLevel = 0;
}

function KlikYaprak( fId, sId, tId, qId, fromFlash ){

	CloseSecere(fId,sId,tId,qId);
	if (qId > 0){
		BuildSecere(fId,sId,tId,0);
		ActChilId = qId;
		ActChLevel = 3;
		Activate('Td' + fId + '_' + sId + '_' + tId + '_' + qId , 3);
	}else if (tId > 0){
		BuildSecere(fId,sId,0,0);
		ActChilId = tId;
		ActChLevel = 2;
		Activate('Td' + fId + '_' + sId + '_' + tId , 2);
	}else if (sId > 0){
		BuildSecere(fId,0,0,0);
		ActChilId = sId;
		ActChLevel = 1;
		Activate('Td' + fId + '_' + sId , 1);
	}else if (fId > 0) {
		ActChilId = fId;
		ActChLevel = 0;
		Activate('Td' + fId , 0);
	}else{
		ActChilId = 0;
		ActChLevel = 0;
	}
}

function Deactivate(str, lv){
	var oIt = findObj(str);
	oIt.background = ImgsPasv[lv];
	return true;
}
function Activate(str, lv){
	var oIt = findObj(str);
	oIt.background = ImgsActv[lv];
	return true;
}
function CloseOne(str){
	var oIt = findObj(str);
	oIt.style.display = 'none';
	return true;
}
function OpenOne(str){
	var oIt = findObj(str);
	oIt.style.display = '';
	return true;
}
function ToggleOne(str){
	var oIt = findObj(str);
	var strCurrentStatus = oIt.style.display;
	oIt.style.display = strCurrentStatus == '' ? 'none' : '';
	return true;
}

function CloseSecere(fId,sId,tId,qId){
	if (ActChilId > 0) {
		if (ActChLevel == 0) {
			Deactivate('Td' + ActChilId, 0);
		}else if (ActChLevel == 1) {
			Deactivate('Td' + ActIdsArray[0] + '_' + ActChilId, 1);
		}else if (ActChLevel == 2) {
			Deactivate('Td' + ActIdsArray[0] + '_' + ActIdsArray[1] + '_' + ActChilId, 2);
		}else if (ActChLevel == 3) {
			Deactivate('Td' + ActIdsArray[0] + '_' + ActIdsArray[1] + '_' + ActIdsArray[2] + '_' + ActChilId, 3);
		}
	}
	
	if ( (ActIdsArray[0] > 0) && (fId != ActIdsArray[0]) ){
		Deactivate('Td' + ActIdsArray[0], 0);
		CloseOne('Menu' + ActIdsArray[0]);
		if (ActIdsArray[1] > 0) { 
			Deactivate('Td' + ActIdsArray[0] + '_' + ActIdsArray[1], 1);
			CloseOne('Menu' + ActIdsArray[0] + '_' + ActIdsArray[1] )
		};
		if (ActIdsArray[2] > 0) { 
			Deactivate('Td' + ActIdsArray[0] + '_' + ActIdsArray[1] + '_' + ActIdsArray[2], 2);
			CloseOne('Menu' + ActIdsArray[0] + '_' + ActIdsArray[1] + '_' + ActIdsArray[2] )
		};
		if (ActIdsArray[3] > 0) { 
			Deactivate('Td' + ActIdsArray[0] + '_' + ActIdsArray[1] + '_' + ActIdsArray[2] + '_' + ActIdsArray[3], 3);
		};
	}else if ( (ActIdsArray[1] > 0) && (sId != ActIdsArray[1])) {
		Deactivate('Td' + ActIdsArray[0] + '_' + ActIdsArray[1], 1);
		CloseOne('Menu' + ActIdsArray[0] + '_' + ActIdsArray[1] );
		if (ActIdsArray[2] > 0) { 
			Deactivate('Td' + ActIdsArray[0] + '_' + ActIdsArray[1] + '_' + ActIdsArray[2], 2);
			CloseOne('Menu' + ActIdsArray[0] + '_' + ActIdsArray[1] + '_' + ActIdsArray[2] )
		};
		if (ActIdsArray[3] > 0) { 
			Deactivate('Td' + ActIdsArray[0] + '_' + ActIdsArray[1] + '_' + ActIdsArray[2] + '_' + ActIdsArray[3], 3);
		};
	}else if ( (ActIdsArray[2] > 0) && (tId != ActIdsArray[2])) {
		Deactivate('Td' + ActIdsArray[0] + '_' + ActIdsArray[1] + '_' + ActIdsArray[2], 2);
		CloseOne('Menu' + ActIdsArray[0] + '_' + ActIdsArray[1] + '_' + ActIdsArray[2] );
	}
}
function BuildSecere(fId,sId,tId,qId){
	ActIdsArray = [fId,sId,tId,qId];
	if (fId > 0) {
		var strId = 'Menu' + fId;
		var tdId = 'Td' + fId;
		Activate(tdId, 0);
		OpenOne(strId);
		if (sId > 0){
			strId = strId  + '_' + sId;
			tdId = tdId  + '_' + sId;
			Activate(tdId, 1);
			OpenOne(strId);
			if (tId > 0){
				strId = strId  + '_' + tId;
				tdId = tdId  + '_' + tId;
				Activate(tdId, 2);
				OpenOne(strId);
				if (qId > 0){
					tdId = tdId  + '_' + qId;
					Activate(tdId, 3);
				}				
			}
		}
	}
}

function findObj(theObj, theDoc){
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length) {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}


     function FormCheck()
  {  
     if (this.document.form.sNew_Name.value== "")
     {
       alert("'Adı' bölümünü boş bırakmayınız!");
       return false;
     }
     else if (this.document.form.sNew_Surname.value== "")
     {
       alert("'Soyadı' bölümünü boş bırakmayınız!");
       return false;
     }
     else if (this.document.form.sNew_Birthday.value== "")
     {
       alert("'Doğum Yılı' bölümünü boş bırakmayınız!");
       return false;
     }	 
     else if (this.document.form.sNew_Istel1.value== "")
     {
       alert("'İş Telefonu1' bölümünü boş bırakmayınız!");
       return false;
     }
     else if (this.document.form.sNew_Istel2.value== "")
     {
       alert("'İş Telefonu2' bölümünü boş bırakmayınız!");
       return false;
     }	
     else if (this.document.form.sNew_Ceptel1.value== "")
     {
       alert("'Cep Telefonu1' bölümünü boş bırakmayınız!");
       return false;
     }
     else if (this.document.form.sNew_Ceptel2.value== "")
     {
       alert("'Cep Telefonuu2' bölümünü boş bırakmayınız!");
       return false;
     }	
     else if (this.document.form.sNew_Email.value== "")
     {
       alert("'E-mail' bölümünü boş bırakmayınız!");
       return false;
     }		 	   		  	  
  }  