﻿var pop_blank = "<table><tbody><tr><td class='body'><div class='content' style='display: block;'><table style='width: 600px;' id='pop_dialog_table' class='pop_dialog_table'><tbody><tr><td class='pop_topleft'></td><td class='pop_border pop_top'></td><td class='pop_topright'></td></tr><tr><td class='pop_border pop_side'></td><td class='pop_content' id='pop_content'><h2 class='dialog_title' id='pop_title'><span>Lütfen Bekleyin</span></h2><div class='dialog_content'><div class='dialog_summary' id='pop_summary'>&nbsp;</div><div class='popUpTable' id='pop_body'></div><div class='dialog_buttons' id='pop_buttons' style='display:none'><input onclick='$(document).trigger(\"close.facebox\")' class='inputsubmit' name='close' value='Kapat' type='button'></div></div></td><td class='pop_border pop_side'></td></tr><tr><td class='pop_bottomleft'></td><td class='pop_border pop_bottom'></td><td class='pop_bottomright'></td></tr></tbody></table></div></td></tr></tbody></table>";
function isMail( text )
{
	var pattern = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
	var regex = new RegExp( pattern );
	return regex.test( text );
}


function apopDialog () {

	$(function() {
		$('#dialog').dialog('open').fadeIn('normal');   
		$("#dialog").dialog({
			bgiframe: true,
			modal: true,
			buttons: {
				Kapat: function() {
					$(this).dialog('close');
				}
			}
		});
	});	
}

function popDialog (msg) {

	$(function() {
			   $('#dialog').html(msg);
			$('#dialog').dialog('open').fadeIn('normal');   
			$("#dialog").dialog({
				bgiframe: true,
				modal: true,
				buttons: {
					Kapat: function() {
						$(this).dialog('close');
					}
				}
			});
	});	
}

/* iletisim formu için */
/* Drop down için */
		function showDropDown(elm){
			var tempDropDown  = $('#tempDropDown' ).val()
			if (tempDropDown !=''){
		 		hideDropDown(tempDropDown)
			}
		$('#tempDropDown' ).val(elm)
         setTimeout("$('#"+ elm +"' ).css('visibility','visible');",100)
		 
        }
		
		function hideDropDown(elm){
			setTimeout("$('#"+ elm +"' ).css('visibility','hidden');",100)
        
        }

/* Drop down için */

function submitButon(buton) {
var form = document.iletisimForm ;	
	if (form.adiniz_soyadiniz.value.length<3){
	 alert('Lütfen, Adinizi Soyadinizi belirtiniz.')	
	} else if (isMail(form.e_posta.value)!=true) {
	 alert('Lütfen, e-posta adresine geçerli bir e-posta belirtiniz.') 
	} else if (form.konu_basligi.value.length< 3) {
	 alert('Lütfen, mesajinizin konu basligini belirtiniz.') 
	} else if (form.mesajiniz.value.length< 40) {
	 alert('Lütfen, mesajinizi yaziniz.') 
	} else {
		form.submit();
	}
	
	
}
function setPhoneFormat (elm) {
	isNumber (elm);
	if (elm.value.length==3){
		elm.value = elm.value +' ';
	}
	if (elm.value.length==6){
		elm.value = elm.value +' ';
	}
	
}
function isNumber(elm,no) {
	var elm = elm.value.replace(/ /ig,'');
	if (!Number(elm)){
		if (no==0){ alert('Sadece numerik karakter kullanabilirsiniz.')}
	  return false;
	} else {
		return true;
	}
	
}

/* iletisim formu için */

/* ürün detay için */
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);
}

/* ürün detay için */
function setValue (elem) {
	var elm = eval('Array('+elem+')')
	for (var i = 0; i < elm.length ; i++){
//		document.getElementById(elm[i]).value=elm[i+1];
	encodeURIComponent($('#'+elm[i]).val(elm[i+1])); 
	}
}
function doFilter() {
 	var cat_a_il_id = encodeURIComponent($('#cat_a_il_id').val()); 
 	var cat_260_id = encodeURIComponent($('#cat_260_id').val()); 
 	var cat_30_ismi = encodeURIComponent($('#cat_30_ismi').val()); 
	$.ajax({
	 type: "POST",
	 url: "kategori-filitrele.html",
	 data: "cat_a_il_id="+cat_a_il_id+"&cat_260_id="+cat_260_id+"&cat_30_ismi="+cat_30_ismi,
	 success: function(msg){
		 $('#proBody').html(msg);
			$("#dialog1").dialog({
				bgiframe: true,
				modal: true,
				buttons: {
					Kapat: function() {
						$(this).dialog('close');
					}
				}
			});

		 
		 }
	 }); 
}

function disabledcombo(id, disabled) {
	document.getElementById(id).disabled = disabled;
	//custom function
	if(document.getElementById(id).refresh!=undefined)
			document.getElementById(id).refresh();
}

