function stringFilter(input) {
	var s = input.value;
	filteredValues = " qwertyuýopðüasdfghjklþizxcvbnmöçQWERTYUIOPÐÜASDFGHJKLÞÝZXCVBNMÖÇ,./\+-*;?=)(&%^'!:<>[]{}½$#£|";
	var i;
	var returnString = "";
	for (i=0; i<s.length; i++) {
		var c = s.charAt(i);
		if (filteredValues.indexOf(c) == -1) {
			returnString += c;
		}
	}
	input.value = returnString;
	input.focus();
}

function bgchange(nesne,img) {
	nesne.style.backgroundImage="url('http://"+location.host+"/images/"+img+"')";
}

function imgchange(nesne,img) {
	nesne=document.getElementById(nesne);
	nesne.src="http://"+location.host+"/images/"+img;
}

function imgchange2(model,num,size,grup) {
	document.getElementById('img200').src="http://"+location.host+"/images/"+grup+"/"+model+"/"+model+"_200_"+num+".jpg";
	if (size=='big') {document.getElementById('rel200').href="http://"+location.host+"/images/"+grup+"/"+model+"/big/"+model+"_"+num+".jpg"} else {document.getElementById('rel200').href=document.getElementById('img200').src}
	document.getElementById('rel200').rel="fancy";
}

function filtre_sec(nesne,img) {
	nesne.src="http://"+location.host+"/images/"+img+".png";
}

function aramaci(durum) {
	if (durum=='focus') {if (document.arama_form.arama.value=='ürün ara...') document.arama_form.arama.value=''};
	if (durum=='blur') {if (document.arama_form.arama.value=='') document.arama_form.arama.value='ürün ara...'};
//	alert(document.all.bmenu_td1.offsetLeft + "\n" + document.all.bmenu_td2.offsetLeft)
}

function imeici(durum) {
	if (durum=='focus') {if (document.getElementById('imei').value=='IMEI No giriniz...') document.getElementById('imei').value=''};
	if (durum=='blur') {if (document.getElementById('imei').value=='') document.getElementById('imei').value='IMEI No giriniz...'};
}

function tab(aktif) {
	document.getElementById('tab1').className='border_b gray_bg4 menu_txt';
	document.getElementById('tab2').className='border_b gray_bg4 menu_txt';
	document.getElementById('tab3').className='border_b gray_bg4 menu_txt';
	document.getElementById('tab4').className='border_b gray_bg4 menu_txt';
	document.getElementById('tab5').className='border_b gray_bg4 menu_txt';
	document.getElementById('tab6').className='border_b gray_bg4 menu_txt';
	document.getElementById('tab7').className='border_b gray_bg4 menu_txt';

	document.getElementById('tab1t').style.display='none';
	document.getElementById('tab2t').style.display='none';
	document.getElementById('tab3t').style.display='none';
	document.getElementById('tab4t').style.display='none';
	document.getElementById('tab5t').style.display='none';
	document.getElementById('tab6t').style.display='none';
	document.getElementById('tab7t').style.display='none';

	if (aktif==1) {document.getElementById('tab1').className="main_table_w menu_txt"; document.getElementById('tab1t').style.display='block'}
	if (aktif==2) {document.getElementById('tab2').className="main_table_w menu_txt"; document.getElementById('tab2t').style.display='block'}
	if (aktif==3) {document.getElementById('tab3').className="main_table_w menu_txt"; document.getElementById('tab3t').style.display='block'}
	if (aktif==4) {document.getElementById('tab4').className="main_table_w menu_txt"; document.getElementById('tab4t').style.display='block'}
	if (aktif==5) {document.getElementById('tab5').className="main_table_w menu_txt"; document.getElementById('tab5t').style.display='block'}
	if (aktif==6) {document.getElementById('tab6').className="main_table_w menu_txt"; document.getElementById('tab6t').style.display='block'}
	if (aktif==7) {document.getElementById('tab7').className="main_table_w menu_txt"; document.getElementById('tab7t').style.display='block'}
}

function tab2(aktif) {
	document.getElementById('tab1').className='tab_headings menu_item rounded-tl';
	document.getElementById('tab2').className='tab_headings menu_item';
	document.getElementById('tab3').className='tab_headings menu_item';
	document.getElementById('tab4').className='tab_headings menu_item rounded-tr';

	document.getElementById('tab1t').style.display='none';
	document.getElementById('tab2t').style.display='none';
	document.getElementById('tab3t').style.display='none';
	document.getElementById('tab4t').style.display='none';

	if (aktif==1) {document.getElementById('tab1').className="tab_headings header_highlight menu_item rounded-tl"; document.getElementById('tab1t').style.display='block'}
	if (aktif==2) {document.getElementById('tab2').className="tab_headings header_highlight menu_item"; document.getElementById('tab2t').style.display='block'}
	if (aktif==3) {document.getElementById('tab3').className="tab_headings header_highlight menu_item"; document.getElementById('tab3t').style.display='block'}
	if (aktif==4) {document.getElementById('tab4').className="tab_headings header_highlight menu_item rounded-tr"; document.getElementById('tab4t').style.display='block'}
}

function ajaxla(tabid,veri) {
	if (tabid==1) {var divid='filtre1t'; var sayfa='marka'}
	if (tabid==2) {var divid='filtre2t'; var sayfa='grup'}
	if (tabid==3) {var divid='filtre3t'; var sayfa='yeni'}
	if (tabid==4) {var divid='filtre4t'; var sayfa='arama'}
	var myDiv = document.getElementById(divid);
	
	ajax({
		url : 'http://'+location.host+'/include/asp/product_list_'+sayfa+'.asp',
		data : veri,
		type : 'GET',
		error : function(xmlHttpRequestObject) {
			alert('HATA')
		},
		success : function(data) {
			myDiv.innerHTML = data
		}
		});
}

function ajaxla2(tabid,veri) {
	var myDiv = document.getElementById(tabid);
	
	ajax({
		url : 'http://'+location.host+'/include/asp/product_comp_list.asp',
		data : veri,
		type : 'GET',
		error : function(xmlHttpRequestObject) {
			//alert('HATA')
		},
		success : function(data) {
			myDiv.innerHTML = data
		}
		});
}

function ajaxla3(tabid,veri) {
	var myDiv = document.getElementById(tabid);
	
	ajax({
		url : 'http://'+location.host+'/include/asp/product_menu.asp',
		data : veri,
		type : 'GET',
		error : function(xmlHttpRequestObject) {
			alert('HATA')
		},
		success : function(data) {
			myDiv.innerHTML = data
		}
		});
}

function yukle_list(tabid) {
	var myDiv = document.getElementById(tabid);
	
	ajax({
		url : 'http://'+location.host+'/include/asp/yukle_list.asp',
		data : '',
		type : 'GET',
		error : function(xmlHttpRequestObject) {
			alert('HATA')
		},
		success : function(data) {
			myDiv.innerHTML = data
		}
		});
}

function yukleme(model) {
	var secim = document.getElementById("yukle_list");
	var model = secim.options[secim.selectedIndex].id;
	document.location.href = 'http://'+location.host+'/'+model;
}

function compare(sira,kat,kat2,marka,model) {
	if (model=='') {
		var secim = document.getElementById("comp"+sira);
		var model=secim.options[secim.selectedIndex].value;
		var model2=secim.options[secim.selectedIndex].text;
		document.getElementById("title_"+sira).innerHTML = marka + " " + model2.replace(" ","<br><b>");
	}
	var imgs = document.getElementById("comp_img"+sira);
	var urls = document.getElementById("comp_url"+sira);
	
	if (secim!="") ajaxla2("model"+sira,"marka="+marka+"&model="+model+"&");
	imgs.src='http://'+location.host+'/images/'+kat+'/'+model+'/'+model+'_50_1.gif';
	urls.href='http://'+location.host+'/'+marka+'/'+kat2+'/'+model;
	secims.focus;
}

function tab_filtre(aktif,veri) {
	document.getElementById('filtre1').className='border_b gray_bg4 menu_txt';
	document.getElementById('filtre2').className='border_b gray_bg4 menu_txt';
	document.getElementById('filtre3').className='border_b gray_bg4 menu_txt';
	document.getElementById('filtre4').className='border_b gray_bg4 menu_txt';

	document.getElementById('filtre1t').style.display='none';
	document.getElementById('filtre2t').style.display='none';
	document.getElementById('filtre3t').style.display='none';
	document.getElementById('filtre4t').style.display='none';

	if (aktif==1) {document.getElementById('filtre1').className="main_table_w menu_txt"; document.getElementById('filtre1t').style.display='block'; ajaxla(1,veri)}
	if (aktif==2) {document.getElementById('filtre2').className="main_table_w menu_txt"; document.getElementById('filtre2t').style.display='block'; ajaxla(2,veri)}
	if (aktif==3) {document.getElementById('filtre3').className="main_table_w menu_txt"; document.getElementById('filtre3t').style.display='block'; ajaxla(3,veri)}
	if (aktif==4) {document.getElementById('filtre4').className="main_table_w menu_txt"; document.getElementById('filtre4t').style.display='block'; ajaxla(4,veri)}
}

function div_gizle(divid,islem) {
	var myDiv = document.getElementById(divid);
	myDiv.style.display=islem;
}

menu_height = 0;
timer = null;

function menuGrow() {
    growImg = document.getElementById('menu_b').style
    growImg.height= menu_height;
 
    if(menu_height != 200) {
        menu_height += 10;
        timer = setTimeout('menuGrow()', 10);
    } else {
        clearTimeout('timer');
    }
}

function menuGrow2() {
    growImg = document.getElementById('menu_b').style
    growImg.height= menu_height;
 
    if(menu_height != 0) {
        menu_height -= 10;
        timer = setTimeout('menuGrow2()', 10);
    } else {
        clearTimeout('timer');
        document.getElementById('menu_over').style.display='none';
    }
}

function menu(aktif) {
	document.getElementById('jq_fmslideshow').style.zIndex="10";

	document.getElementById('menu1').style.display='none';
	document.getElementById('menu2').style.display='none';
	document.getElementById('menu3').style.display='none';
	document.getElementById('menu4').style.display='none';
	document.getElementById('menu5').style.display='none';

	document.getElementById('menu_item1').className='menu_item2';
	document.getElementById('menu_item2').className='menu_item2';
	document.getElementById('menu_item3').className='menu_item2';
	document.getElementById('menu_item4').className='menu_item2';
	document.getElementById('menu_item5').className='menu_item2';

	if (aktif!="" && aktif!=null) {
		document.getElementById('jq_fmslideshow').style.zIndex="-1";
		document.getElementById('menu_item'+aktif).className='menu_item2x';
	}
	if (aktif!="" && aktif!=null) {
		document.getElementById('menu_item'+aktif).className='menu_item2x';
		document.getElementById('menu'+aktif).style.display='block';
	}
}

function yazdir(id,baslik) {
	var content = document.getElementById(id);
	var contentmain = content.innerHTML;
	var i=0;
	for (i=0;i<=14;i++) {
		contentmain = contentmain.replace("<br><br>","<br>");
		contentmain = contentmain.replace("padding:5","padding:0");
		contentmain = contentmain.replace("<tr><td colspan=\"2\" height=\"5\"></td></tr>","");
		contentmain = contentmain.replace("height=\"24\"","height=\"16\"");
		contentmain = contentmain.replace("height=\"30\"","");
		contentmain = contentmain.replace("document","//document");
	}
	contentmain = contentmain.replace("<span id=\"print_info\"></span>","<table width=100%><tr><td><img src=http://"+location.host+"/images/telpa.png height=40></td><td align=right class=baslik18>" + baslik + "</td></tr></table>");
	var precontent = "<html><head><link rel='stylesheet' media='all' type='text/css' href='http://"+location.host+"/include/css/main.css'>";
	precontent = precontent + "<style>tbody {font-size:10px} select {display:none}</style>";
	precontent = precontent + "</head><body leftmargin=0 topmargin=0 bottommargin=0 rightmargin=0>";
	var pri = document.getElementById("printframe").contentWindow;
	pri.document.open();
	pri.document.write(precontent + contentmain + "</body></html>");
	pri.document.close();
	pri.focus();
	pri.print();
}

function accord(aktif) {
	document.getElementById('acc_item1').className='accordionButton accordion_headings menu_item rounded-tl rounded-tr';
	document.getElementById('acc_item2').className='accordionButton accordion_headings menu_item';
	document.getElementById('acc_item3').className='accordionButton accordion_headings menu_item';
	document.getElementById('acc_item4').className='accordionButton accordion_headings menu_item';
	document.getElementById('acc_item5').className='accordionButton accordion_headings menu_item rounded-bl rounded-br';
	if (aktif=="1") {
		document.getElementById('acc_item'+aktif).className='accordionButton accordion_headings header_highlight menu_itemx rounded-tl rounded-tr';
	} else {
		document.getElementById('acc_item'+aktif).className='accordionButton accordion_headings header_highlight menu_itemx';
	}
	if (aktif=="3") {
		xmlhttpPost('http://'+location.host+'/include/asp/yukle_list.asp','yukle_list2');
	}
}

function popup(mypage, myname, w, h, scroll) {
	var winl = (screen.availWidth - w) / 2;
	var wint = (screen.availHeight - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
	win = window.open(mypage, myname, winprops)
	void(0);
	if (parseInt(navigator.appVersion) >= 4) {win.window.focus()}
}

function bayiler(kod,model) {
	if(kod!="") {
		if (model!="" && model!=undefined && model!="undefined") {
			popup('http://'+location.host+'/bayi/?sehir='+kod+'&model='+model,'bayiler',650,400,1);
		} else {
			popup('http://'+location.host+'/bayi/?sehir='+kod,'bayiler',650,400,1);
		}
		return false;
	} else {
		document.getElementById('sehir').focus();
		return false;
	}
}

function imeiara(tur) {
	var kutu=document.getElementById('imei');

	if (tur==1 || tur=='1') {
		if(kutu.value.length<15) { 
			alert("IMEI Numaranýz 15 Karakter Olmalýdýr!"); 
			kutu.focus();  
			return false;
		} else {
			document.imeif.action="https://www.telpabayi.com/imei/";
			popup('https://www.telpabayi.com/imei/?imei='+kutu.value,'imei',400,315,0);
		}
	}

	if (tur==2 || tur=='2') {
		if(kutu.value.length!=15 && kutu.value.length!=13) { 
			alert("IMEI ya da Form No\'da hata var!"); 
			kutu.focus();  
			return false;
		}
		if(kutu.value.length==15) {adresi='takip'} else {adresi='takip2'}
		document.imeif.action="https://www.telpabayi.com/imei/"+adresi+".asp";
		popup('https://www.telpabayi.com/imei/'+adresi+'.asp?imei='+kutu.value,'imei',400,315,0);
	}
	return false;
}
