
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";
	
}
  
   
