var alfabe='ABCÇDEFGÐHIÝJKLMNOÖPRSÞTUÜVYZ.1234567890';
var decSep = "";
var sep = ".";
var format_decSep = ",";


/***********************************************
* DHTML Ticker script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function domticker(content, divId, divClass, delay, fadeornot){
this.content=content
this.tickerid=divId //ID of master ticker div. Message is contained inside first child of ticker div
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over ticker (and pause it if it is)
this.pointer=1
this.opacitystring=(typeof fadeornot!="undefined")? "width: 100%; filter:progid:DXImageTransform.Microsoft.alpha(opacity=100); -moz-opacity: 1" : ""
if (this.opacitystring!="") this.delay+=500 //add 1/2 sec to account for fade effect, if enabled
this.opacitysetting=0.2 //Opacity value when reset. Internal use.
document.write('<div id="'+divId+'" class="'+divClass+'"><div style="'+this.opacitystring+'">'+content[0]+'</div></div>')
var instanceOfTicker=this
setTimeout(function(){instanceOfTicker.initialize()}, delay)
}

domticker.prototype.initialize=function(){
var instanceOfTicker=this
this.contentdiv=document.getElementById(this.tickerid).firstChild //div of inner content that holds the messages
// document.getElementById(this.tickerid).onmouseover=function(){instanceOfTicker.mouseoverBol=1}
// document.getElementById(this.tickerid).onmouseout=function(){instanceOfTicker.mouseoverBol=0}
this.rotatemsg()
}

domticker.prototype.rotatemsg=function(){
var instanceOfTicker=this
if (this.mouseoverBol==1) //if mouse is currently over ticker, do nothing (pause it)
setTimeout(function(){instanceOfTicker.rotatemsg()}, 100)
else{
this.fadetransition("reset") //FADE EFFECT- RESET OPACITY
this.contentdiv.innerHTML=this.content[this.pointer]
this.fadetimer1=setInterval(function(){instanceOfTicker.fadetransition('up', 'fadetimer1')}, 101) //FADE EFFECT- PLAY IT
this.pointer=(this.pointer<this.content.length-1)? this.pointer+1 : 0
setTimeout(function(){instanceOfTicker.rotatemsg()}, this.delay) //update container
}
}

// -------------------------------------------------------------------
// fadetransition()- cross browser fade method for IE5.5+ and Mozilla/Firefox
// -------------------------------------------------------------------

domticker.prototype.fadetransition=function(fadetype, timerid){
var contentdiv=this.contentdiv
if (fadetype=="reset")
this.opacitysetting=0.2
if (contentdiv.filters && contentdiv.filters[0]){
if (typeof contentdiv.filters[0].opacity=="number") //IE6+
contentdiv.filters[0].opacity=this.opacitysetting*100
else //IE 5.5
contentdiv.style.filter="alpha(opacity="+this.opacitysetting*100+")"
}
else if (typeof contentdiv.style.MozOpacity!="undefined" && this.opacitystring!=""){
contentdiv.style.MozOpacity=this.opacitysetting
}
else
this.opacitysetting=1
if (fadetype=="up")
this.opacitysetting+=0.2
if (fadetype=="up" && this.opacitysetting>=1)
clearInterval(this[timerid])
}

function deCommafy(inpValue) {
       var re = eval("/\\" + sep + "/g") ;

       return inpValue.replace(re,"");
}
function commafy(inpValue) {
       var re = /(\d+)(\d{3})/ ;
       while ( re.test(inpValue) ) {
           inpValue = eval("inpValue.replace(re,'$1" + sep + "$2')");
       }
       return inpValue;

}
function formatCurrency(inpObj) {
       inpValue = inpObj.value;
       var fromIndex = 0;
       var toIndex = 0;
       ytlVal = inpValue;
       var unformattedString = deCommafy(ytlVal) ;
       if ( unformattedString.length > 12 ) {
           unformattedString = unformattedString.substring(0,12); // en fazla 9 hane olsun
       }
       if ( !isNaN( parseInt(unformattedString,10) ) ) { // ytlVal nümerik bir de?er ise
           unformattedString = parseInt(unformattedString,10).toString() ; // en ba?taki s?f?rlardan kutulmak için bunu yap?yoruz
       } else { // e?er nümerik bir de?er girilmemi?se
          inpObj.value = "";
           //inpObj.focus();
           return;
       }
       inpObj.value = commafy( unformattedString );
}

function currencyFormat(fld, milSep, decSep, e)
{
		var sep = 0;
		var key = '';
		var i = j = 0;
		var len = len2 = 0;
		var strCheck = '0123456789';
		var aux = aux2 = '';
		var whichCode = (window.Event) ? e.which : e.keyCode;
		if (whichCode == 13) return true;  // Enter
		if (whichCode == 8) return true;  // Delete (Bug fixed)
		key = String.fromCharCode(whichCode);  // Get key value from key code
		if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
		len = fld.value.length;
		aux = '';
		for(; i < len; i++)
		if (strCheck.indexOf(fld.value.charAt(i))!=-1) aux += fld.value.charAt(i);
		aux += key;
		len = aux.length;
		if (len == 0) fld.value = '';
		if (len <= 3) fld.value = aux;
		if (len > 3) {
		aux2 = '';
		for (j = 0, i = len-1; i >= 0; i--) {
		if (j == 3 ) {
		aux2 += milSep;
		j = 0;
		}
		aux2 += aux.charAt(i);
		j++;
		}
		fld.value = '';
		len2 = aux2.length;
		for (i = len2; i >= 0; i--)
		fld.value += aux2.charAt(i);
	}
		return false;
}


//-------- favorilere ekle -------------
function AddToFavorites() {
	var is_4up = parseInt(navigator.appVersion);
	var is_mac   = navigator.userAgent.toLowerCase().indexOf("mac")!=-1;
	var is_ie   = navigator.userAgent.toLowerCase().indexOf("msie")!=-1;
	var thePage = location.href;
	if (thePage.lastIndexOf('#')!=-1)
		thePage = thePage.substring(0,thePage.lastIndexOf('#'));
	if (is_ie && is_4up && !is_mac) 
		window.external.AddFavorite(thePage,document.title);
	else if (is_ie || document.images)
		booker_hp = window.open(thePage,'booker_','menubar,width=325,height=100,left=140,top=60');
}
// -------fovorilere ekle ----------------


// resim opacity
function opacity(id, opacStart, opacEnd, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;

    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')", (timer * speed));
            timer++;
        }
    }
}

function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 101);
    object.MozOpacity = (opacity / 101);
    object.KhtmlOpacity = (opacity / 101);
    object.filter = "alpha(opacity=" + opacity + ")";
}



xajax.loadingFunction = function() { document.getElementById('yukle').style.display="block"};
xajax.doneLoadingFunction = function() { document.getElementById('yukle').style.display="none"};

function check(){
	
	var filtrele=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (!filtrele.test(document.getElementById("email").value)){
		alert("Invalid mail address. Please check your email address!");return false;
	}
	
	if(document.getElementById('password').value == '') {alert("Please insert your pssword!");return false;}
	
	xajax_xlogin(xajax.getFormValues('login_form'));
	return false;
	
}
function forgotpassword(){
	var filtrele=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (!filtrele.test(document.getElementById("email").value)){
		alert("Invalid mail address. Please check your email address!");return false;
	}

	xajax_xpassword(xajax.getFormValues('forgotpassword_form'));
	return false;	


}

function poll_check(){
	var error = false;

	for(i=0;i<document.getElementById("form_poll").elements.length;i++)
	{
        if(document.getElementById("form_poll").elements[i].type == "radio") 
		{
             if(document.getElementById("form_poll").elements[i].checked)
			 {
              error = true;    
             }
        }
    }
		
	
	if(error==true)	{
		document.getElementById('form_poll').submit();
	}
	else alert("select a choice");
		
	
}