 function urunekle(id, urun_tipi, tip, id2){
	if(tip=='coklu')
	{
	for(i=0; i<document.fiyatform.fiyat.length; i++){
		if(document.fiyatform.fiyat[i].selected == true)
			fiyat_id = document.fiyatform.fiyat[i].value;
	}
	$j.post('sepet.php',	{id: id, islem : 'ekle', fiyat_id: fiyat_id, urun_tipi: urun_tipi},
		function(ajaxCevap){
			$j('#sepet').html(ajaxCevap) 
		}
	);
	return false;
	}
	if(tip=='tekli')
	{
	fiyat_id=id2;
	$j.post('sepet.php',	{id: id, islem : 'ekle', fiyat_id: fiyat_id, urun_tipi: urun_tipi},
		function(ajaxCevap){
			$j('#sepet').html(ajaxCevap) 
		}
	);
	return false;	
	}
}
function urunsil(id){
	$j.post('sepet.php',	{id: id, islem : 'sil'},
		function(ajaxCevap){
			$j('#sepet').html(ajaxCevap) 
		}
	);
	return false;
}

function ilceAyikla(){
	
	for(i=0; i<document.teslimat_bilgileri.sehir.length; i++){
		if(document.teslimat_bilgileri.sehir[i].selected == true)
			sehir_id = document.teslimat_bilgileri.sehir[i].value;
	}
	if(sehir_id!='bos')
	{
	$j.post('ililce.php',{id: sehir_id},
		function(ajaxCevap){
			$j('#sehir').html(ajaxCevap) 
		}
	);
	return false;
	}
}

function mahalleAyikla(id){
	
	for(i=0; i<document.teslimat_bilgileri.sehir.length; i++){
		if(document.teslimat_bilgileri.sehir[i].selected == true)
			sehir_id = document.teslimat_bilgileri.sehir[i].value;
	}
	for(i=0; i<document.teslimat_bilgileri.ilce.length; i++){
		if(document.teslimat_bilgileri.ilce[i].selected == true)
			ilce_id = document.teslimat_bilgileri.ilce[i].value;
	}
	if(sehir_id!='bos' && ilce_id!='bos')
	{
	$j.post('ililce.php',{sehir_id: sehir_id, ilce_id : ilce_id},
		function(ajaxCevap){
			$j('#sehir').html(ajaxCevap) 
		}
	);
	return false;
	}
}

function cercevePaspartuListele(){
	for(i=0; i<document.cerceve_paspartu.tip.length; i++){
		if(document.cerceve_paspartu.tip[i].selected == true)
			kategori = document.cerceve_paspartu.tip[i].value;
	}
	$j.post('frame.php',	{kategori : kategori, islem : 'cerceve_paspartu_ayikla'},
		function(ajaxCevap){
			$j('#cerceve_paspartu_').html(ajaxCevap) 
		}
	);
	
	return false;
}

function cerceveListele(){
	for(i=0; i<document.cerceve_turleri.tip.length; i++){
		if(document.cerceve_turleri.tip[i].selected == true)
			kategori = document.cerceve_turleri.tip[i].value;
	}
	$j.post('frame.php',	{kategori : kategori, islem : 'cerceve_ayikla'},
		function(ajaxCevap){
			$j('#cerceveler').html(ajaxCevap) 
		}
	);
	
	return false;
}

function cercevePaspartuEkle(id){
	$j.post('frame.php',	{cerceve_id : id, islem : 'cerceve_paspartu_ekle'},
		function(ajaxCevap){
			$j('#frame').html(ajaxCevap) 
		}
	);
	$j.post('frame.php',	{cerceve_id : id, islem : 'hesap_cerceve_paspartu_ekle'},
		function(ajaxCevap){
			$j('#hesap').html(ajaxCevap) 
		}
	);
	return false;
}



function cerceveEkle(id){
	$j.post('frame.php',	{cerceve_id : id, islem : 'cerceve_ekle'},
		function(ajaxCevap){
			$j('#frame').html(ajaxCevap) 
		}
	);
	$j.post('frame.php',	{cerceve_id : id, islem : 'hesap_cerceve_ekle'},
		function(ajaxCevap){
			$j('#hesap').html(ajaxCevap) 
		}
	);
	return false;
}


function cerceveTemizle(){
	$j.post('frame.php',	{islem : 'cerceve_temizle'},
		function(ajaxCevap){
			$j('#frame').html(ajaxCevap) 
		}
	);
	$j.post('frame.php',	{islem : 'hesap_cerceve_temizle'},
		function(ajaxCevap){
			$j('#hesap').html(ajaxCevap) 
		}
	);
	return false;
}

function kagitPaspartuTemizle(){
	$j.post('frame.php',	{islem : 'kagit_paspartu_temizle'},
		function(ajaxCevap){
			$j('#frame').html(ajaxCevap) 
		}
	);
	$j.post('frame.php',	{islem : 'hesap_kagit_paspartu_temizle'},
		function(ajaxCevap){
			$j('#hesap').html(ajaxCevap) 
		}
	);
	return false;
}

function cercevePaspartuTemizle(){
	$j.post('frame.php',	{islem : 'cerceve_paspartu_temizle'},
		function(ajaxCevap){
			$j('#frame').html(ajaxCevap) 
		}
	);
	$j.post('frame.php',	{islem : 'hesap_cerceve_paspartu_temizle'},
		function(ajaxCevap){
			$j('#hesap').html(ajaxCevap) 
		}
	);
	return false;
}

function cerceveSepeteEkle(){
	$j.post('frame.php',	{islem : 'sepete_ekle'},
		function(ajaxCevap){
			$j('#hesap').html(ajaxCevap) 
		}
	);
	return false;
}

function cerceveSepet(){
	$j('#cercfiyatdiv').html('<div style="text-align:center;"><img src="images/loader.gif" align="center"></div>'); 
	$j.post('frame.php',	{islem : 'add_to_basket'},
		function(ajaxCevap){
			$j('#cercfiyatdiv').html(ajaxCevap) 
		}
	);
	return false;
}


function duvarRengiDegistir(kod){
	$j('#calisma_alani').css('background-color', '#'+kod);
	$j.post('frame.php',	{islem : 'duvar_rengi_degistir', kod: kod});
	return false;
}

function cerceveleAyarla(urun_id,id){
	if(id>0 && urun_id>0)
		{
		$j('#cerceve_buton').html('<a href="cerceve.php/'+urun_id+'/'+id+'" ><img src="resimler/cercevele.png" border="0" /></a>'); 
		}
	else
		{
		$j('#cerceve_buton').html('<a href="#" onclick="alert(\'Tabloyu çerçevelemek için önce boyut bilgisi seçiniz.\'); return false;"><img src="resimler/cercevele.png" border="0" /></a>'); 
		}	
	return false;
}

function cerceveUrunleriGetir(id){
	$j('#urunlerr').html('<div style="margin-top:140px; text-align:center;"><img src="images/loader.gif" align="center"></div>'); 
	$j.post('frame.php',	{id : id, islem : 'cerceve_urunleri_getir'},
		function(ajaxCevap){
			$j('#urunlerr').html(ajaxCevap);
			JT_init();
		}
	);
	return false;
}

function cerceveleriListele(tip,urun_id,birim_id){
	$j('#cercevelist').html('<div style="margin-top:70px; text-align:center;"><img src="images/loader.gif" align="center"></div>'); 
	$j.post('frame.php?id=asd/'+urun_id+'/'+birim_id+'/',	{tip : tip, islem : 'cerceveleri_listele'},
		function(ajaxCevap){
			$j('#cercevelist').html(ajaxCevap);
		}
	);
	return false;
}

function cercevePaspListele(tip,urun_id,birim_id){
	$j('#cercevelist').html('<div style="margin-top:70px; text-align:center;"><img src="images/loader.gif" align="center"></div>'); 
	$j.post('frame.php?id=asd/'+urun_id+'/'+birim_id+'/',	{tip : tip, islem : 'cerceve_pasp_listele'},
		function(ajaxCevap){
			$j('#cercevepasplist').html(ajaxCevap);
		}
	);
	return false;
}

function cerceveUygula(id,urun_id,birim_id){
	$j.post('frame.php',	{id : id, islem : 'cercevele'},
		function(ajaxCevap){
			$j('#calisma_alani').html(ajaxCevap);
			$j.post('frame.php?id=asd/'+urun_id+'/'+birim_id+'/',	{islem : 'tutar_hesapla'},
				function(ajaxCevap){
					$j('#tutar').html('');
					$j('#tutar').html(ajaxCevap) ;
				}
			);
		}
	);
	return false;
}

function cercevePaspUygula(id,urun_id,birim_id){
	$j.post('frame.php',	{id : id, islem : 'cerceve_pasp'},
		function(ajaxCevap){
			$j('#calisma_alani').html(ajaxCevap);
			$j.post('frame.php?id=asd/'+urun_id+'/'+birim_id+'/',	{islem : 'tutar_hesapla'},
				function(ajaxCevap){
					$j('#tutar').html('');
					$j('#tutar').html(ajaxCevap) ;
				}
			);
		}
	);
	
	return false;
}

function resmiSec(id,birim){
	$j.post('frame.php',	{id : id, birim : birim, islem : 'resim_sec'},
		function(ajaxCevap){
			$j('#calisma_alani').html(ajaxCevap);
		}
	);
	return false;
}

function cerceveSifirla(urun_id,birim_id){
	$j.post('frame.php',	{islem : 'cerceve_sifirla'},
		function(ajaxCevap){
			$j('#calisma_alani').html(ajaxCevap);
			$j('#calisma_alani').css("background","#FFFFFF");
			$j.post('frame.php?id=asd/'+urun_id+'/'+birim_id+'/',	{islem : 'tutar_hesapla'},
				function(ajaxCevap){
					$j('#tutar').html('');
					$j('#tutar').html(ajaxCevap) ;
				}
			);
		}
	);
	
	return false;
}

function kagitPaspartuEkle(id, kod, urun_id, birim_id){
	var genislik = $j('#paspartu_genislik').val();
	$j.post('frame.php',	{id: id, genislik : genislik, renk_kodu : kod, islem : 'kagit_paspartu_ekle'},
		function(ajaxCevap){
			$j('#calisma_alani').html(ajaxCevap) 
		}
	);
	$j.post('frame.php?id=asd/'+urun_id+'/'+birim_id+'/',	{islem : 'tutar_hesapla'},
		function(ajaxCevap){
			$j('#tutar').html('');
			$j('#tutar').html(ajaxCevap) ;
		}
	);
	return false;
}

function camApply(id,urun_id,birim_id){
	$j.post('frame.php',	{id: id,  islem : 'cam_ekle'},
		function(ajaxCevap){
			$j('#camdiv').html(ajaxCevap) 
		}
	);
	$j.post('frame.php?id=asd/'+urun_id+'/'+birim_id+'/',	{islem : 'tutar_hesapla'},
		function(ajaxCevap){
			$j('#tutar').html('');
			$j('#tutar').html(ajaxCevap) ;
		}
	);
	return false;
}


function clickclear(thisfield, defaulttext) {
if (thisfield.value == defaulttext) {
thisfield.value = "";
}
}

function clickrecall(thisfield, defaulttext) {
if (thisfield.value == "") {
thisfield.value = defaulttext;
}
}

function $j(element) {
	return document.getElementById(element);
}

function Toggle(element) {
	var e = $j(element);
	if (e.style.display == 'none')
		e.style.display = '';
	else
		e.style.display = 'none';
}




