//------

function CheckKey_number(cnt) 
{
	var compareString = '0123456789';
	var mainString=String.fromCharCode(window.event.keyCode);
	if(compareString.indexOf(mainString)!=-1)
		return;
	else
		window.event.returnValue=false;
}

//-----


/*
  // Cookie Sıfırla başla
	var expire = "";
   expire = new Date((new Date()).getTime() + 0 * 3600000);
   expire = "; expires=" + expire.toGMTString();
   document.cookie = "DumanOyuncak1925Sepet" + "=" + escape(1) + expire;
   // Cookie sıfırla Bit
*/  

var arrRecords = new Array();
var arrCookie = new Array();
var recCount = 0;
var strRecord="";
expireDate = new Date;
expireDate.setDate(expireDate.getDate()+365);
function cookieVal(cookieName) 
{
	thisCookie = document.cookie.split("; ")
	for (i = 0; i < thisCookie.length; i++) 
	{
		if (cookieName == thisCookie[i].split("=")[0]) 
		{
			return thisCookie[i].split("=")[1];
   		}
}
return 0;
}
function loadCookie() 
{
   
	if(document.cookie.indexOf("DumanOyuncak1925Sepet=") != -1) 
	{
		arrRecords = cookieVal("DumanOyuncak1925Sepet").split(",");
		currentRecord();
   }
    
   
}
function addsepet(frmsepet) {
var test=0;
strRecord = "";
recCount = arrRecords.length;
if (recCount != 0) 
{
	for (j = 0; j < recCount; j++) 
	{
		arrRc = arrRecords[j].split(":");
		if (frmsepet.txtID.value == arrRc[0]) {
			alert("Ürün zaten listenize ekli bu ürün ile ilgili değişiklikleri lütfen Alışveriş Sepetim menüsünden yapınız!");
			test=1
		} //if
	}// for
} // if

if (test !=1 )
{
	strRecord = strRecord + frmsepet.txtID.value;
	strRecord = strRecord + ":" + frmsepet.txtAdet.value;
	arrRecords[recCount] = strRecord ;
	document.cookie = "DumanOyuncak1925Sepet="+arrRecords+"; expires=" + expireDate.toGMTString(); 
	alert("Ürün sepetinize " + frmsepet.txtAdet.value + " adet eklenmiştir. Saparişlerinizi Alışveriş Sepetim menüsünü kullanarak kontrol edebilirsiniz.");
	//arrRecords = "";
} 
}

function delRec(recC) {
if ( confirm("!!!... Ürün Sepetinizden Silinecek ...!!!")) {
strRecordDel = "";
arrRecords = cookieVal("DumanOyuncak1925Sepet").split(",");
recCount = arrRecords.length;
for(i = 0; i < recCount; i++) {
	if (recC != i) {
	 if (strRecordDel=="") { 
		strRecordDel += arrRecords[i] ;
		}
		else {
		strRecordDel += "," + arrRecords[i] ;
		}
	}		
}
//document.getElementById("kayit"+recC).style.display = "none";
document.cookie = "DumanOyuncak1925Sepet="+strRecordDel+"; expires=" + expireDate.toGMTString(); 

window.location.reload();
}
}

function update(recC,adt) {
var arrRC="";
strRecordDel = "";
arrRecords = cookieVal("DumanOyuncak1925Sepet").split(",");
recCount = arrRecords.length;
for(i = 0; i < recCount; i++) {
	arrRC = arrRecords[i].split(":");
	if (recC == arrRC[0]) {
	 if (strRecordDel=="") { 
			arrRC[0] = recC;
			arrRC[1] = adt;
			arrRecords[i] = arrRC[0] + ":" + arrRC[1];
			strRecordDel += arrRecords[i] ;
		}
		else {
			arrRC[0] = recC;
			arrRC[1] = adt;
			arrRecords[i] = arrRC[0] + ":" + arrRC[1];
			strRecordDel += "," + arrRecords[i] ;
		}
	}		
	else {
	if (strRecordDel=="") { 
			strRecordDel += arrRecords[i] ;
		}
		else {
			strRecordDel += "," + arrRecords[i] ;
		}
}
document.cookie = "DumanOyuncak1925Sepet="+strRecordDel+"; expires=" + expireDate.toGMTString(); 
window.location.reload();
}
}

function currentRecord() {
if (arrRecords.length != "") {
strRecord = arrRecords[recCount];
currRecord = strRecord.split(":");
   }
}
recCount = 0;
loadCookie();
//  End -->