$(function() {
	$("#loginmodal").dialog({
		autoOpen : false,
		height : 150,
		modal : true,
		buttons : {
			'Yeni Kullanıcı Yarat' : function() {
				window.location = webpath + "/?p=reg&continue=cart";
				$(this).dialog('close');
			},
			'Giriş' : function() {
				$("#loginmodalform").submit();
				$(this).dialog('close');
			},
			'İptal' : function() {
				$(this).dialog('close');
			}
		}
	});
	
	$("#badloginpopup").dialog({
		autoOpen : isloginbad,
		height : 150,
		modal : true,
		buttons : {
			'Kapat' : function() {
				$(this).dialog('close');
			}
		}
	});
	
	$.ajaxSetup({
		async: false,
		beforeSend: function(httpreq) {
			httpreq.setRequestHeader("Content-Transfer-Encoding", "UTF-8");
			$("input[type='button']").attr("disabled","disabled");
		},
		complete: function(httpreq) {
			$("input[type='button']").attr("disabled","");
		},
		url : webpath + "/?",
		type : "POST"
	});
});

function checkRegexp(val, regexp) {

	if (!(regexp.test(val))) {
		return false;
	} else {
		return true;
	}
}

function cmpltorder(){
	if($('#outoforder').attr('checked') == true){
		var payby = $("#payby").val();
		window.location = webpath+"/?p=cmpltorder&payby="+payby;
	}
	else{
		$("#outoforderpopup").dialog({
			autoOpen : true,
			height : 150,
			modal : true,
			buttons : {
				'Kapat' : function() {
					$(this).dialog('close');
				}
			}
		});
	}
}
