
function changeButton(currentButton){
	var searchButton = document.getElementById('searchIt');
	var searchDiv = document.getElementById('searchDiv');
	var scoreButton = document.getElementById('scoreIt');
	var scoreDiv = document.getElementById('scoreDiv');
	if (currentButton.id == 'scoreIt'){
		
		currentButton.className = 'search-active-header';
		searchButton.className = 'search-passive-header';
		scoreDiv.style.display = 'block';
		searchDiv.style.display = 'none';
		
		}
	else{
		
		currentButton.className = 'search-active-header';
		scoreButton.className = 'search-passive-header';
		scoreDiv.style.display = 'none';
		searchDiv.style.display = 'block';
		}
	}

function changeTab(tabOrder){
	var activeDiv, passiveDiv;
	activeDiv = document.getElementById( "tab"+tabOrder );
	activeDiv.className = "tabs-active";
	
	for (var j=1; j<5; j++){
		
		if (tabOrder != j){
			
			passiveDiv = document.getElementById( "tab"+j );
			
			passiveDiv.className = "tabs-passive";
			
		}
		 
	}
	
}


function changeTabDiv(tabOrder){
	var activeDiv, passiveDiv, activeTab, passiveTab;
	activeTab = document.getElementById( "tab"+tabOrder );
	activeTab.className = "tabs-active";
	activeDiv = document.getElementById( "tabDiv"+tabOrder );
	activeDiv.style.display = 'block';
	
	for (var j=1; j<5; j++){
		
		if (tabOrder != j){
			
			passiveTab = document.getElementById( "tab"+j );
			passiveTab.className = "tabs-passive";
			
			passiveDiv = document.getElementById( "tabDiv"+j );
			passiveDiv.style.display = 'none';
			
		}
		 
	}
	
}


function showPriceDiv(ObjOrd,Type){
    var objButton;
    var objDetails;
	objDetails = document.getElementById("price"+ObjOrd);
	var objContainer;
	
	if (objDetails.style.display == 'none'){
				 objButton = document.getElementById("priceButton"+ObjOrd);
					if(Type == 'rec'){
						objButton.className = "result-box-recommended-button-open";
					}else{
						objButton.className = "result-box-button-open";
					}
					objDetails = document.getElementById("price"+ObjOrd);
					objDetails.style.display = 'block';
					objDetails = document.getElementById("priceContainer"+ObjOrd);
					objDetails.style.height = 'auto';
	}else{
				 
				 	objButton = document.getElementById("priceButton"+ObjOrd);
					if(Type == 'rec'){
						objButton.className = "result-box-recommended-button-closed";
					}else{
						objButton.className = "result-box-button-closed";
					}
					objDetails = document.getElementById("price"+ObjOrd);
					objDetails.style.display = 'none';
					objDetails = document.getElementById("priceContainer"+ObjOrd);
					objDetails.style.height = '101px';
	}
			
}

function changePointDisplay(Action){

	
	var divId = document.getElementById("pointDetails");
    var buttonId = document.getElementById("pointButton");
	
	if (divId.style.display == 'none'){

					divId.style.display = 'block';
					buttonId.className = "points-summary-button";
					
	}else{
				 
				 	divId.style.display = 'none';
					buttonId.className = "points-detail-button";
	}
			
}

function showList(){
	var  divId = document.getElementById("ajaxList");
	divId.style.display = 'block';
	
	}
function showCallBox(){
	var  divId = document.getElementById("callBox");
	divId.style.display = 'block';
	
	}





var abox='';
var sendThis=true;





function goSubmit(durum){
	var fName = document.getElementById("userForm");
	sendThis=true;
	var minChecked=false;
	document.getElementById("DURUM").value = durum;
	var intlen = document.getElementById("INTERESTS").length;
	if (intlen>1){
		for (var i=0; i<intlen; i++){
			if (fName.INTERESTS[i].checked==true){minChecked=true;}
		}
	}else{
		if (fName.INTERESTS.checked==true){minChecked=true;}
	}
	if (minChecked==false){abox=abox+'En az bir ilgi alani isaretlemelisiniz.   \n';sendThis=false;}

checkEmpty('EMAIL', 'E-Posta Adresiniz');
checkEmail('EMAIL', 'E-Posta Adresiniz');
checkEmpty('COLUMN1', 'Adiniz');
checkEmpty('COLUMN2', 'Soyadiniz');
checkPhone('COLUMN6', 'Cep Telefonunuz', 'N', 7);


	if (sendThis){
		fName.submit();
	}else{
		if (abox!=''){alert(abox); abox='';}
	}
}










function getDepend(inObj,inPrefix,inTarget,inFrom,inMultiple){
	var curVal = getColumnSelected(inObj.name);
	if (document.getElementById(inPrefix + inTarget) != undefined){
		document.getElementById(inPrefix + inTarget).disabled = true;
		if (curVal != ''){
			if (inFrom.indexOf(';') > 0){
				var arrFrom = inFrom.split(';');
				for (i=0; i<arrFrom.length; i++){
					curVal = getColumnSelected(inPrefix + arrFrom(i)) + ';' + curVal;
				}
			}else{
				if (parseInt(inFrom) > 0){
					curVal = getColumnSelected(inPrefix + inFrom) + ';' + curVal;
				}
			}
			CoWrk.location.replace('../Subscribe/SubscribeWorker.asp?W=GDC&ID=74FF6670A41749B1A27C0130C4F26B6D&WM=' + inMultiple + '&PR=' + inPrefix + '&TID=' + inTarget + '&CID=' + escape(curVal));
		}
	}
}

function getColumnSelected(inObj){
	var thisObj = $(inObj);
	if (thisObj.tagName == 'SELECT'){
		return $F(thisObj);
	}else{
		return '';
	}
}


function clearMyCombo(inObj,inPlease, inPleaseStr){
	var obje = document.getElementById(inObj);
	var b = obje.options.length;
	for (a=0; a<b; a++){obje.remove(0);}
	if (inPlease){
		var oOption = document.createElement("OPTION")
		obje.options.add(oOption);
		oOption.text = inPleaseStr;
		oOption.value = '';
	}
	obje.disabled = false;
}



function allowInString (InString, RefString)  {
	if(InString.length==0) return (false);
    for (var Count=0; Count < InString.length; Count++){
		var TempChar= InString.substring (Count, Count+1);
		if (RefString.indexOf (TempChar, 0)==-1)
	        return (false);
		}
		return (true);
}

function checkEmpty(inval, inLabel){
	if ($F(inval) == '' ){
		abox=abox+'Lütfen isaretli alanlari doldurunuz   *' + inLabel +'\n'; sendThis=false;
	}
}

function checkDateEmpty(inval, inLabel){
	if (
		$F(inval+'_GUN') == '01' &&
		$F(inval+'_AY') == '01' &&
		$F(inval+'_YIL') == '1900'
	){
		abox=abox+'Lütfen mecburi tarih kolonlarini doldurunuz     *'+inLabel + '\n'; sendThis=false;
	}
	
}

function checkCaptcha(inval, inLabel, inMin){
	var fvar = $F(inval);
	if (fvar.length < inMin){abox=abox+'Lütfen isaretli alanlari doldurunuz   *' + inLabel +'\n'; sendThis=false;}
}

function checkNumeric(inval, inLabel){
	var fvar = $F(inval);
	if (fvar != ''){
		if (!allowInString(fvar,'0123456789')){
			abox=abox+'Nümerik bir alana, metin giremezsiniz. Lütfen sadece rakam giriniz.    *' + inLabel +'\n'; sendThis=false;
		}
	}
}

function checkPhone(inval, inLabel, inReq, inMax){
	var fvar_no = $F(inval+'_NO');
	var fvar_area = $F(inval+'_AREA');
	if ($(inval+'_COUNTRY') == undefined){
		var fvar_country = '_NA_';
	}else{
		var fvar_country = $F(inval+'_COUNTRY');
	}
	//is Required?
	if (inReq == 'Y'){
		if (fvar_no == ''){abox=abox+'Lütfen isaretli alanlari doldurunuz   *' + inLabel +'\n'; sendThis=false;}
		if (fvar_area == ''){abox=abox+'Lütfen * isaretli bütün bilgileri doldurunuz   *' + inLabel +'\n'; sendThis=false;}
		if (fvar_country != '_NA_' && fvar_country == ''){abox=abox+'Lütfen * isaretli bütün bilgileri doldurunuz   *' + inLabel +'\n'; sendThis=false;}
	}

	//entered any input on number field.. check others..
	if (fvar_no != ''){
		if (!allowInString(fvar_no,'0123456789')){abox=abox+'Nümerik bir alana, metin giremezsiniz. Lütfen sadece rakam giriniz.    *' + inLabel +'\n'; sendThis=false;}
		if (fvar_no.length != inMax){abox=abox+'Eksik rakam girdiniz!    *'+inLabel +'\n'; sendThis=false;}
	}
	
	//not required but entered.. req for not double..
	if (inReq == 'N' && fvar_no != ''){
		if (fvar_area == ''){abox=abox+'Lütfen * isaretli bütün bilgileri doldurunuz   *' + inLabel +'\n'; sendThis=false;}
		if (fvar_country != '_NA_' && fvar_country == ''){abox=abox+'Lütfen * isaretli bütün bilgileri doldurunuz   *' + inLabel +'\n'; sendThis=false;}
	}
	
}

function checkEmail(inval, inLabel){
	var fvar = $F(inval);
	if (fvar != ''){
		if (!isValidEmail(fvar)){
			abox=abox+'Lütfen geçerli bir e-posta adresi giriniz.    *'+inLabel + '\n'; sendThis=false;
		}
	}
}

function isValidEmail(inEmail){
	var email_regexp = new RegExp('^[a-zA-Z\.\-_-]+@([a-zA-Z\.\-_-]+\.)+[a-zA-Z]{2,4}$');
	var emailPass = true;
	if (inEmail.length>0){
		if (!email_regexp.test(inEmail)){
			emailPass = false;
		}else if (inEmail.indexOf('.')==-1){
			emailPass = false;
		}
	}else{
		emailPass = false;
	}
	return emailPass;
}

function ConfirmDelete(){
	var fName = $('userForm');
	if (window.confirm("Bu islem tüm ilgi alanlarinda üyeliginizi sonlandiracaktir !  ")){
		fName.DURUM.value="UN";
		fName.submit();
	}
}

function confirmCancel(){
	if (window.confirm("Yaptiginiz degisiklikler KAYDEDILMEDEN kapatilacaktir !  ")){
		$('#dialog').dialog('close');
		return false;
	}
}
function shareWindow(siteName){

	var sharedPage = window.location;
	
	
	if (siteName == "facebook"){
			
			t=document.title;
			window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(sharedPage)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
			
	}else if (siteName == "twitter"){
	
		window.open('http://twitter.com/?status='+encodeURIComponent(sharedPage),'sharer','toolbar=1,status=1');
	
	}else if (siteName == "friendfeed"){
			window.open('http://friendfeed.com/?url='+encodeURIComponent(sharedPage),'sharer','toolbar=1,status=1');
	}
	


}
 function ChangeDisplay(objid){
 
    var objTableBody = document.getElementById(objid);
    if (objTableBody.style.display =="none"){
    	objTableBody.style.display = "block";
    }else if(objTableBody.style.display =="block"){
    	objTableBody.style.display = "none";
    }
    
   }
  
  function showAgency(){
		var  introDiv = document.getElementById("agencyGeneral");
		var  agencyDiv = document.getElementById("agencyData");
		introDiv.style.display = "none";
		agencyDiv.style.display = "block";
	
}
function goToPopup (pageLocation){   
		window.open(pageLocation);
	} 
  
   	
function chooseRoom(roomId,roomAv){
	var tcount = 0;
	var tcount2 = 0;
	var aDivs = document.getElementsByTagName('div');
	var currentDiv;
	var currentButton;
	var currentChosen;
	var roomDiv = document.getElementById("room"+roomId);
	var roomButton = document.getElementById("roomButton"+roomId);
	var roomChosen = document.getElementById("roomButtonChosen"+roomId);
	var callRecord =  document.getElementById("callRecord");
	var contText =  document.getElementById("contText");
	var contButton =  document.getElementById("contButton");
	
	for (var y = 0; y < aDivs.length; y++) {
	
		var dname = document.getElementById("room"+ y);
		if (dname!= null) {
			tcount++;
		}
	}
	for (var y = 0; y < aDivs.length; y++) {
	
		var dname = document.getElementById("roomButton"+ y);
		if (dname!= null) {
			tcount2++;
		}
	}
	for (var x = 0; x < tcount; x++) {
		
		currentDiv = document.getElementById("room"+x);
			if (x%2==0){
				currentDiv.className= "grey-row";
			}else{
				currentDiv.className= "white-row";
			}
		
	}
	for (var z = 0; z < tcount; z++) {
		
		currentButton = document.getElementById("roomButton"+z);
		currentChosen = document.getElementById("roomButtonChosen"+z);
		currentButton.style.display = "block";
		currentChosen.style.display = "none";
		
		}
		
		if (roomAv=='ok'){
			roomDiv.className= "yellow-row";
			roomButton.style.display = "none";
			roomChosen.style.display = "block";
			callRecord.style.display = "none";
			contText.style.display = "none";
			contButton.style.display = "block";
		}else{
			roomDiv.className= "yellow-row";
			contText.style.display = "block";
			contButton.style.display = "none";
		}
	
	
}
function changeAction(actOrder){
	
	var aDivs = document.getElementsByTagName('div');
	var tcount=0;
	var actButton = document.getElementById("ActButton"+ actOrder);
	var actDetail= document.getElementById("ActDetail"+ actOrder);
	var currentDiv,currentButton;
	for (var y = 0; y < aDivs.length; y++) {

		var dname = document.getElementById("ActTitle"+ y);
		if (dname!= null) {
			tcount++;
		}
	}
	for (var x = 0; x < tcount; x++) {
		currentButton=document.getElementById("ActButton"+ x);
		currentDiv = document.getElementById("ActDetail"+x);
		currentDiv.style.display = "none";
		currentButton.className="action-plus";
		
		
	}
	if (actButton.className=='action-plus'){
			actDetail.style.display="block";
			actButton.className="action-minus";
			
			}
	
}
  

function addTransfer(callingCheck){
	var currentCheck = document.getElementById(callingCheck);
	var divOk = document.getElementById(callingCheck + 'Ok');
	var divNo = document.getElementById(callingCheck + 'No');
	if(currentCheck.checked){ 
			divOk.style.display="block";
			divNo.style.display="none";
			
		}else{
			divOk.style.display="none";
			divNo.style.display="block";
			}
	
	
	}

function chooseRow(rowName,rowId,rowAv){
	var tcount = 0;
	var tcount2 = 0;
	var aDivs = document.getElementsByTagName('div');
	var currentDiv;
	var currentButton;
	var currentChosen;
	var rowDiv = document.getElementById(rowName+rowId);
	var rowButton = document.getElementById(rowName+"Button"+rowId);
	var rowChosen = document.getElementById(rowName+"ButtonChosen"+rowId);
	if (rowName =='room'){
	var callRecord =  document.getElementById("callRecord");
	var contText =  document.getElementById("contText");
	}
	
	for (var y = 0; y < aDivs.length; y++) {
	
		var dname = document.getElementById(rowName+ y);
		if (dname!= null) {
			tcount++;
		}
	}
	for (var y = 0; y < aDivs.length; y++) {
	
		var dname = document.getElementById(rowName+"Button"+ y);
		if (dname!= null) {
			tcount2++;
		}
	}
	for (var x = 0; x < tcount; x++) {
		
		currentDiv = document.getElementById(rowName+x);
		if (rowName !='transport' && rowName !='insurance' && rowName !='payment'){
			if (x%2==0){
				currentDiv.className= "grey-row";
			}else{
				currentDiv.className= "white-row";
			}
		}else{
			currentDiv.className= "white-row-top";
			}
		
	}
	for (var z = 0; z < tcount2; z++) {
		
		currentButton = document.getElementById(rowName+"Button"+z);
		currentChosen = document.getElementById(rowName+"ButtonChosen"+z);
		currentButton.style.display = "block";
		currentChosen.style.display = "none";
		
		}
		if (rowName =='room'){
			if (rowAv=='ok'){
				rowButton.style.display = "none";
				rowChosen.style.display = "block";
				callRecord.style.display = "none";
				contText.style.display = "none";
			}else{
				
				contText.style.display = "block";
			}
		}else{
				
				rowButton.style.display = "none";
				rowChosen.style.display = "block";
		}
		if (rowName !='transport' && rowName !='insurance' && rowName !='payment'){
				rowDiv.className= "yellow-row";
		}else{
				rowDiv.className= "yellow-row-top";
			}
		
	
}

 
function ChangeDisplayHideOthers(ObjName,ObjOrd){
var mydivs = [];
var tcount = 0;
var aDivs = document.getElementsByTagName('div');
for (var y = 0; y < aDivs.length; y++) {

	var dname = document.getElementById(ObjName+ y);
	if (dname!= null) {
		mydivs[tcount] =ObjName+ y;	
   		tcount++;
   	}
}
    var strDisplay = "block";
    var objTableBody = document.getElementById(ObjName+ObjOrd);
    if(objTableBody.style.display=="none"){
    objTableBody.style.display = "block";
    }else{
    objTableBody.style.display = "none";
    }
    for (var j=0; j<tcount; j++){
		  if (mydivs[j] != ObjName+ObjOrd){
		  	strDisplay = "none";
		  	objTableBody = document.getElementById(mydivs[j]);
		  	objTableBody.style.display = strDisplay;
		  }
	}
}
 
