$(document).ready(function()
{
	$(document).pngFix();
	
	//$("#wrapper").center();
	
	$("#nptUsername").focus(function()
									 {
										 $(this).attr("value", "");
									 });
	
	$("#nptUsername").blur(function()
									 {
										 if($(this).attr("value") == "" || $(this).attr("value") == null)
										 {
											 $(this).attr("value", "kullanıcı adı");
										 }
									 });
	
	$("#nptPassword").focus(function()
									 {
										 $(this).attr("value", "");
									 });
	
	$("#nptPassword").blur(function()
									 {
										 if($(this).attr("value") == "" || $(this).attr("value") == null)
										 {
											 $(this).attr("value", "şifre");
										 }
									 });
	
	
	
	
	

   $("#btnSignin").click(function()
								  {
									  $("#areaSignin").fadeIn("slow");
									  return false;
								  });
   
   $("#btnCancel").click(function()
								  {
									  $("#areaSignin").fadeOut("slow");
									  return false;
								  });
   
   
   
   
   $("#frmSignin").submit(function()
								   {
									   var errMessage = "";
									   var focusObj = "";
									   
									   if( $("#UserPassword").val() == $("#UserPasswordRe").val() )
									   {
										   if( $("#UserName").val() == "" )
										   {
											   errMessage += "\n ad bölümü doldurulmalıdır.";
											   focusObj = (focusObj == "") ? "UserName" : focusObj;
										   }
										   
										   if( $("#UserSurname").val() == "" )
										   {
											   errMessage += "\n soyad bölümü doldurulmalıdır.";
											   focusObj = (focusObj == "") ? "UserSurname" : focusObj;
										   }
										   
										   if( $("#UserEmail").val() == "" )
										   {
											   errMessage += "\n e-posta bölümü doldurulmalıdır.";
											   focusObj = (focusObj == "") ? "UserEmail" : focusObj;
										   }
										   
										   if( $("#UserUsername").val() == "" )
										   {
											   errMessage += "\n kullanıcı adı bölümü doldurulmalıdır.";
											   focusObj = (focusObj == "") ? "UserUsername" : focusObj;
										   }
										   
										   if( $("#UserPassword").val() == "" )
										   {
											   errMessage += "\n şifre bölümü doldurulmalıdır.";
											   focusObj = (focusObj == "") ? "UserPassword" : focusObj;
										   }
										   
										   if( $("#UserPasswordRe").val() == "" )
										   {
											   errMessage += "\n şifre (tekrar) bölümü doldurulmalıdır.";
											   focusObj = (focusObj == "") ? "UserPasswordRe" : focusObj;
										   }
									   }
									   else
									   {
										   errMessage = "şifre alanı, şifre tekrar alanıyla aynı olmalıdır.";
										   focusObj = (focusObj == "") ? "UserPassword" : focusObj;
									   }
									   
									   if( errMessage == "" )
									   {
										   return true;
									   }
									   else
									   {
										   alert(errMessage);
										   $("#" + focusObj + "").focus();
										   return false;
									   }
								   });
	
	
	
	
	
	
	
});

function url(url)
{
	window.location=url;
}

function openUserArea()
{
	$("#areaSignin").fadeIn("slow");
}


function getThickBox(url, title)
{
	var a = document.getElementById('dummyanchor');
	a.setAttribute('href',url);
	a.setAttribute('title',title);
	$('#dummyanchor').click();
}

function openHelp()
{
    window.open('yardim.html','001','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=505,height=400');
}

function openAd()
{
    window.open('reklam_filmi.html','001','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=405,height=305');
}

function openBehind()
{
    window.open('kamera_arkasi.html','001','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=405,height=305');
}