// DIV AC KAPAT
function ackapa(divadi){

		var idno=divadi;
		var divObject=document.getElementById(idno);
			if(divObject.style.display=="block"){
			divObject.style.display="none";
			}else{
			divObject.style.display="block";
			}

		}

//

// DIV AC KAPAT
function pozackapa(divadi,durum){

		var idno=divadi;
		var divObject=document.getElementById(idno);
			if(durum=="kapat"){
			divObject.style.display="none";
			}else{
			divObject.style.display="block";
			}

		}

//

// SADECE RAKAM GYRYLEBYLYR::::::
function sadecenumara(e) {
	olay = document.all ? window.event : e;
	tus = document.all ? olay.keyCode : olay.which;
	if(tus<48||tus>57) {
		if(document.all) { olay.returnValue = false; } else { olay.preventDefault(); }
	}
}

function rakamnokta(e) {
	olay = document.all ? window.event : e;
	tus = document.all ? olay.keyCode : olay.which;
	if(tus<46||tus>57||tus==47) {
		if(document.all) { olay.returnValue = false; } else { olay.preventDefault(); }
	}
}

// SADECE RAKAM GYRYLEBYLYR::::::


/////////////////// ETICARET ////////////////////////////////
function formCheck(formobj){
	// Enter name of mandatory fields
	var fieldRequired = Array("as", "fa", "fg", "t", "ep");
	// Enter field description to appear in the dialog box
	var fieldDescription = Array("ADI SOYADI", "FIRMA ADI","FIRMADAKI GÖREVI", "TELEFON", "E-POSTA");
	// dialog message
	var alertMsg = "Lütfen asagidaki bosluklari doldurunuz: \n\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " -  " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " -  " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " -  " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " -  " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;


	}else{
		alert(alertMsg);
		return false;
	}
}
// -->
var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i

function checkmail(e){
var returnval=emailfilter.test(e.value)
if (returnval==false){
alert("Lütfen Geçerli bir E-POSTA giriniz ! ")
e.select()
}
return returnval
}

var ns6=document.getElementById&&!document.all

function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}

function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft
}
}


function displaylimit(thename, theid, thelimit){
var theform=theid!=""? document.getElementById(theid) : thename
var limit_text='<span id="'+theform.toString()+'">'+thelimit+'</span>  '
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); 
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); 
}
}

var highlightcolor="lightyellow"

var ns6=document.getElementById&&!document.all
var previous=''
var eventobj

//Regular expression to highlight only form elements
var intended=/INPUT/

//Function to check whether element clicked is form element
function checkel(which){
if (which.style&&intended.test(which.tagName)){
if (ns6&&eventobj.nodeType==3)
eventobj=eventobj.parentNode.parentNode
return true
}
else
return false
}

//Function to highlight form element
function highlight(e){
eventobj=ns6? e.target : event.srcElement
if (previous!=''){
if (checkel(previous))
previous.style.backgroundColor=''
previous=eventobj
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
}
else{
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
previous=eventobj
}
}
/////////////////// ETICARET ////////////////////////////////

function detaypop(website,yukseklik,genislik,olcakmi) { 

// Dikine açilma hizi (Yüksek deger=hizli) 
var heightspeed = 30; 

// Genislemesine açilma hizi (Yüksek deger=hizli) 
var widthspeed = 30; 

// Soldan Kaç Piksel solda görünecek 
var leftdist = 50; 

// Yukaridan Kaç Piksel asagida görünecek 
var topdist = 50;  

if (document.all) { 
var winwidth = genislik; 
var winheight = yukseklik; 
var sizer = window.open("","","left=" + leftdist + ",top=" + topdist + ",width=1,height=1,scrollbars="+ olcakmi +", location=no, status=no, toolbar=no,menubar=no"); 
for (sizeheight = 1; sizeheight < winheight; sizeheight += heightspeed) { 
sizer.resizeTo("1", sizeheight); 
} 
for (sizewidth = 1; sizewidth < winwidth; sizewidth += widthspeed) { 
sizer.resizeTo(sizewidth, sizeheight); 
} 
sizer.location = website; 
} 
else 
window.location = website; 
} 


function binlik(deger){
        var strDeger = deger + "";
        var retval="";
        if(strDeger.length > 3){
                retval = lira(strDeger.substr(0,strDeger.length-3))+ "." + strDeger.substr(strDeger.length-3,3);
        }else{
                retval = strDeger;
        }
        return retval;
}

	
function resimdegistir(){
document.guvenlikresim.src="images/loading_start.gif";
}

function javauyari(theURL,mesaj){
var soru = confirm(mesaj);
if (soru == true) { window.location.href = theURL; }
}