// 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(); }
	}
}

// SADECE RAKAM GYRYLEBYLYR::::::


//////////////////// AÇIKLAMA BALONU //////////////////////////
var IE = document.all?true:false

if (!IE) document.captureEvents(Event.MOUSEMOVE)

document.onmousemove = getMouseXY;

var tempX = 0
var tempY = 0

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
	
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  obj_info = document.getElementById("info")
  obj_info.style.top = tempY + 5;
  obj_info.style.left = tempX + 5;
  return true
}


function alert_msg(titletext,genislik){

var enbas="<table border=0 cellspacing=0 cellpadding=0><tr><td width=13><img src=images/yenivit/kutu/1.gif width=13 height=13></td><td background=images/yenivit/kutu/2.gif>&nbsp;</td><td width=13><img src=images/yenivit/kutu/3.gif width=13 height=13></td></tr><tr><td background=images/yenivit/kutu/4.gif>&nbsp;</td><td bgcolor=FFFFFF>";
var enson="</td><td background=images/yenivit/kutu/6.gif>&nbsp;</td></tr><tr><td valign=top><img src=images/yenivit/kutu/7.gif width=13 height=13></td><td background=images/yenivit/kutu/8.gif>&nbsp;</td><td valign=top><img src=images/yenivit/kutu/9.gif width=13 height=13></td></tr></table>";
	
var titletext=enbas+titletext+enson;	
obj_info = document.getElementById("info")
obj_info.style.display = '';
obj_imagetitle = document.getElementById("imagetitle");
obj_imagetitle.innerHTML = titletext;

}

function away()
{
obj_info = document.getElementById("info")
obj_info.style.display = 'none';
}
function goToURL() { history.go(-1); }

/////////////////// AÇIKLAMA BALONU ////////////////////////////////

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