// JavaScript Document
var xmlhttp=false;
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

function MM_swapImgRestore(){ //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}

function MM_preloadImages(){ //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}

function MM_findObj(n, d){ //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
	}

function MM_swapImage(){ //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}

function domID(id){
	if(id != "undefined" || id != "" || id != null){
		return document.getElementById(id);
	}else{
		return null;
	}
	}

function openwindow(theURL,winName,features){ //v2.0
  window.open(theURL,winName,features);
	}

function getUrl(url){
	window.location.href = url;
}

function chgCls(fld, cls){
	if(typeof(fld)=="string"){obj = domID(fld)}else{obj = fld}
	obj.className = cls
	}

function chgClsX(fld, cls1, cls2){
	if(typeof(fld)=="string"){obj = domID(fld)}else{obj = fld}
	if(obj.className == cls1){obj.className = cls2}else{obj.className = cls1}
	return obj.className;
	}
	
var executeID = 0;
var executed = false;
var t1 = 0;
function sendLoad(obj, lnk, func){
	document.body.style.cursor = "wait";
	var obj_ = (obj != null)?domID(obj):obj;
	xmlhttp.open("GET", lnk ,true);
	executeID++;
	executed = true;
	if(obj != null) obj_.innerHTML = "<img src='/finclude/images/loadinganimation.gif' width='208' height='13'>";
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4){
			executed = false;
			var respond = xmlhttp.responseText;
			document.body.style.cursor = "inherit";
			if(respond != ""){
				if(obj != null) obj_.innerHTML = respond;
				if(func){eval(func);}
			}
		}
	}
	xmlhttp.send(null);
	}

function sendLoadMsg(lnk, func){
	xmlhttp.open("GET", lnk ,true);
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4){
			var alinan = xmlhttp.responseText;
			if(alinan != ""){ alert(alinan); }
			if(func){eval(func);}
		}
	}
	xmlhttp.send(null);
	}

function resizeWindow(wid,heg,mt,rs){
	var topAlign = (screen.height/2)-(heg/2);	//Ortalama için üst boþluk
	var leftAlign = (screen.width/2)-(wid/2);	//Ortalama için sol boþluk
	if (mt){window.moveTo(leftAlign, topAlign);}
	if (rs){window.resizeTo(width=wid, height=heg);}
	}

function ascention(a,b){return a - b;}
function descention(a,b){return b - a;}

function gebc(elementClassName, domElement, elementTagName) {
	var classElements = new Array();
	if ( domElement == null )
		domElement = document;
	if ( elementTagName == null )
		elementTagName = '*';
	var els = domElement.getElementsByTagName(elementTagName);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+elementClassName+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function addOptions(lbl,indVal,itm, _selected, _valueCheck){
	if(!_selected){_selected = true;}else{_selected = false;}
	if(!_valueCheck){_valueCheck = true;}else{_valueCheck = false;}
	var winItem = itm;
	var optlen = winItem.length;
	var add = true;
	if(optlen>0){
		for(ix=0;ix<optlen;ix++){
			if(winItem.options[ix].value==indVal && _valueCheck){
				add = false;
				break;
				}
			}
		}
	if(add==true){
		winItem.options[optlen] = new Option(lbl,indVal)
		winItem.options[optlen].selected = _selected;
	}
	}

function removeOpt(opt, index, selectLast){
	if(!index){ index = opt.selectedIndex; }
	if(index > -1){ opt.remove(index); }
	if(selectLast){ if(opt.options.length > 0){ opt.options[opt.options.length - 1].selected = true; } }
}

function removeAllOpt(opt){
	for(i = 0; i < opt.length; i++){
		opt.remove(i);
	}
	for(i = 0; i < opt.length; i++){
		opt.remove(i);
	}
}


function sortList(listbox, dir){ 
	var list = document.getElementById(listbox);
	arrTexts = new Array(); 
	arrValues = new Array(); 
	arrOldTexts = new Array(); 
	
	for(i=0; i<list.length; i++){ 
		arrTexts[i] = list.options[i].text; 
		arrValues[i] = list.options[i].value; 
		arrOldTexts[i] = list.options[i].text; 
	} 
	if(dir == "asc" || !dir){ arrTexts.sort(ascention); }
	if(dir == "desc" || !dir){ arrTexts.sort(descention); }
	
	for(i=0; i<list.length; i++){ 
		list.options[i].text = arrTexts[i]; 
		for(j=0; j<list.length; j++){ 
			if (arrTexts[i] == arrOldTexts[j]){ 
				list.options[i].value = arrValues[j]; 
				j = list.length; 
			} 
		} 
	} 
}

function updOptions(oldval, newlabel, newval, itm){
	var winItem = itm;
	var groups = winItem.length;
	var index = -1;
	for(i=0;i<groups;i++){
		if(winItem.options[i].value==oldval){
			winItem.options[i].value = newval;
			winItem.options[i].text = newlabel;
			index = i;
			break;
		}
	}
	return index;
	}

function remOptions(itm,obj){
	var winItem = itm;
	var groups = winItem.length;
	if(obj || obj != ""){
		for (i=0;i<winItem.length;i++){
			if(winItem.options[i].value==obj){
				winItem.remove(i);
			}
		}
		if(winItem.length > 0){winItem.options[0].selected = true}
	}
	}

function selectOpt(fld,val){
  for (i=0;i<fld.options.length;i++){
	  if (fld.options[i].value == val){fld.options[i].selected=true;}
  }
}

function selectAllOpt(opt){
	if(opt){
	opt.multiple = true;
	for(i = 0; i < opt.length; i++){
		opt.options[i].selected = true;
	}
	}
}

function chkNumber(evn){
	if(!evn){evn = window.event; }
	var rt = new Array(48,49,50,51,52,53,54,55,56,57,37,38,39,40,8,46,110,190,9,96,97,98,99,100,101,102,103,104,105,35,36);
	for(i=0;i<rt.length;i++){ if (Number(evn.keyCode) != Number(rt[i])){	evn.returnValue = false; }else{ evn.returnValue = true; break; } }
	if(evn.srcElement.value.indexOf(",")>0){ evn.srcElement.value = evn.srcElement.value.replace(",",".")}
	}

function returnZeros(fld){
	if (fld.value==""){
		fld.value = "0"
	}else{
		if(Number(fld.value) > 0){ fld.value = Number(fld.value); }
	}
	}

function correctDecimals(fld){
	var num = fld.value;
	var sp = fld.value.split(".");
	if(num.indexOf(".") > -1){
		num = sp[0]+".";
		for(i = 1; i < sp.length; i++){
			num += sp[i];
		}
	}
	fld.value = num;
	}
	
function getObjectInfo(obj,pos){
	var _left = _top = _width = _height = 0;
    if(!pos){pos="[_left,_top]"}else{pos="_"+pos}
	if (obj&&obj.offsetParent) {
	do {
		_left += obj.offsetLeft;
		_top += obj.offsetTop;
		_width = obj.offsetWidth;
		_height = obj.offsetHeight;
	} while (obj = obj.offsetParent);
		return eval(pos);
	}
	}

function trim(str){
    var stripCharCodes = {code_9  : true, code_10 : true, code_13 : true, code_32 : true};
    while(stripCharCodes["code_" + str.charCodeAt(0)] == true) {str = str.substring(1, str.length);}
    while(stripCharCodes["code_" + str.charCodeAt(str.length - 1)] == true) {str = str.substring(0, str.length - 1);}
    return str;
	}

function getCookies(name) { 
   var start = document.cookie.indexOf(name+"="); 
   var len = start+name.length+1; 
   if ((!start) && (name != document.cookie.substring(0,name.length))) return null; 
   if (start == -1) return null; 
   var end = document.cookie.indexOf(";",len); 
   if (end == -1) end = document.cookie.length; 
   return unescape(document.cookie.substring(len,end)); 
} 

function setCookies(name,value,expires) { 
	expires = expires * 60*60*24*1000;
	var today = new Date();
	var expires_date = new Date( today.getTime() + (expires) );
	var cookieString = name + "=" +escape(value) + 
	   ( (expires) ? ";expires=" + expires_date.toGMTString() : "");
	document.cookie = cookieString; 
}

function requestPage(compObj,compVal){
	var qsArray = returnQStringVars(window)
	var newArray = new Array()
	var actvPage = returnCurrentPage(window)
	var qstrings = "?"
	for(i=0;i<qsArray.length;i++){
		if(qsArray[i].substring(0,compObj.length)!=compObj){
			newArray[newArray.length] = qsArray[i]
		}
	}

	for(i=0;i<newArray.length;i++){
		qstrings += newArray[i] + "&"
		}
	
	qstrings += compObj + "=" + compVal + "&"
	window.location.href = actvPage + qstrings + "d=1"
}

function returnQStringVars(winValue){
    var elArray = new Array()
    if(winValue.location.href.indexOf("?")!=-1){
	    var qstring = winValue.location.href.split("?")[1]
	    var elem = qstring.split("&")
	    for(i=0;i<elem.length;i++){
		    if(elem[i]!=""&&elem[i]!="d=1"){
			    elArray[elArray.length] = elem[i]
		    }
		}
	}
    return elArray;
	}

function extractArr(arr, extracted){
	var nArr = new Array();
	for(i=0;i<arr.length;i++){
		arrSp = arr[i].split("=");
		if(arrSp[0] != extracted){ nArr[nArr.length] = arr[i]; }
	}
	return nArr;
	}

function requestQueryString(qStringElement) {
	for (i = 0; i < returnQStringVars(window).length; i++) {
		if (returnQStringVars(window)[i].indexOf(qStringElement) > 0) {
			return i
		}
	}
    }

function returnCurrentPage(winValue){
	var qstring = winValue.location.href.split("?")[0]
	return qstring.split("/")[qstring.split("/").length-1]
	}

function deleteRowByLink(lnk, clr1, clr2){
	if(!clr1){clr1 = "";}
	if(!clr2){clr2 = "#EEEEEE";}
	var tableRow = lnk.parentNode.parentNode;
	var tbl = tableRow.parentNode.parentNode.id;
	tableRow.parentNode.deleteRow(tableRow.rowIndex);
	coloredTR("basketdetaillist", clr1, clr2);
	}

function coloredTR(tbl, clr1, clr2){
	if(!clr1){clr1 = "";}
	if(!clr2){clr2 = "#EEEEEE";}
	x = 1;
	var tr = domID(tbl).getElementsByTagName("TR")
	for (i=1;i<tr.length;i++){
		if(tr[i].childNodes.length > 0 && tr[i].childNodes[0].tagName == "TD"){
			var x = x + 1;
			if (x==2){
				tr[i].bgColor=clr1;
				var x=0;
			}else{
				tr[i].bgColor=clr2;
			}
		}
	}
	}

function formatNumberToScr(num, dec, spl){
    if (!dec) { dec = 2 }
    if (!spl) { spl = "." }
    num = num.toString().replace(",", ".")
    num = (num.indexOf(".") > 0) ? num : num + ".01";
    var zeros = ""
    for (i = 0; i < dec; i++) { zeros += "0" }
    var counter = 1 + "" + zeros
    int = Math.round(num * counter) / counter
    var dig = int.toString().split(".")[1]
	var sint = spl+"00";
    if (dig != undefined ) {
        if (dig.length < 2) { dig = dig + "0" }
		sint = dig;
		if(dig == "01"){sint = spl+"00";}else{sint = spl+dig;}
    }
        int = getThousands(int.toString().split(".")[0]);
		int = int+sint;
    return int;
	}

function getThousands(num){
    if (!num) { num = "12345678" }
    var temp = num
    var steps = 3
    var thsArray = new Array
    var result = ""
    for (i = 0; i < num.length / steps; i++) {
        thsArray[thsArray.length] = temp.substring(temp.length - steps, temp.length)
        temp = temp.substring(0, temp.length - steps)
    }
    for (i = 0; i < thsArray.length; i++) {
        result = thsArray[i] + "," + result
    }
    return result.substring(0, result.length - 1)
	}

function formToMail(frm){
	tbl = "<table width='100%' border='1' bordercolor='#d5d5d5' bgcolor='#f5f5f5' cellpadding='5'>";
	tbl += "<tr><td width='200' style='font-weight:bold;'>Tarih</td><td>"+GetDateTime()+"</td></tr>";
	for(i=0; i < frm.elements.length; i++){
		key = frm.elements[i].id || frm.elements[i].name;
		if(frm.elements[i].value != ""){ val = (frm.elements[i].value)?frm.elements[i].value : frm.elements[i].options[frm.elements[i].selectedIndex].value; }else{ val = ""; }
		if(key != "gonder" && key != "islem" && key != "htmlcode" && key.substring(key.length - 1, key.length) != "*"){ tbl += "<tr><td width='200' style='text-transform:capitalize; font-weight:bold;'>"+key.replace("g_", "").replace("_", " ")+"</td><td>"+val+"</td></tr>"; }
	}
	tbl += "</table>";
	var htmlCode = document.createElement("INPUT");
	htmlCode.type = "text";
	htmlCode.style.width = 150;
	htmlCode.id = "htmlcode";
	htmlCode.name = "htmlcode";
	if(domID("htmlcode") == undefined || domID("htmlcode") == null){ frm.appendChild(htmlCode); }
	domID("htmlcode").value = tbl;
	return true;
	}
	
function GetTime(){
	var date = new Date();
	var saat = date.getTime();
	return (saat);
	}

function GetDateTime(){
	var dayName = new Array("Pazartesi","Salý","Çarþamba","Perþembe","Cuma","Cumartesi","Pazar");
	var date = new Date();
	var day = date.getDate();
	var month = date.getMonth()+1;
	var year = date.getYear();
	if (day < 10) day = "0" + day;
	if (month < 10) month = "0" + month;
	
	var today = day + "." + month + "." + year + " "+ dayName[date.getDay() - 1] +"";
	var hou = date.getHours();
	var min = date.getMinutes();
	var sec = date.getSeconds();
	if (hou < 10) hou = "0" + hou;
	if (min < 10) min = "0" + min;
	if (sec < 10) sec = "0" + sec;
	var result = today + " " + hou + ":" + min + ":" + sec;
	return result;
	}

function setTxtToLink(txt){
	spec = new Array(/ - /g, / /g, /\//g, /ý/g, /ð/g, /ü/g, /þ/g, /ö/g, /ç/g, /Ð/g, /Ü/g, /Þ/g, /Ý/g, /Ö/g, /Ç/g);
	revs = new Array("_",    "_",  "_",   "i",  "g",  "u",  "s",  "o",  "c",  "g",  "u",  "s",  "i",  "o",  "c");
	if(txt != null){
		for(i = 0; i < spec.length; i++){
			txt = txt.replace(eval(spec[i]), revs[i]);
		}
		txt = txt.toLowerCase();
	}
		return txt;
	}

function toLower(txt){
	spec = new Array(/ý/g, /ð/g, /ü/g, /þ/g, /ö/g, /ç/g, /Ð/g, /Ü/g, /Þ/g, /Ý/g, /Ö/g, /Ç/g);
	revs = new Array("ý",  "ð",  "ü",  "þ",  "ö",  "ç",  "Ð",  "Ü",  "Þ",  "Ý",  "Ö",  "Ç");
	var av = "";
	for(i = 0; i < spec.length; i++){
		txt = txt.replace(eval(spec[i]), revs[i]);
	}
	return txt.toLowerCase();
	}

var _xImageBtnList = new Array();
function setBtnImages(_item){
	loadBtnImagesToCache(_item);
	for(_xi = 0; _xi < _xImageBtnList.length; _xi++){
		var tmp = new Image();
		tmp.imageIndex = _xi;
		tmp.onload = function(){
			var img = document.createElement("IMG");
			img.src = this.src;
			img.width = Number((_xImageBtnList[this.imageIndex].offsetHeight * img.width) / img.height);
			img.height = _xImageBtnList[this.imageIndex].offsetHeight;
			_xImageBtnList[this.imageIndex].appendChild(img);
			document.body.removeChild(this);
		}
		tmp.src = _xImageBtnList[_xi].getAttribute("image");
		tmp.style.visibility = "hidden";
		document.body.appendChild(tmp);
	}
}

function loadBtnImagesToCache(_item){
	if(!_item){ _item = document; }
	var _ximagebtns = _item.getElementsByTagName("button");
	for(_xi = 0; _xi < _ximagebtns.length; _xi++){
		var _xbtntype = _ximagebtns[_xi].type.toString().toLowerCase();
		if(_ximagebtns[_xi].getAttribute("image") && _ximagebtns[_xi].getAttribute("image") != ""){
			_xImageBtnList[_xImageBtnList.length] = _ximagebtns[_xi];
			_ximagebtns[_xi].style.padding = "0px 0px 0px 0px";
			_ximagebtns[_xi].style.margin = "0px 0px 0px 0px";
			_ximagebtns[_xi].style.border = "0px outset threedface";
			_ximagebtns[_xi].style.background = "0%";
		}
	}
}

function windowHeight(){
	if(!domID("tmpdiv")){
		var div = document.createElement("DIV"); div.style.position = "absolute"; div.style.bottom = 0; div.id = "tmpdiv";
		document.body.appendChild(div);
	}
	var offTop = domID("tmpdiv").offsetTop;
	document.body.removeChild(domID("tmpdiv"));
	return offTop;
	}

var timedOps_tout = null;
function timedOps(func, time){
	if(timedOps_tout != null){ clearTimeout(timedOps_tout); timedOps_tout = null; }
	timedOps_tout = setTimeout(function(){ eval(func); clearCode();},time);
	}

function dragCode(obj){
	if(!obj){ obj = "output"; }
	dragStart(window.event, obj);
	//timedOps('dragStart(window.event, "output");',200);
}

function clearCode(){
	if(timedOps_tout != null){
		clearTimeout(timedOps_tout);
		timedOps_tout = null;
	}
	}

var debugdesktoplocation = "";
function debug(txt, repeat){
	debug.create();
	if(!repeat) repeat = true;
	var _result = txt;
	
	if(txt != "" && txt != null){
		if(typeof(txt) == "object"){
			if(txt.length > 0){
				_result = "";
				var i = 0;
				for(i = 0; i < txt.length; i++){
					_result += "<div>" + txt[i] + "</div>";
				}
			}
		}
		if(repeat){
			domID("output_content").innerHTML = "<div style='border-bottom:1px dotted #CCC;width:100%; height:17px; overflow:hidden; cursor:pointer;' toggle='expand' onclick=\"toggleOutputLine(this)\" title=\""+ _result +"\">" + _result + "</div>" + domID("output_content").innerHTML;
		}else{
			domID("output_content").innerHTML = "<div style='border-bottom:1px dotted #CCC;width:100%; height:17px; overflow:hidden; cursor:pointer;' toggle='expand' onclick=\"toggleOutputLine(this)\" title=\""+ _result +"\">" + _result + "</div>";
		}
	}
	}

debug.create = function(){
	if(!domID("output")){
		var output = document.createElement("DIV");
		output.id = "otpt";
		var clearCntBtn = "<button onfocus=\"this.blur();\" style=\"height:16px;\" onclick=\"outputClear();\" image=\"include/images/clear.gif\"></button> ";
		var minimizeBtn = "<button onfocus=\"this.blur();\" style=\"height:16px;\" onclick=\"outputMinimize()\" image=\"include/images/min.gif\"></button> ";
		var maximizeBtn = "<button onfocus=\"this.blur();\" style=\"height:16px;\" onclick=\"outputMaximize();\" image=\"include/images/max.gif\"></button>";
		var _left =(document.body.offsetWidth) - 300;
		var _top = document.body.scrollTop + (windowHeight() + 15);
		var html = "<div id=\"output\" style=\"width:300px; height:150px; position:absolute;left:"+_left+"px; top:"+_top+"px; font-family:tahoma; font-size:11px; z-index:1000;\" desktoplocation=\"minimized\">" +
		"<table width=\"100%\" height=\"150\" cellpadding=0 cellspacing=2 id=\"output_container\" border=1 bgcolor=\"threedface\">" +
		"	<tr>" +
		"		<td height=10 style=\"border-bottom:1px solid #666; padding-top:2px; padding-right:2px;\" bgcolor=\"activecaption\"><div style=\"cursor:move; height:20px; color:white; padding-top:1px;\" ondblclick=\"outputReset();\" onMouseDown=\"dragCode();\" onMouseUp=\"clearCode();\"><span style=\"float:left;\"><strong>Output</strong></span><span style=\"float:right;\">" + clearCntBtn + minimizeBtn + maximizeBtn + "</span></div></td>" +
		"	</tr>" +
		"	<tr>" +
		"		<td valign=top bgcolor=\"#FFFFFF\"><div id=\"output_content\" style=\"overflow:auto; height:100px; padding:3px 3px 3px 3px;\"></div></td>"+
		"	</tr>" +
		"</table>" +
		"</div>";
	
		output.innerHTML = html;
		document.body.appendChild(output);
		outputRestore();
		setBtnImages(domID("output"));
	}
	}

function outputClear(){
	var d = domID("output_content");
	d.innerHTML = "";
	}

function outputReset(){
	if(debugdesktoplocation == "maximized"){
		outputRestore();
	}else{
		outputMaximize();
	}
	return debugdesktoplocation;
	}

function outputRestore(){
	var d = domID("output");
	debugdesktoplocation = d.getAttribute("desktoplocation");
	if(debugdesktoplocation != ""){
		d.setAttribute("desktoplocation", "")
		//d.style.position = "fixed";
		d.style.width = "300px";
		d.style.height = 150;
		domID("output_container").height = d.style.height;
		domID("output_content").style.height = Number(d.style.height.replace("px","")) - 35;
		d.style.left = (document.body.offsetWidth) - Number(d.style.width.replace("px","")) - 30;
		d.style.top = (windowHeight() + 15) - Number(d.style.height.replace("px","")) - 30;
	}
	}

function outputMinimize(){
	var d = domID("output");
	debugdesktoplocation = d.getAttribute("desktoplocation");
	if(debugdesktoplocation != "minimized"){
		d.setAttribute("desktoplocation", "minimized")
		//d.style.position = "fixed";
		d.style.width = 300;
		d.style.height = 30;
		domID("output_container").height = d.style.height;
		domID("output_content").style.height = 0;
		d.style.left = (document.body.clientWidth) - Number(d.style.width.replace("px","")) - 30;
		d.style.top = (windowHeight() + 15) - Number(d.style.height.replace("px",""));
	}
	}

function outputMaximize(){
	var d = domID("output");
	debugdesktoplocation = d.getAttribute("desktoplocation");
	if(debugdesktoplocation != "maximized"){
		d.setAttribute("desktoplocation", "maximized")
		//d.style.position = "fixed";
		d.style.width = document.body.clientWidth;
		d.style.height = windowHeight();
		domID("output_container").height = d.style.height;
		domID("output_content").style.height = domID("output_content").parentNode.parentNode.parentNode.parentNode.offsetHeight - 35;
		d.style.left = "0px";
		d.style.top = 0;
	}
	}

function toggleOutputLine(outputrow){
	var toggle = outputrow.getAttribute("toggle");
	if(toggle == "expand"){
		outputrow.style.height = "";
		outputrow.setAttribute("toggle","collapse");
	}else{
		outputrow.style.height = "17px";
		outputrow.setAttribute("toggle","expand");
	}
	}

function catchErrors(msg, url, line_no){
	if(_catchErrors){
		debug.create();
		var urlSp = (url.indexOf("www") > -1)?url.split("www"):url.split("http://");
		var txt = ""+
		"<img src=\"include/images/error.gif\" width=16 align=\"absmiddle\" title=\"Link     : "+ urlSp[1] +"\n"+
		"Satýr    : "+ line_no +"\n"+
		"Nesne : "+ _errorElem +"\"> "+ msg +"<div style=\"padding-left:20px;\">"+
		"Link     : "+ urlSp[1] +"<br />"+
		"Satýr    : "+ line_no +"<br />"+
		"Nesne : "+ _errorElem +"</div>"
		debug(txt);
		return true;
	}
	}

var oldScroll = "";
function showProcessing(){
	var prg = domID("workprocessor");
	prg.style.position = "absolute";
	prg.style.top = 95;
	prg.style.left = 0;
	prg.style.width = document.body.clientWidth;
	prg.style.height = windowHeight();
	oldScroll = (document.body.scroll);
	document.body.scroll = "no";
	prg.className = "goster";
	}

function hideProcessing(){
	var prg = domID("workprocessor");
	prg.style.position = "absolute";
	prg.style.top = 0;
	prg.style.left = 0;
	prg.style.width = document.body.clientWidth;
	prg.style.height = windowHeight();
	document.body.scroll = oldScroll;
	prg.className = "gizle";
	}

function imageChecker(image, imgsrc){
    var myImage = new Image();	
        myImage.src = imgsrc;
    var clocktime = new Date();
    var utchours = clocktime.getUTCHours();
    var utcminutes = clocktime.getUTCMinutes();
    var utcseconds = clocktime.getUTCSeconds();
    var utcyear = clocktime.getUTCFullYear();
    var utcmonth = clocktime.getUTCMonth()+1;
    var utcday = clocktime.getUTCDate();
    var utctime = utcyear+''+utcmonth+''+utcday;
        utctime += utchours+''+utcminutes+''+utcseconds;
	var imageQ = (document.images[image].getAttribute("q")) ? document.images[image].getAttribute("q") : "" ;
 
    isNew = myImage.src;
    	document.images[image].src = myImage.src + '?' + imageQ + "#" + utctime;
	}
	
function removeRow(fld){
	fld.parentNode.deleteRow(fld.rowIndex);
	}
	
function checkFormValues(form, clr, emailField){
	for (i=0;i<form.elements.length;i++){
		if (form.elements[i].id.indexOf("g_") != -1){
			if (form.elements[i].value == ""){
				form.elements[i].parentNode.bgColor='#FFFFFF';
				form.elements[i].parentNode.bgColor=clr;
				try{
					form.elements[i].focus();
				} catch(e){
					
				}
				return false;
				var sendForm = false;
			}else{
				form.elements[i].parentNode.bgColor='#FFFFFF';
				var sendForm = true;
			}
		}
	}
	if(emailField != null){
		if (checkEmail(emailField)=='0'){
			emailField.parentNode.bgColor=clr;
			emailField.focus();
			var sendForm = false;
		}else{
			emailField.parentNode.bgColor='#FFFFFF';
			var sendForm = true;
		}
	}
	if (sendForm == true){form.submit();}
	}

function checkEmail(field){
	var email = field.value
	if (email.indexOf("@") < 2){
		field.focus();
		return false;
	}else{
		if (email.lastIndexOf(".") < 4){
			field.focus();
			return false;
		}else{
			return true;
		}
	}
	}

function resetForm(form, evalAct){
	var msg = confirm("Formdaki tüm veriler silinecektir.");
	if(msg){
		form.reset();
		eval(evalAct);
	}
}

function enterAction(e, evn){
	if(window.event){ e = window.event; }
	if(e.keyCode == 13){
		eval(evn);
	}
}

function keyAction(e, key, evn){
	if(window.event){ e = window.event; }
	if(e.keyCode == key){
		eval(evn);
	}
}

function cego(msg, evn){
	var con = confirm(msg);
	if(con){
		eval(evn.toString());
	}
}

String.prototype.reverse = function(){
	splitext = this.split("");
	revertext = splitext.reverse();
	reversed = revertext.join("");
	return reversed;
	}

function cloneRow(row){
	var newRow = row.cloneNode(true);
	newRow.id = "newRow"+row.rowIndex;
	row.parentNode.appendChild(newRow);
	clearRowJunks(newRow.id);
}

function clearRowJunks(rowID){
	var cells = domID(rowID).getElementsByTagName("TD");
	for(i = 0; i < cells.length; i++){
		var items = cells[i].childNodes;
		
		for(z = 0; z < items.length; z++){
			if(items[z].tagName){
				
				if(items[z].tagName == "INPUT" && items[z].type.toString().toUpperCase() == "TEXT"){
					items[z].value = items[z].defaultValue;
				}
				
				if(items[z].tagName == "SELECT"){
					if(items[z].options.length){ items[z].options[0].selected = true; }
				}
				
				if(items[z].tagName == "INPUT" && (items[z].type.toString().toUpperCase() == "RADIO" || items[z].type.toString().toUpperCase() == "CHECKBOX")){
					items[z].checked = false;
				}
				var id = items[z].id.toString();
				var name = items[z].name.toString();
				var idRev = new String(id);
				var idLen = parseInt(idRev.reverse()).toString().length;
				items[z].id = id.substring(0, id.length - idLen)+""+(domID(rowID).rowIndex+1);
				items[z].name = name.substring(0, name.length - idLen)+""+(domID(rowID).rowIndex+1);
				items[z].value = domID(rowID).rowIndex+1;
			}
		}
		
	}
}

function resetDefValue(fld, opt){
	if(opt){
		if(fld.value == ""){
			fld.value = fld.defaultValue;
		}
	}
	if(!opt){
		fld.value = (fld.value == fld.defaultValue)?"":fld.value;
	}
}

function hideEl(obj){
	if(domID(obj)){
		domID(obj).style.display = "none";
	}
}

function checkDate(entry) {
    var mo, day, yr;
    var re = /\b\d{1,2}[\/.]\d{1,2}[\/.]\d{4}\b/;
    if (re.test(entry)) {
        var delimChar = (entry.indexOf(".") != -1) ? "." : "-";
        var delim1 = entry.indexOf(delimChar);
        var delim2 = entry.lastIndexOf(delimChar);
        day = parseInt(entry.substring(0, delim1), 10);
        mo = parseInt(entry.substring(delim1+1, delim2), 10);
        yr = parseInt(entry.substring(delim2+1), 10);
        var testDate = new Date(yr, mo-1, day);
        if (testDate.getDate() == day) {
            if (testDate.getMonth() + 1 == mo) {
                if (testDate.getFullYear() == yr) {
                    return true;
                } else {
					return false;
                }
            } else {
				return false;
            }
        } else {
			return false;
        }
    } else {
		return false;
    }
}

