﻿// JScript File

function doTrans(LastIndex,_im) {
        var startImage =arrIMG[_im];
        var endImage=arrIMG[LastIndex];
        
        imgObj.filters[0].apply();

        if (document.getElementById('degis').innerHTML.indexOf(startImage)!=-1)
            document.getElementById('degis').innerHTML = endImage;
        else 
            document.getElementById('degis').innerHTML = startImage;
            
        
	imgObj.filters[0].play();
}

var LastImgIndex=0;
function chngImg(_im)
{
    if(arrIMG)
    {
        if(arrIMG!=null && arrIMG.length>0)
        {
            if(_im<arrIMG.length)
            {
                if(arrIMG[_im].length>0)
                {
                    //efect 
                    if(LastImgIndex!=_im)
                    {
                        doTrans(LastImgIndex,_im);
                    }
                    LastImgIndex=_im;
                }
            }
        }  
    }
}

var ind=0;
var lastind=0;
var isStart=false;
function StartNavigateLink()
{
        if(!isStart)
        {
            isStart=true;
            setTimeout('NavigateLink()',3000);
        }
}
function ChangePic(str)
{
document.getElementById('degis').innerHTML =str;
return false;
}
function EndNavigateLink()
{
    isStart=false;
   // clearTimeout(timer);
    
    //if(lastind != 0)
      //  document.getElementById('imgtd' + (lastind+1)).style.background="white";
}

var timer;
function NavigateLink()
{
    if(isStart)
    {
        //alert(timer);
        if(arrIMG!=null && arrIMG.length>0)
        {
            
        //  document.getElementById('imgtd' + (ind+1)).style.background="gray";
            
            if(ind!=lastind)
          //     document.getElementById('imgtd' + (lastind+1)).style.background="white";

            
            chngImg(ind);
            lastind=ind;
            ind++;
            if(ind>=arrIMG.length)
            {
                ind=0;
                //lastind=0;
            }
            
            timer=setTimeout('NavigateLink()',3000);
        }
    }
    else
      timer=setTimeout('NavigateLink()',3000);
}
 function controlForm()
    {
    var errMsg="Kayıtta Bulunan Hatalar: \n--- \n";
    var isCorrect=true;
    if((document.getElementById("UserTourDetails1_AgentCommunications1_txtName").value==""))
    {
        isCorrect=false;
        errMsg+="İsim Yazmalısınız \n";
    }
     if(document.getElementById("UserTourDetails1_AgentCommunications1_txtSurName").value=="")
    {
        isCorrect=false;
        errMsg+="Soyisim Yazmalısınız \n";
    }
     if(document.getElementById("UserTourDetails1_AgentCommunications1_txtAddress").value=="")
    {
        isCorrect=false;
        errMsg+="Adres Yazmalısınız \n";
    }
     if(document.getElementById("UserTourDetails1_AgentCommunications1_txtState").value=="")
    {
        isCorrect=false;
        errMsg+="İl Yazmalısınız \n";
    }
  
        var email = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/; //email kontrolü için.

 

if(document.getElementById('UserTourDetails1_AgentCommunications1_txtMail').value.replace(/ /,"").length<7)

    {

            isCorrect=false;

        errMsg +="Mail adresi girmelisiniz \n";

     }

     if(document.getElementById('UserTourDetails1_AgentCommunications1_txtMail').value.replace(/ /,"").length>7)

     {

            var str = document.getElementById('UserTourDetails1_AgentCommunications1_txtMail').value;

            

            if(!str.match(email))

            {

                isCorrect=false;

                errMsg +="Mail adresinin formatı doğru olmalı \n";

            }

      }
    
    if(isCorrect==false)
    {
     errMsg +="---\nLütfen Hataları Düzeltiniz.";
    alert(errMsg);
    }
    return isCorrect;
   
    }

function scrollSticky(elem)
{
var ie=document.all && !window.opera
var dom=document.getElementById

iebody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body

objref=(dom)? document.getElementById(elem) : document.all[elem];
var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset

var docwidth=(ie)? iebody.clientWidth : window.innerWidth
docheight=(ie)? iebody.clientHeight: window.innerHeight
objheight=objref.offsetHeight
pos=scroll_top+10;

if((iebody.scrollHeight-objref.scrollHeight)<pos)
 return
	objref.style.top=(scroll_top+2)+"px"
 
}

function OpPop()
  {
   var islem = window.open("BankAccounts.aspx","eofisi","toolbar=no,location=no,directories=no,scrollbars=yes,status=no,menubar=no,resizable=no,width=600,height=600,left=10,top=10");
        islem.focus();
        return false;
  }
