﻿$(document).ready(function(){

	//$('.index_flash').css("z-index","-1000");
	//$('.top_menu').css("z-index","10000");
	
	$(".menu_container ul li img").hover(
	 function()
	 {
	  this.src = this.src.replace("/off","/on");
	 },
	 function()
	 {
	  this.src = this.src.replace("/on","/off");
	 }
	);
	
	$("h1").prepend("<span></span>");
	
	ddsmoothmenu.init({
		mainmenuid: "top_menu_container", //menu DIV id
		orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
		classname: 'ddsmoothmenu', //class added to menu's outer DIV
		//customtheme: ["#1c5a80", "#18374a"],
		contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
	});
	
	Shadowbox.init({
		players: ["iframe","img","html","flv"],
		handleOversize: "drag",
		counterType: "skip"
	});
	
	
	$('#keyword').keyup(function(e) {
      //alert(e.keyCode);
     	 if(e.keyCode == 13) {
     		document.location.href='search.php?keyword='+$('#keyword').val();
      }
      });
	  
	
	  
	init_news_banners();
	

      
	
	
});


function opengallery()
{
	Shadowbox.open({
        content:    'gallery.php',
        player:     "iframe",
        title:      'Galeri'
    });
}

function init_news_banners()
{
	$('.news_banner_container .news_banner_image_container .news_banner_image:first-child').show();
		
}

function open_news_banner(rel)
{
	$('.news_banner_container .news_banner_image_container .news_banner_image').hide();
	$('#news_banner_image_'+rel).fadeIn();
	
	$('.news_banner_container .news_banner_image_container .news_banner_image_title').hide();
	$('#news_banner_image_title_'+rel).fadeIn();
	
	$('div').removeClass('news_banner_text_selected');
	$('[rel='+rel+']').addClass('news_banner_text_selected');
}


function isValidEmailAddress(emailAddress) 
{
	var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
	return pattern.test(emailAddress);
}

function isTckimlik(tcno)
{
   var toplam;
   toplam = Number(tcno.substring(0,1)) + Number(tcno.substring(1,2)) + Number(tcno.substring(2,3)) + Number(tcno.substring(3,4)) + Number(tcno.substring(4,5)) + Number(tcno.substring(5,6)) + Number(tcno.substring(6,7)) + Number(tcno.substring(7,8)) + Number(tcno.substring(8,9)) + Number(tcno.substring(9,10));
   
	strtoplam = String(toplam);
	
	onunbirlerbas = strtoplam.substring(strtoplam.length, strtoplam.length-1);

	if(onunbirlerbas == tcno.substring(10,11))
	{
		return true;
	}
	else{
		
		return false;
	}
}





//FUNCTIONS
function popup(popup_url, popup_name, winWidth, winHeight){
		if (winWidth == 0){		
			winWidth = (screen.width-30);	
			winHeight = (screen.height-200);	
			scrL = 10;
			scrT = 50;
		}else{
			scrL = (screen.width - winWidth) / 2;
			scrT = ((screen.height - winHeight) / 2);
		}	
	
	
	  yeni = window.open(popup_url, popup_name, "width="+winWidth+",height="+winHeight+",location=0, resizable=0,scrollbars=0,top="+scrT+",left="+scrL);
	  yeni.focus();
	}

function popup_withscroll(popup_url, popup_name, winWidth, winHeight){
	if (winWidth == 0){		
		winWidth = (screen.width-30);	
		winHeight = (screen.height-200);	
		scrL = 10;
		scrT = 50;
	}else{
		scrL = (screen.width - winWidth) / 2;
		scrT = ((screen.height - winHeight) / 2);
	}	


  yeni = window.open(popup_url, popup_name, "width="+winWidth+",height="+winHeight+",location=0, resizable=1,scrollbars=1,top="+scrT+",left="+scrL);
  yeni.focus();
}

