
	String.prototype.trim = function() {
		// string veri turlerine "trim" fonksiyonu ekledii
		return this.replace(/\s*(\S.*\S|)\s*/, "$1");
	}

	var genelDelimiter_ = "[//]"
	

	var ikonDogru = new Image; ikonDogru.src = "/images/TMR/ikon_ok.gif"
	var ikonYanlis = new Image; ikonYanlis.src = "/images/TMR/ikon_sil.gif"
	var ikonSoru = new Image; ikonSoru.src = "/images/TMR/ikon_soru.gif"
	var ikonBos = new Image; ikonBos.src = "/images/TMR/dot_t.gif"
	var ikonEdit = new Image; ikonEdit.src = "/images/TMR/ikon_edit.gif"
	var ikonIY = new Image; ikonIY.src = "/images/TMR/ikon_IY.gif"
	
	var windowOnLoadQ = "", windowOnResizeQ = ""


	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	// cookie şeysi, webmaymunundan...
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 	

	function readCookie(name) {
	  if(document.cookie != '') {
		var actualValue, firstChar, lastChar;  var theBigCookie = document.cookie; firstChar = theBigCookie.indexOf(name);
		if(firstChar != -1) { firstChar += name.length + 1; lastChar = theBigCookie.indexOf(';', firstChar); if(lastChar == -1) lastChar = theBigCookie.length; 
			   actualValue = theBigCookie.substring(firstChar, lastChar); } 
		else { actualValue = false; }
		return actualValue;
	  }
	}
	
	function setCookie (name, input, hours, path) {
		var daValue = input;
		document.cookie = name + '=' + daValue + ((hours)?(';expires=' + 
			((new Date((new Date()).getTime() + parseInt(hours)*3600000)).toGMTString())):'') +
			((path == null) ? "" : ("; path=" + path));
	}
	
	function killCookie(name, path, domain) {
	  var firstChar, lastChar, theValue;
	  var theBigCookie = document.cookie;
	  firstChar = theBigCookie.indexOf(name);
	   if(firstChar != -1) {
		firstChar += name.length + 1;
		lastChar = theBigCookie.indexOf(';', firstChar);
		if(lastChar == -1) lastChar = theBigCookie.length;
		theValue = theBigCookie.substring(firstChar, lastChar);
	 } else {
		theValue = false;
	  }
	   if(theValue) {
		document.cookie = name + '=' + theValue + '; expires=Fri, 13-Apr-1970 00:00:00 GMT' + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:'');
	  }
	}
	
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 	



	function sayfadaki(n, d){
		// sayfa içinde tam adını vermeden objeye referans için, mesela form adi vermeden textbox'a referans gibi
		// orjinali MM_findObj
		
		var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
		if(!x && document.getElementById) x=document.getElementById(n); return x;	
		
	}

	
	
	function formHavingElement(elemanAdi) {
		var p, q, bulundu = false
		for (p=0; p<document.forms.length; p++)
			for (q=0; q<document.forms[p].elements.length; q++)
				if (document.forms[p].elements[q].name.indexOf(elemanAdi) > -1){ bulundu =true; return document.forms[p]}
		if (!bulundu) {alert("Sayfada '" + elemanAdi + "' elemanını içeren form kullanılmamış.\nLütfen kontrol ediniz!"); return null}
	}


	
	
	function px(katar){
		// katarın pixel olarak genişliğini döndür

		var boy=0, b,
		karakterler = new Array(new Array("WmwW", 11),
								new Array("M", 10),
								new Array("ACÇGĞOÖVQ", 8),
								new Array("BDHKLNPRSŞTUÜXYZabdegğhknoöpsşuüqyv-", 7),
								new Array("EFJcçxz", 6),
								new Array("Iİfrt", 5),
								new Array("j- ", 4),
								new Array("ıil.,;:!'", 3))
		for (k=0;k<katar.length;k++){
			b=false
			for (j=0;j<karakterler.length;j++) {
				if (karakterler[j][0].indexOf(katar.charAt(k))>-1) {boy+=karakterler[j][1]; b=true; break;}

				}
			boy = (b?boy:boy+6)
		}
		return boy //+2	
	}

	
	function boslukDoldur(soruIndex, doldurmaMetni){
		// sorulardaki uygun bosluk alanlarını doldurur
		tmpArray=doldurmaMetni.split("///")
		for (i=0; i<tmpArray.length;i++){
			tx = tmpArray[i].trim()
			sayfadaki("BD_" + soruIndex + "_" + (i+1)).value = tx
			sayfadaki("BD_" + soruIndex + "_" + (i+1)).style.width = px(tx);
		}
	}



	function yerlestirPX(obje, solMargin, ustMargin){

		NS = document.layers ? 1 : 0
		sol = document.layers ? ".left" : ".style.left"
		ust = document.layers ? ".top" : ".style.top"
		obj = sayfadaki(obje)
		if (solMargin>-1) eval("obj" + sol + "= solMargin")
		if (!(!ustMargin)) eval("obj" + ust + "= ustMargin")
	}


	
	function objeX(obje){
	
		if (document.all) { //simdill yalnizca IE

			var soldan = 0
			
			function usttenToplaGel(obj){
				soldan += obj.offsetLeft
				if (obj.offsetParent) {
					if (obj.offsetParent.tagName!="BODY") usttenToplaGel(obj.offsetParent)
				}
			}
			usttenToplaGel(sayfadaki(obje))
			return soldan
		}
		
//		var soldan = document.layers ? sayfadaki(obje).x : sayfadaki(obje).offsetLeft
//		return soldan
	}
	

	function objeY(obje){	

		if (document.all) { //simdill yalnizca IE

			var ustten = 0
			
			function usttenToplaGel(obj){
				ustten += obj.offsetTop
				if (obj.offsetParent) {
					if (obj.offsetParent.tagName!="BODY") usttenToplaGel(obj.offsetParent)
				}
			}
			usttenToplaGel(sayfadaki(obje))
			return ustten
		}
				
//		var ustten = document.layers ? sayfadaki(obje).y : sayfadaki(obje).offsetTop + document.body.scrollTop
//		return document.body.scrollTop

	}

	
	function interrogate(what) {
		var output = ''
		for (var i in what){
			output += i + '\n';
		}
		alert(output);
	}


	function gizle(obje){obje.style.display='none'}; function goster(obje){obje.style.display='block'}


	function w (katar){
		document.write(katar)
	}

	
	function fnToggleGM1(objeID, durum){	
		eval("L_"+objeID)[0].style.display = durum ? "inline" : "none"
		eval("L_"+objeID)[1].style.display = durum ? "none" : "inline"
		eval("M_"+objeID)[0].style.display = durum ? "inline" : "none"
		eval("M_"+objeID)[1].style.display = durum ? "none" : "inline"
	}
	


	function turkceUpperCase(tmpStr) {
	    var Sonuc = '';
	    for (i=0; i<tmpStr.length; i++) {
    	    if (tmpStr.charAt(i) == 'i')
        		Sonuc = Sonuc + 'İ';
	        else if (tmpStr.charAt(i) == 'ı')
    	        Sonuc = Sonuc + 'I';
        	else
            	Sonuc = Sonuc + tmpStr.charAt(i).toUpperCase();
		}
    	return(Sonuc);
	}

	
	function changetext(metin) {
	  var rng = document.body.createTextRange();	
	  if (metin != '')
		while (rng.findText(metin))
			rng.pasteHTML("<a href='javascript:alert(\"" + metin + ": . . . \")'><font class=highlight>" + metin + "</font></a>");
	}

		
	function initSozluk(){
		changetext("nöbetçi")
		changetext("salon")
		changetext("balon")
		changetext("Vazo")
		changetext("Yüzük")
		changetext("reasonable")
	}

	
	function tabloBoyuAyarla(){
		var kalanBosluk=document.body.clientHeight-objeY("tabloSonu")-1; 
		sayfadaki("boslukDoldur").style.height=(kalanBosluk>0?kalanBosluk:0)
	}


	function windowOnLoad(komut){
//		alert(komut)
		(windowOnLoad.arguments.length > 0) ? windowOnLoadQ += komut + ";" : eval(windowOnLoadQ)
	}


	function windowOnResize(komut){
		(windowOnResize.arguments.length > 0) ? windowOnResizeQ += komut + ";" : eval(windowOnResizeQ)
	}


	function togglePlayer(obje){
		sayfadaki("f_" + obje).GotoFrame(2);
		sayfadaki("f_" + obje).play();
	}



	function markUpXML(tagName, value){
		return "<" + tagName + ">" + value + "</" + tagName + ">"
	}


	function rdSelectedIndex(vRadio){
		var rValue = null		
		for (var i=0 ; i<vRadio.length; i++){
			if (vRadio[i].checked == true) rValue=i
		}
		return rValue	
	}



	function fnCheckImgSizeJS(strHedefImgName, intRealWidth, intRealHeight){
	
		if (eval("document.R_"+strHedefImgName)) { 		
		// eger hedef resim sayfada var ise	
		

//			var strSuffixHedefImg = !sayfadaki("CL_" + strHedefImgName)[0] ? "" : "[intCLIndex]"
			// aynı sayfada bir obje birden fazla defa kullanilmis ise

//			alert(strSuffixHedefImg)
//			for (var intCLIndex=0; intCLIndex < (strSuffixHedefImg == "" ? 1 : sayfadaki("CL_" + strHedefImgName).length); intCLIndex++){

//			alert(eval("sayfadaki('CL_" + strHedefImgName + "')" + strSuffixHedefImg + ".style.width"))

//			alert(	objeX("R_" + strHedefImgName) +
//				(eval("document.R_" + strHedefImgName + strSuffixHedefImg + ".width") - parseInt(eval("sayfadaki('CL_" + strHedefImgName + "')" + strSuffixHedefImg + ".style.width"))  ) / 2 )

//			}


			yerlestirPX("CL_" + strHedefImgName,
					objeX("R_" + strHedefImgName) +
						(eval("document.R_" + strHedefImgName + ".width") - parseInt(sayfadaki('CL_' + strHedefImgName).style.width)) / 2,
					objeY("R_" + strHedefImgName) +
						(eval("document.R_" + strHedefImgName + ".height") - parseInt(sayfadaki('CL_' + strHedefImgName).style.height)) / 2)

			//sayfadaki("CL_" + strHedefImgName).style.display = intRealWidth==eval("document.R_"+strHedefImgName+".width") && intRealHeight==eval("document.R_"+strHedefImgName+".height") ? "none" : "inline"

			if (sayfadaki("CL_" + strHedefImgName).style.display == "none")
				sayfadaki("CL_" + strHedefImgName).style.clip = "rect(0px 0px 0px 0px)"

			}

	}
	


	
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	// timelayn şeysi
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	
	var function_ = 0, parametre_ = 1
	
	function fnAdd2Timeline(arrTimeLine, intCheckPoint, strFunction, intIndex){
				// arrTimeLine = fnTAdd2Timeline(arrTimeLine, 1, "alert", 10) yaa :)

		if (!arrTimeLine[intCheckPoint]) 
			arrTimeLine[intCheckPoint] = new Array() 
			//ilk kez ekliyor ise o checkpointe, sorun cikmasin deyi

//		arrTimeLine[intCheckPoint].push(Array(strFunction, intIndex))
		// bazı makinelerde push sorun çıkardı push!
		arrTimeLine[intCheckPoint][arrTimeLine[intCheckPoint].length] = Array(strFunction, intIndex)		

		return arrTimeLine
	}

	function fnAtCheckPoint(arrThisTimeLine, intTime){
	
		sayfadaki("objDisplay").value = intTime
	
		if (eval("self.arrTimeLine_" + arrThisTimeLine)){
			arrThisTimeLine = eval("arrTimeLine_" + arrThisTimeLine)
			if (arrThisTimeLine[intTime]) 
				for (var i=0; i<arrThisTimeLine[intTime].length; i++)
					eval(arrThisTimeLine[intTime][i][function_] + "(" + arrThisTimeLine[intTime][i][parametre_] + ")")
		}
	}		


	function fnIndexliResimDegistir(strResimID, intResimIndex){

//			alert(strResimID + "_" + intResimIndex)
		if (document.images["R_"+ strResimID]){
//			var strSablonResimAdi = document.images["R_"+ strResimID].src

			var ttt = eval("arrImgs_" + strResimID)[intResimIndex].src
			document.images["R_" + strResimID].src = ttt
//			document.images["R_"+ strResimID].src = "/icerik/STOM/Images/" + strResimID.substr(0,8) + "/" + strResimID + "_" + intResimIndex + strSablonResimAdi.substr(strSablonResimAdi.lastIndexOf("."))
		}	
	}

	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 




	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	// drag seysi

	var dragOnayli=false
	var objDragElemani,intDragX,intDragY, temp1, temp2
	
	function fnHareketEttir(){
		if (event.button==1&&dragOnayli){
			objDragElemani.style.pixelLeft = temp1+event.clientX-intDragX
			objDragElemani.style.pixelTop = temp2+event.clientY-intDragY			
			self.status = dragOnayli
			return false
		}
	}
	
	function fnhandleDrag(){	
		if (!document.all)
			return		
		if (event.srcElement.className=="drag"){
			dragOnayli=true	
			eval("objDragElemani = document.all['div_" + event.srcElement.id.substr(event.srcElement.id.indexOf("_")+1) + "']")
			temp1=objDragElemani.style.pixelLeft; temp2=objDragElemani.style.pixelTop
			intDragX=event.clientX; intDragY=event.clientY			
			document.onmousemove = fnHareketEttir
		}
	}
	
	function restore(){
		dragOnayli=false
		self.status = dragOnayli
	}
	
	document.onmousedown=fnhandleDrag
	document.onmouseup=restore

	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 



	function fnFixInputWidth(objInput){	
		objInput.style.width = px(objInput.value) > 3 ? px(objInput.value) + 12 : 10		
	}
	

	
	function addToArray(arrArray, eleman){
		arrArray.length++
		arrArray[arrArray.length-1] = eleman		
		return arrArray
	}


	function add2Array(arrArray, eleman){
		arrArray.length++
		arrArray[arrArray.length-1] = eleman		
		return arrArray
	}




	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	// flash kontrol şeysi v2, daha iyi oldu boyle! V1'i sildim!
	// ilk hali, http://www.xs4all.nl/~ppk/js/flash.html'dan 
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 	
	
	function fnCheckFlashV2(){	
		/* 
			-2: detect edemedi
			-1: yok
			 0: buldu fakat versiyonu anlayamadı
			> 0 buldu, dönen versiyon numarasıdır
		*/
		
		var flashversion = -2	;
		var MSDetect = "false";
		if (navigator.plugins && navigator.plugins.length)
		{
			x = navigator.plugins["Shockwave Flash"];
			if (x)
			{
				if (x.description)
				{
					y = x.description;
					flashversion = y.charAt(y.indexOf('.')-1);
				}
			}
			else
				flashversion = -1;
			if (navigator.plugins["Shockwave Flash 2.0"])
			{
				flashversion = 2;
			}
		}
		else if (navigator.mimeTypes && navigator.mimeTypes.length)
		{
			x = navigator.mimeTypes['application/x-shockwave-flash'];
			if (x && x.enabledPlugin)
				flashversion = 0;
			else
				flashversion = -1;
		}
		else{
			MSDetect = "true";
			flashversion = fnCheckFlashVBSV2(MSDetect)
			}
		
		return flashversion;
	
	}


	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
	// Browser kontrol seysi, ilk hali PPK'dan
	// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

	
	var detect = navigator.userAgent.toLowerCase();
	
//	alert(navigator.userAgent.toLowerCase())
	var OS,browser,total,thestring;
	var version = 0;
	
	if (checkIt('konqueror'))
	{
		browser = "Konqueror";
		OS = "Linux";
	}
	else if (checkIt('omniweb')) browser = "OmniWeb"
	else if (checkIt('opera')) browser = "Opera"
	else if (checkIt('webtv')) browser = "WebTV";
	else if (checkIt('icab')) browser = "iCab"
	else if (checkIt('msie')) browser = "Internet Explorer"
	else if (!checkIt('compatible'))
	{
		browser = "Netscape Navigator"
		version = detect.charAt(8);
	}
	else browser = "An unknown browser";
	
//	alert(place)
	if (!version) version = detect.charAt(place + thestring.length);
//	alert(detect.charAt(place + thestring.length))
	
	if (!OS)
	{
		if (checkIt('linux')) OS = "Linux";
		else if (checkIt('x11')) OS = "Unix";
		else if (checkIt('mac')) OS = "Mac"
		else if (checkIt('win')) OS = "Windows"
		else OS = "...an unknown operating system";
	}
	
	function checkIt(string)
	{
		place = detect.indexOf(string) + 1;
		thestring = string;
		return place;
	}
	



	function setCharAt(strKatar, intPos, chChar){	
		return(strKatar.substr(0, intPos-1) + chChar + strKatar.substr(intPos, strKatar.length))
		}
		
