function UserRegKontrol(pattern, value) 
{ 
   r = new RegExp(pattern, "g"); 
   return r.test(value); 
} 

function formatTelNo (telNo)
{
if (telNo.value == "") return;
var phone = new String (telNo.value);

phone = phone.substring(0,14);
if (phone.match (".[0-9]{3}.[0-9]{3}-[0-9]{4}") == null)
{
if (phone.match (".[0-9]{2}.[0-9]{3}-[0-9]{4}|" + ".[0-9].[0-9]{3}-[0-9]{4}|" +
".[0-9]{3}.[0-9]{2}-[0-9]{4}|" + ".[0-9]{3}.[0-9]-[0-9]{4}") == null)
{
var phoneNumeric = phoneChar = "", i;
for (i=0;i<phone.length;i++)
{
phoneChar = phone.substr (i,1);
if (!isNaN (phoneChar) && (phoneChar != " ")) phoneNumeric = phoneNumeric + phoneChar;
}
phone = "";
for (i=0;i<phoneNumeric.length;i++)
{
if (i == 0) phone = phone + "(";
if (i == 3) phone = phone + ") ";
if (i == 6) phone = phone + "-";
phone = phone + phoneNumeric.substr (i,1)}}}
else
{ 
phone = "(" + phone.substring (1,4) + ") " + phone.substring (5,8) + "-" + phone.substring(9,13); 
}
if (phone != telNo.value) telNo.value = phone;
}
function checkTelNo (telNo)
{
if (telNo.value == "") return;
if (telNo.value.match (".[0-9]{3}.[0-9]{3}-[0-9]{4}") == null)
{
if (telNo.value.match ("[0-9]{10}") != null)
formatTelNo (telNo) 
}
}
function checkEnterForFindListing(e){ 
var characterCode;

if(e && e.which){ 
e = e;
characterCode = e.which ;
}
else{
e = event;
characterCode = e.keyCode; 
}

if(characterCode == 13){ //13 = the code for pressing ENTER 
document.forms[getNetuiTagName("findListingForm")].submit();
return false; 
}
else{
return true ;}}


function CreateAjax() {
    var nesne;
    var tarayici = navigator.appName;
    if(tarayici == "Microsoft Internet Explorer"){
        nesne = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else
    {
        nesne = new XMLHttpRequest();
    }
    return nesne;
}

var http = CreateAjax();

function ChangeDate(tarih,place,sayfa) {
	http.open('get', './lib/lib_'+sayfa+'.asp?Ajax_Date='+tarih);
	http.onreadystatechange = function(){ uygula(place); }
	http.send(null);
}

function uygula(place) {
	var yeri = document.getElementById(place);
    if(http.readyState == 4){
            yeri.innerHTML = http.responseText;
	}
	else {
		yeri.innerHTML = '0çerik yükleniyor...';
    }
}

function popup(url,windowname,width,height) {
	width=(width)?width:screen.width/3;
	height=(height)?height:screen.height/3;
	var screenX = (screen.width/2 - width/2);
	var screenY = (screen.height/2 - height/2);
	var features= "width=" + width + ",height=" + height;
	features += ",screenX=" + screenX + ",left=" + screenX;
	features += ",screenY=" + screenY  +",top=" + screenY;
	var mywin=window.open(url, windowname, features);
	if (mywin) mywin.focus();
	return mywin;
}

function reloadImage2()
{
	document.images["simage2"].src =  'securityImage.asp?rand='+Math.random() * 1000000
}
function bak(id) {
	if (document.getElementById(id).style.display=='block') {
		document.getElementById(id).style.display='none'
	}
	else {
		document.getElementById(id).style.display='block'
	}
}