function validateIntValue(txt)
{
	if(!txt)
		return;
	txt.maxLength = 10;
	var bValidate = ((event.keyCode >= 96) && (event.keyCode <=105))
	bValidate = bValidate || ((event.keyCode >= 48) && (event.keyCode <=57))
	bValidate = bValidate && (!event.shiftKey);
	bValidate = bValidate || (event.keyCode == 8);
	bValidate = bValidate || (event.keyCode == 9);
	bValidate = bValidate || (event.keyCode == 37) || (event.keyCode == 39) || (event.keyCode == 46);
	
	if(!bValidate)
		event.returnValue = false;
}

function openDateTimePicker(returnBox)
{
	var paramObj = new Object();
	paramObj.caller = window;
	paramObj.returnTextBox = returnBox;
	window.showModalDialog ("DTP.htm",paramObj,"dialogHeight:300px;dialogWidth:280px;center:true;status:no;resizable:no;help:no;unadorned:yes;");
} 

function validateDateValueOnKeyDown(txt)
{
	validateIntValue(txt);
	
	var val = txt.value;
	var strPart="";
	if(val.length == 2)
		strPart = val.substring(0,2);
		
	if(val.length == 5)
		strPart = val.substring(5,2);
		
	if((strPart != "") && (!isNaN(strPart)))
		txt.value = val + ".";
		
	
}

function validateDateValueOnBlur(txt)
{
	try
	{
		var sValue=txt.value;
		var regExp = /[.]/g;
		regExp.global = true;
		sValue = sValue.replace(regExp,"/");
		var txtDate = new Date(sValue);
		
		if(isNaN(txtDate))
			txt.value = "";
	}
	catch(Exception)
	{
		txt.value = "";
	}
}


function validateIntValueOnKeyDown(txt)
{
	if(!txt)
		return;
		
		
	var bValidate = ((event.keyCode >= 96) && (event.keyCode <=105))
	bValidate = bValidate || ((event.keyCode >= 48) && (event.keyCode <=57))
	bValidate = bValidate && (!event.shiftKey);
	bValidate = bValidate || (event.keyCode == 8);
	bValidate = bValidate || (event.keyCode == 9);
	bValidate = bValidate || (event.keyCode == 37) || (event.keyCode == 39) || (event.keyCode == 46);
	bValidate = bValidate || (event.keyCode == 190);

	if(!bValidate)
		event.returnValue = false;
}

function validateIntValueOnBlur(txt)
{
	if(isNaN(txt.value))
	{
		txt.value = "";
		return;
	}
}

function checkItems(productID, chk)
{
	var items = document.all["txtSelecteds"].value;
	//var quans = document.all["txtSelectedQuantities"].value;
	//var selectedsAll = document.all["txtSelectedsAll"].value;
	
	if(chk.checked)
	{
		if(ItemInSelectedItems(productID, "txtSelecteds") == -1)
			items = items + "," + productID;
			
		//if(ItemInSelectedItems(productID, "txtSelectedsAll") == -1)
		//{
		//	selectedsAll = selectedsAll + ";" + productID;
		//	quans = quans + ";1";
		//}
			
		document.all["txtSelecteds"].value = items;
		//document.all["txtSelectedsAll"].value = selectedsAll;
		//document.all["txtSelectedQuantities"].value = quans;
	}
	else
	{
		RemoveFromSelecteds(productID);
		//if(document.all[txt].value == "")
		//	RemoveFromSelectedAlls(productID);
	}
}

function ItemInSelectedItems(item,container)
{
	var items = document.all[container].value;
	
	var selItems = items + ",";
	return selItems.indexOf("," + item + ",");
}

function RemoveFromSelecteds(item)
{
	var items = document.all["txtSelecteds"].value;
	
	if(ItemInSelectedItems(item, "txtSelecteds") > -1)
		items = items.replace("," + item,"");
		
	document.all["txtSelecteds"].value = items;
}

function CheckLen(Target) 
{
	StrLen = Target.value.length
	if (StrLen == 1 && Target.value.substring(0,1) == " ") 
	{
		Target.value = ""
		StrLen = 0
	}
	if (StrLen > 160 )
	{
		Target.value = Target.value.substring(0,160)
		CharsLeft = 0
		alert("Maximum 160 karakter yazabilirsiniz.")
	}
	else 
	{
		CharsLeft = 160 - StrLen
	}
	document.forms[0].Label3.value = CharsLeft
}
function CheckChar(Target)
{
	strVal = Target.value.charAt(Target.value.length-1);
	var ascCode = strVal.charCodeAt(0);
	if ((strVal=="<") || (strVal==">") || (strVal=="'") || (ascCode == 199) || (ascCode == 231) || (ascCode == 287) || (ascCode == 286) || (ascCode == 304) || (ascCode == 305) || (ascCode == 246) || (ascCode == 214) || (ascCode == 351) || (ascCode == 350) || (ascCode == 252) || (ascCode == 220))
	{
		alert('Lutfen Turkce karakterler girmeyiniz...');
		Target.value=Target.value.substring(0,Target.value.length-1);
	}
}
function CheckChars(Target)
{
	strVal = Target.value;
	for(var i = 0; i < strVal.length;i++)
	{
		var ascCode = strVal.charCodeAt(i);
		if ((strVal=="<") || (strVal==">") || (strVal=="'") || (ascCode == 199) || (ascCode == 231) || (ascCode == 287) || (ascCode == 286) || (ascCode == 304) || (ascCode == 305) || (ascCode == 246) || (ascCode == 214) || (ascCode == 351) || (ascCode == 350) || (ascCode == 252) || (ascCode == 220))
		{
			alert('Lutfen Turkce karakterler girmeyiniz...');
			Target.value = "";
			return;
		}
	}
}

function currencyFormat(fld, milSep, decSep, e) {
var sep = 0;
var key = '';
var i = j = 0;
var len = len2 = 0;
var strCheck = '0123456789';
var aux = aux2 = '';
var whichCode = (window.Event) ? e.which : e.keyCode;
if (whichCode == 13) return true;  // Enter
key = String.fromCharCode(whichCode);  // Get key value from key code
if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
len = fld.value.length;
for(i = 0; i < len; i++)
if ((fld.value.charAt(i) != '0') && (fld.value.charAt(i) != decSep)) break;
aux = '';
for(; i < len; i++)
if (strCheck.indexOf(fld.value.charAt(i))!=-1) aux += fld.value.charAt(i);
aux += key;
len = aux.length;
if (len == 0) fld.value = '';
if (len == 1) fld.value = '0'+ decSep + '0' + aux;
if (len == 2) fld.value = '0'+ decSep + aux;
if (len > 2) {
aux2 = '';
for (j = 0, i = len - 3; i >= 0; i--) {
if (j == 3) {
aux2 += milSep;
j = 0;
}
aux2 += aux.charAt(i);
j++;
}
fld.value = '';
len2 = aux2.length;
for (i = len2 - 1; i >= 0; i--)
fld.value += aux2.charAt(i);
fld.value += decSep + aux.substr(len - 2, len);
}
return false;
}

function commaSplit(srcNumber) {
var txtNumber = '' + srcNumber;
if (isNaN(txtNumber) || txtNumber == "") {
alert("Oops!  That does not appear to be a valid number.  Please try again.");
fieldName.select();
fieldName.focus();
}
else {
var rxSplit = new RegExp('([0-9])([0-9][0-9][0-9][,.])');
var arrNumber = txtNumber.split('.');
arrNumber[0] += '.';
do {
arrNumber[0] = arrNumber[0].replace(rxSplit, '$1,$2');
} while (rxSplit.test(arrNumber[0]));
if (arrNumber.length > 1) {
return arrNumber.join('');
}
else {
return arrNumber[0].split('.')[0];
      }
   }
}

var dayarray=new Array("Pazar","P.tesi","Sali","Çarsamba","Persembe","Cuma","C.tesi")
var montharray=new Array("Ocak","Subat","Mart","Nisan","Mayis","Haziran","Temmuz","Agustos","Eylül","Ekim","Kasim","Aralik")

function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var hours=mydate.getHours()
var minutes=mydate.getMinutes()
var seconds=mydate.getSeconds()
var dn="AM"
if (hours>=12)
dn="PM"
if (hours>12){
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
//change font size here
var cdate="<small><font color='000000' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+" "+hours+":"+minutes+":"+seconds+" "+dn
+"</b></font></small>"
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function goforit(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}
function saatigoster()
{
var d, saat_,dakika_,saniye_,x1,x2,s;
d = new Date();
saat_ = d.getHours(); if (saat_.toString(10).length==1) { saat_="0"+saat_; }
dakika_= d.getMinutes();if (dakika_.toString(10).length==1) { dakika_="0"+dakika_; }
saniye_= d.getSeconds();if (saniye_.toString(10).length==1) { saniye_="0"+saniye_; }
s = saat_ + ":" + dakika_ + ":" + saniye_;
saat.innerText = s; 
}








