﻿var allExpand = false;
var refObj = null;


$(document).ready( function(){
							
								$(".login_form").submit(function(){
									
									if($('input[name=user]').val()=="" || $('input[name=pass]').val()=="")
									{
										alert("Kullanıcı Adı veya Parola Eksik");
										return false;
									}
									
									
									var s = $(".login_form").serialize();
									$.ajax({
									   type: 'POST',
									   url:  'Scripts/jqueryfunctions.php',
									   data: s,   
									   dataType:'json',
									   success: function(sonuc) {
											if(sonuc.hata=="true")
											{
												alert(sonuc.mesaj);
											}
											else
											{
												window.location = "index.php";
											}
									   }
									 });									
									return false
								});
					
								$("input[name='user']").focus(function(){
														  	$("input[name='user']").val("");
														   });		
								
								
								$("#testanaara").autocomplete({
									source: "Scripts/testacsearch.php",
									minLength: 2,
									select: function(event, ui) {
										//$("#anaara").val("ui.item.value");
										//alert(ui.item ? ("Selected: " + ui.item.value + " aka " + ui.item.id) : "Nothing selected, input was " + this.value);
									}
								});
								
								
								
								$("#anaara").autocomplete({
									source: "Scripts/acsearch.php",
									minLength: 2,
									select: function(event, ui) {
										//$("#anaara").val("ui.item.value");
										//alert(ui.item ? ("Selected: " + ui.item.value + " aka " + ui.item.id) : "Nothing selected, input was " + this.value);
									}
								});
								
								$("#m1,#m2,#m3").autocomplete({
									source: "Scripts/acmalsearch.php",
									minLength: 2,
									select: function(event, ui) {
										//$("#anaara").val("ui.item.value");
										//alert(ui.item ? ("Selected: " + ui.item.value + " aka " + ui.item.id) : "Nothing selected, input was " + this.value);
									}
								});
							  
							  $(function(){
							   $(".haccordion").haccordion();
							  });
								  
								
							 Goster('job1');
							 
							 //$("#jobs3").click(function(){ Goster("job3"); });
								

							
							var winW ="";
							 if (navigator.appName.indexOf("Microsoft")!=-1)
							 {
								  winW = document.body.offsetWidth;
							 }
							 else if(navigator.appName.indexOf("Netscape")!=-1)
							 {
								 winW = document.body.offsetWidth;
							 }
							 else
							 {
								winW = window.innerWidth;	
							 }
							 
						
							if(winW > 1039)
							{
								$(".sogan").css("display","block");
								$(".tava").css("display","block");
								$(".tava").css("width",winW);
								$(".sogan").css("width",winW);
								pos = (winW - 1039)/2;

								$(".tava").css("background-position",(1020+pos)+"px 0px");
								$(".sogan").css("background-position",(pos-235)+"px 0px");
								//$(".sogan").css("left", pos-235 );
								//$(".tava").css("left", 1039 + pos );
								
							}
							
							window.onresize = function(){
								var winW ="";
								 if (navigator.appName.indexOf("Microsoft")!=-1)
								 {
									  winW = document.body.offsetWidth;
								 }
								 else if(navigator.appName.indexOf("Netscape")!=-1)
								 {
									 winW = document.body.offsetWidth;
								 }
								 else
								 {
									winW = window.innerWidth;	
								 }
								$(".sogan").css("display","block");
								$(".tava").css("display","block");
								$(".tava").css("width",winW);
								$(".sogan").css("width",winW);
								pos = (winW - 1039)/2;

								$(".tava").css("background-position",(1020+pos)+"px 0px");
								$(".sogan").css("background-position",(pos-235)+"px 0px");
								
							}
							
							
							});



function Goster(Obj)
{
	if(allExpand == false)
	{
		if(refObj == null)
		{
			refObj=Obj;
			$("#"+Obj).slideToggle();
		}
		else
		{
			$("#"+refObj).slideUp("normal",openotherFile);
			refObj = Obj;
		}
		
	}
	else
	{
			refObj =Obj;
			$("#"+refObj).slideToggle();
	}
	
	
	return false;
	
}

	function openotherFile()
	{
		$("#"+refObj).slideDown();
	}
	



