//-----------------------------------------------------------------
var toplam = 0;

/*function formatCurrency(num) 
{
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
	num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
	cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+'.'+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + num + ',' + cents + ' <b>YTL.</b>');
}

function tutar(txtFiyat,txtid,act,firm_id) 
{
	var Adet = document.getElementById("txtAdet"+txtid).value;
	var tutar;
	var arrTemp="";
	var strsepet;
	
	tutar = parseInt(Adet) * parseInt(txtFiyat);
	if(act!="goster")
		update(act,Adet,firm_id);
	toplam =  parseInt(toplam) + parseInt(tutar);
	
	document.getElementById("tutar"+txtid).innerHTML=formatCurrency(tutar);
}*/
//--------------------------------------------------------------------







/*
  // Cookie Sıfırla başla
	var expire = "";
   expire = new Date((new Date()).getTime() + 0 * 3600000);
   expire = "; expires=" + expire.toGMTString();
   document.cookie = "Ases1925mylist" + "=" + 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(firm_id) 
{
   
	if(document.cookie.indexOf("Ases1925"+firm_id+"=") != -1) 
	{
		arrRecords = cookieVal("Ases1925"+firm_id).split(",");
		currentRecord();
   }
    
   
}


function addsepet_tek(frmsepet,firm_id,okul_id) {
loadCookie("mylist");
var test=0;
strRecord = "";
recCount = arrRecords.length;

tmp_test = 0;

	for (j = 0; j < recCount; j++)
	{
		if(okul_id==arrRecords[j]) test = 1;
	}
	if(test==0) 
	{
		strRecord = strRecord + "," + okul_id
		tmp_test = 1;
	}
	else
	{
		alert("Bu okul listenize daha önce eklenmiş.");
	}
	if(tmp_test==1)
	{
		arrRecords[recCount] = strRecord ;
		document.cookie = "Ases1925"+firm_id+"="+arrRecords+"; expires=" + expireDate.toGMTString(); 
		alert("Okul Listenize Eklenmiştir.");
	}
	//arrRecords = "";

}



function addsepet(frmsepet,firm_id) {
loadCookie("mylist");
var test=0;
strRecord = "";
recCount = arrRecords.length;


	tmp_test = 0;
	for(i=1;i<=frmsepet.i.value;i++)
	{
		//alert("asdasd");
		x = document.getElementById("okul_id_"+i);
		if(x.checked) 
		{
		 	test = 0;
			for (j = 0; j < recCount; j++)
			{
				if(x.value==arrRecords[j]) test = 1;
			}
			if(test==0) 
			{
				strRecord = strRecord + "," + x.value
				tmp_test = 1;
			}
		}
	}
	if(tmp_test==1)
	{
		arrRecords[recCount] = strRecord ;
		document.cookie = "Ases1925"+firm_id+"="+arrRecords+"; expires=" + expireDate.toGMTString(); 
		alert("Seçtiğiniz Okullar Listenize Eklenmiştir.");
	}
	//arrRecords = "";

}

function delRec(recC,firm_id) 
{
	if ( confirm("!!!... Okul Listenizden Silinecek ...!!!") ) 
	{
		strRecordDel = "";
		arrRecords = cookieVal("Ases1925"+firm_id).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 = "Ases1925"+firm_id+"="+strRecordDel+"; expires=" + expireDate.toGMTString(); 
		window.location.reload();
	}
}

/*
function update(recC,adt,firm_id) {
var arrRC="";
strRecordDel = "";
//alert(firm_id);
arrRecords = cookieVal("Ases1925"+firm_id).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 = "Ases1925"+firm_id+"="+strRecordDel+"; expires=" + expireDate.toGMTString(); 
window.location.reload();
}
}
*/

function currentRecord() {
if (arrRecords.length != "") {
strRecord = arrRecords[recCount];
   }
}
recCount = 0;
loadCookie("mylist");
//  End -->