function delemlak(id, adres)
{
    if (confirm("Are you sure you want to delete '" + adres + "' ?"))
    {
        window.location.href = 'propertylist.php?del=' + id;
    }
}
function delarazi(id, arazi)
{
    if (confirm("Are you sure you want to delete land '" + arazi + "' ?"))
    {
        window.location.href = 'landlist.php?adel=' + id;
    }
}
function delresim(id, baslik, resimid)
{
    if (confirm("Are you sure you want to delete '" + baslik + "'"))
    {
        window.location.href = 'photo.php?id=' + id + '&rdel=' + resimid;
    }
}
function makemain(id, baslik, resimid)
{
    if (confirm("Are you sure you want to make '" + baslik + "' image as frontpage image?"))
    {
        window.location.href = 'photo.php?id=' + id + '&fimg=' + resimid;
    }
}
function delilce(id, isim)
{
    if (confirm("Are you sure you want to delete resort '" + isim + "' ?"))
    {
        window.location.href = 'resortlist.php?idel=' + id;
    }
}
function deluser(id, isim)
{
    if (confirm("Are you sure you want to delete user '" + isim + "' ?"))
    {
        window.location.href = 'userlist.php?udel=' + id;
    }
}
function delfaq(id, soru)
{
    if (confirm("Are you sure you want to delete faq '" + soru + "' ?"))
    {
        window.location.href = 'faqlist.php?fdel=' + id;
    }
}
function dellink(id, title)
{
    if (confirm("Are you sure you want to delete link '" + title + "' ?"))
    {
        window.location.href = 'linklist.php?ldel=' + id;
    }
}
function deltesti(id, isim)
{
    if (confirm("Are you sure you want to delete " + isim + "'s testimonial ?"))
    {
        window.location.href = 'testimonialslist.php?tdel=' + id;
    }
}
function delnews(id, baslik)
{
    if (confirm("Are you sure you want to delete '" + baslik + "' titled news ?"))
    {
        window.location.href = 'newslist.php?ndel=' + id;
    }
}
function deltur(id, tur)
{
    if (confirm("Are you sure you want to delete property type '" + tur + "' ?"))
    {
        window.location.href = 'typelist.php?tdel=' + id;
    }
}
function changeDrawing(filename)
{
   document.getElementById('maindrawing').src = filename;
}
function changeImage(filename, filedesc)
{
   document.getElementById('mainimage').src = filename;
   document.getElementById('mainimage').alt = filedesc;
}

function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else 
countfield.value = maxlimit - field.value.length;
}

function imageholderclass(){
this.over=new Array();
this.down=new Array();
this.src=new Array();
this.store=store;

function store(src, down, over){
var AL=this.src.length;
this.src[AL]=new Image(); this.src[AL].src=src;
this.over[AL]=new Image(); this.over[AL].src=over;
this.down[AL]=new Image(); this.down[AL].src=down;
}
}

var ih = new imageholderclass();
var mouseisdown=0;

function preloader(t){
for(i=0;i<t.length;i++){
if(t[i].getAttribute('srcover')||t[i].getAttribute('srcdown')){

storeimages(t[i]);
var checker='';
checker=(t[i].getAttribute('srcover'))?checker+'A':checker+'';
checker=(t[i].getAttribute('srcdown'))?checker+'B':checker+'';

switch(checker){
case 'A' : mouseover(t[i]);mouseout(t[i]); break;
case 'B' : mousedown(t[i]); mouseup2(t[i]); break;
case 'AB' : mouseover(t[i]);mouseout(t[i]); mousedown(t[i]); mouseup(t[i]); break;
default : return;
}

if(t[i].src){t[i].setAttribute("oldsrc",t[i].src);}
}
}
}
function mouseup(t){
var newmouseup;
if(t.onmouseup){
t.oldmouseup=t.onmouseup;
newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("srcover");this.oldmouseup();}

}
else{newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("srcover");}}
t.onmouseup=newmouseup;
}

function mouseup2(t){
var newmouseup;
if(t.onmouseup){
t.oldmouseup=t.onmouseup;
newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("oldsrc");this.oldmouseup();}
}
else{newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("oldsrc");}}
t.onmouseup = newmouseup;
}

function mousedown(t){
var newmousedown;
if(t.onmousedown){
t.oldmousedown=t.onmousedown;
newmousedown=function(){if(mouseisdown==0){this.src=this.getAttribute("srcdown");this.oldmousedown();}}
}
else{newmousedown=function(){if(mouseisdown==0){this.src=this.getAttribute("srcdown");}}}
t.onmousedown=newmousedown;
}

function mouseover(t){
var newmouseover;
if(t.onmouseover){
t.oldmouseover=t.onmouseover;
newmouseover=function(){this.src=this.getAttribute("srcover");this.oldmouseover();}
}
else{newmouseover=function(){this.src=this.getAttribute("srcover");}}
t.onmouseover=newmouseover;
}

function mouseout(t){
var newmouseout;
if(t.onmouseout){
t.oldmouseout=t.onmouseout;
newmouseout=function(){this.src=this.getAttribute("oldsrc");this.oldmouseout();}
}
else{newmouseout=function(){this.src=this.getAttribute("oldsrc");}}
t.onmouseout=newmouseout;
}

function storeimages(t){
var s=(t.getAttribute('src'))?t.getAttribute('src'):'';
var d=(t.getAttribute('srcdown'))?t.getAttribute('srcdown'):'';
var o=(t.getAttribute('srcover'))?t.getAttribute('srcover'):'';
ih.store(s,d,o);
}

function preloadimgsrc(){
if(!document.getElementById) return;
var it=document.getElementsByTagName('IMG');
var it2=document.getElementsByTagName('INPUT');
preloader(it);
preloader(it2);
}

if(window.addEventListener){window.addEventListener("load", preloadimgsrc, false);} 
else{
if(window.attachEvent){window.attachEvent("onload", preloadimgsrc);}
else{if(document.getElementById){window.onload=preloadimgsrc;}}
}

function harita(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=736,height=515,toolbar=no,scrollbars=no');
return false;
}
