String.prototype.trim = function() {
	return this.replace(/^\s*|\s*$/g,"");
}
String.prototype.removeTags = function() {
	return this.replace(/<[^>]*>/g,"");
}
Array.prototype.exists = function (value) {
    for (var Cnt = 0; Cnt < this.length; Cnt++) {
        if (this[Cnt] === value) {
            return true;
        }
    }
    return false;
}
Date.prototype.tamTarih = function() {
	var vGunler = ["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"];
	var vAylar = ["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"];
	return this.getDate() + " " + vAylar[this.getMonth()] + " " + this.getFullYear() + ", " + vGunler[this.getDay()];
};
function $() {
	var vEls = new Array();
	for (var Cnt = 0; Cnt < arguments.length; Cnt++) {
		var vEl = arguments[Cnt];
		if (typeof vEl == 'string')
			vEl = document.getElementById(vEl);
		if (arguments.length == 1)
			return vEl;
		vEls.push(element);
	}
	return vEls;
}
function ToggleDisplay(vObj) {
	if (!vObj) return;
	if (typeof(vObj) == "string") vObj = document.getElementById(vObj);
	if (!vObj) return;
	if (arguments.length > 1) {
		vObj.style.display = 'none';
		return;
	}
	if (vObj.style.display != 'none' ) {
		vObj.style.display = 'none';
	} else {
		vObj.style.display = '';
	}
}
function LoadImages() {
	if (LoadImages.arguments.length > 0) {
		var sTemp,Cnt;
		if (!document.Images) document.Images = new Array();
		for (Cnt = 0; Cnt < LoadImages.arguments.length; Cnt++) {
			sTemp = String(LoadImages.arguments[Cnt]).trim();
			if (sTemp == "") continue;
			if (sTemp.indexOf("/") == -1) sTemp = "IMG/" + sTemp;
			if (sTemp.indexOf(".") == -1) sTemp += ".png";
			document.Images[document.Images.length] = new Image();
			document.Images[document.Images.length-1].src = sTemp;
		}
	}
}
function OffsetPos(vObj,vRef) {
	var vT,iL,iT;
	if (typeof(vObj) == "string") vObj = $(vObj);
	if (typeof(vRef) == "string") vRef = $(vRef);
	if (!vObj) return [0,0,0,0];
	iL = vObj.offsetLeft;
	iT = vObj.offsetTop;
	vT = vObj.offsetParent;
	if (vT == vRef) return [iL,iT,vObj.offsetWidth,vObj.offsetHeight];
	while (vT) {
		iL += vT.offsetLeft;
		iT += vT.offsetTop;
		vT = vT.offsetParent;
		if (vT == vRef) return [iL,iT,vObj.offsetWidth,vObj.offsetHeight];
	}
	return [iL,iT,vObj.offsetWidth,vObj.offsetHeight];
}
function CenterObject(cNesne) {
	if (typeof(cNesne) == "string") cNesne = document.getElementById(cNesne);
	var iWidth = cNesne.offsetWidth;
	var iHeight = cNesne.offsetHeight;
	var iVPHeight = getViewportHeight();
	var iVPWidth = getViewportWidth();
	var cBody = document.documentElement;
	var iScrollTop = parseInt(cBody.scrollTop,10);
	var iScrollLeft = parseInt(cBody.scrollLeft,10);
	cNesne.style.top = (iScrollTop + ((iVPHeight - iHeight) / 2)) + "px";
	if (CenterObject.arguments.length <= 1)
		cNesne.style.left =  (iScrollLeft + ((iVPWidth - iWidth) / 2)) + "px";
}
function getViewportHeight() {
	if (window.innerHeight != window.undefined) return window.innerHeight;
	if (document.compatMode =='CSS1Compat') return document.documentElement.clientHeight;
	if (document.body) return document.body.clientHeight; 
	return window.undefined;
}
function getViewportWidth() {
	if (window.innerWidth != window.undefined) return window.innerWidth; 
	if (document.compatMode == 'CSS1Compat') return document.documentElement.clientWidth; 
	if (document.body) return document.body.clientWidth; 
	return window.undefined; 
}
function OpenWindow(sURL,iW,iH,sProps,bReplace) {
	var vWin = null;
	var iDefTop = (screen.height - (iH + 80)) / 2;
	var iDefLeft = (screen.width - iW) / 2;
	var sDefProps = "height=" + iH + ",width=" + iW + ",top=" + iDefTop + ",left=" + iDefLeft + ((arguments.length > 3) ? "," + sProps : ",resizable=1,fullscreen=0,location=0,status=1,menubar=1,scrollbars=1,toolbar=0,titlebar=1,channelmode=0,directories=0,dependent=1");
	var bDefReplace = ((arguments.length > 4) ? bReplace : false);
	vWin = window.open(sURL,null,sDefProps,bDefReplace);
	vWin.focus();
}