
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("list_on_list");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;

jQuery(document).ready(function() {
    jQuery("#mycarousel").jcarousel({
        scroll: 1,
	auto:7,
	wrap:'last',
        initCallback: mycarousel_initCallback
        // This tells jCarousel NOT to autobuild prev/next buttons
    });
	
});

function mycarousel_initCallback(carousel)
{
    jQuery('.jcarousel-control a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};


/*
	div	id=results
		$.ajax({
		type: "GET",
		url: "index.php?engine=login",
		data: x,
		success: function(msg){

			$('#results').html(msg);
			
		}
	});

*/
function login(){
	var name	= 	$('#name').val();
	var pass	= 	$('#pass').val();
	if(name.length<4 || !name){
		$('#results').show('slow');
		$('#results').html("Mail Adresiniz Çok Kısa");
		return false;
	}else if(pass.length<4 || !pass){
		$('#results').show('slow');
		$('#results').html("Şifreniz Çok Kısa");
		return false;
	}else{
		var x	=	$("form").serialize();
		var loading ='<img src="img/ajax-loader.gif" />';
		$.ajax({
			type: "GET",
			url: "index.php?engine=login",
			data: x,
			success:function(msg){
					$('#results').show('slow');
					if(msg==0){
						$('#results').html("Giriş Başarısız");
					}else if(msg==1){
						$('#results').html("Giriş Başarılı Yönlendiriliyorsunuz");
						document.location = 'anasayfa';
					}else{
						$('#results').html(msg);
					}
				}
		});
		$("#results").ajaxStart(function(){
			$('#results').show('slow');
			$('#results').html(loading);
		});
		$("#results").ajaxError(function(){
			$(this).html("Üzgünüm İşleminizi Gerçekleştiremiyorum <br>	Lütfen Daha sonra Deneyiniz");
		});
		return false;
	}
	return false;
}



	

function lostpass(){
	lost_tpl = ''
		+'<form id="lost_form" style="margin-top:20px;">'
			+'<table id="kullanici">'
				+'<tr>'
					+'<td width="100">Mail Adresiniz : </td>'
					+'<td><input type="text" name="mail" id="mail" class="giris" /></td>'
					+'<td>Lütfen Sisteme Kayıtlı olan Mail Adresinizi Giriniz </td>'
				+'</tr>'
				+'<tr>'
					+'<td colspan="6">'
						+'<input type="button" value="Gönder" onclick="lost_post();" class="buttonn" /> '
					+'</td>'
				+'</tr>'
			+'</table>'
		+'</form>';
	$('#results').show('slow');
	$('#results').html(lost_tpl);	
}

function lost_post(){
	var	yol	=	$('form').serialize();
	var loading ='<img src="img/ajax-loader.gif" />';


	$.ajax({
		   type: "GET",
		   url: "index.php?engine=lost_pass",
		   data: yol,
		   success:function(msg){
					alert(msg);
			   }
			   
	});
}

function mail_con(){
	var	yol	=	$('form').serialize();
	var loading ='<img src="img/ajax-loader.gif" />';


	$.ajax({
		   type: "GET",
		   url: "index.php?engine=contact",
		   data: yol,
		   success:function(msg){
					if(msg==1){
						alert("İletişim Formunuz Elimize Ulaştı\nİlginizi Teşekkürler");
					}else if(msg==2){
						alert("Formda Boş Yerler Var !! ");
					}else if(msg==5){
						alert("Mail Adresiniz Hatalı Girilmiş!! ");
					}else{
						alert("Formunuzu Gönderemiyorum.Lütfen Tekrar Deneyiniz")
					}
					
				   if(msg==1){
						document.location="anasayfa";
				   }
			   }
			   
	});
}

function register_member(){
	var	yol	=	$('form').serialize();
	var loading ='<img src="img/ajax-loader.gif" />';
	$.ajax({
		   type: "GET",
		   url: "index.php?engine=register_member",
		   data: yol,
		   success:function(msg){
					alert(msg);
			   }
			   
	});
}

function Yazdir()
{
    var	yol	=	$('form').serialize();
    window.open('yazdir?'+yol,'Yazdırılıyor','toolbar=0,resizable=0');
}

$(document).ready(function(){
	$('#register_member').click( register_member );

	$("#register_member").ajaxStart(function(){
		$(this).html('<img src="img/21-0.gif" style="float:right" />');
	});
	$("body").ajaxError(function(){
		alert("Üzgünüm İşleminizi Gerçekleştiremiyorum <br>	Lütfen Daha sonra Deneyiniz");
	});
});
	
	


function new_pass(){
	var	yol	=	$('form').serialize();
	var loading ='<img src="img/ajax-loader.gif" />';
	
	$.ajax({
		   type: 	"GET",
		   url:		"index.php?engine=newpass",
		   data:	yol,
		   success:	function(msj){
			   		$('#results').show('slow');
			   		$('#results').html(msj);
		   }
		   
		   })
			$("#results").ajaxError(function(){
				$(this).html("Üzgünüm İşleminizi Gerçekleştiremiyorum <br>	Lütfen Daha sonra Deneyiniz");
			});
}



function pass_update(){	
var msj;
	var	yol	=	$('form').serialize();
	$.ajax({
		   type: "GET",
		   url: "index.php?engine=sifre_update",
		   data: yol,
		   success: function(msg){
			   	alert(msg);
				
			   }
	});
}

makeSelectBox = function (selectedid,name,holderid,width,values,selected){
	var x;
	if(values){
		var list = values;
	} else {
		var list = $F(holderid);
	}
	var items = list.split("|");
	var content ='<select name="'+name+'" id="'+name+'" style="width:'+width+'px;">';
	for (var cc=0;cc<(items.length-1);cc++)	{
		itemsinfo=items[cc].split(";");
		if(itemsinfo[2]=="1"){
			content=content+'<optgroup label="'+itemsinfo[1]+'">';
		} else if(itemsinfo[2]=="2"){
			content=content+'</optgroup>';
		} else {
			if(selected==itemsinfo[0]){
				x	= 'selected="selected"';
			}else{
				x ='';
				}
			if(selectedid==itemsinfo[0]){
				var selectedtext='selected';
			} else {
				var selectedtext='';
			}
			content=content+'<option '+selectedtext+' value="'+itemsinfo[0]+'" '+x+'>'+itemsinfo[1]+'</option>';
		}
	}
	content=content+'</select>';
	return content;
}



